[orca: 1/2] Fix for bgo#617420 - Need unbound keybinding for rotating through punctuation levels.
- From: Mesar Hameed <mhameed src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca: 1/2] Fix for bgo#617420 - Need unbound keybinding for rotating through punctuation levels.
- Date: Mon, 10 May 2010 16:49:32 +0000 (UTC)
commit 685983c7729167fd36a04839ac5121941f903d33
Author: Rudolf Weeber <rudolf weeber gmx de>
Date: Mon May 10 17:28:15 2010 +0100
Fix for bgo#617420 - Need unbound keybinding for rotating through punctuation levels.
src/orca/default.py | 58 +++++++++++++++++++++++++++++++++++
src/orca/gnomespeechfactory.py | 8 +++++
src/orca/speech.py | 14 ++++++++
src/orca/speechdispatcherfactory.py | 7 +++-
4 files changed, 86 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index afa7614..d591300 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -852,6 +852,15 @@ class Script(script.Script):
#
_("Toggles the speaking of indentation and justification."))
+ self.inputEventHandlers["cycleSpeakingPunctuationLevelHandler"] = \
+ input_event.InputEventHandler(
+ Script.cycleSpeakingPunctuationLevel,
+ # Translators: Orca allows users to cycle through
+ # punctuation levels.
+ # None, some, most, or all, punctuation will be spoken.
+ #
+ _("Cycles to the next speaking of punctuation level."))
+
self.inputEventHandlers["listAppsHandler"] = \
input_event.InputEventHandler(
Script.printAppsHandler,
@@ -2055,6 +2064,14 @@ class Script(script.Script):
self.inputEventHandlers[ \
"toggleSpeakingIndentationJustificationHandler"]))
+ keyBindings.add(
+ keybindings.KeyBinding(
+ "",
+ settings.defaultModifierMask,
+ settings.NO_MODIFIER_MASK,
+ self.inputEventHandlers[ \
+ "cycleSpeakingPunctuationLevelHandler"]))
+
try:
keyBindings = settings.overrideKeyBindings(self, keyBindings)
except:
@@ -3420,6 +3437,47 @@ class Script(script.Script):
return True
+
+ def cycleSpeakingPunctuationLevel(self, inputEvent=None):
+ """ Cycle through the punctuation levels for speech. """
+
+ currentLevel = settings.verbalizePunctuationStyle
+ if currentLevel == settings.PUNCTUATION_STYLE_NONE:
+ newLevel = settings.PUNCTUATION_STYLE_SOME
+
+ # Translators: This message will be presented
+ # when user cycles through the available punctuation levels.
+ #
+ line = _("Punctuation level set to some.")
+ elif currentLevel == settings.PUNCTUATION_STYLE_SOME:
+ newLevel = settings.PUNCTUATION_STYLE_MOST
+
+ # Translators: This message will be presented
+ # when user cycles through the available punctuation levels.
+ #
+ line = _("Punctuation level set to most.")
+ elif currentLevel == settings.PUNCTUATION_STYLE_MOST:
+ newLevel = settings.PUNCTUATION_STYLE_ALL
+
+ # Translators: This message will be presented
+ # when user cycles through the available punctuation levels.
+ #
+ line = _("Punctuation level set to all.")
+ else:
+ # the all case, so cycle to none.
+ newLevel = settings.PUNCTUATION_STYLE_NONE
+
+ # Translators: This message will be presented
+ # when user cycles through the available punctuation levels.
+ #
+ line = _("Punctuation level set to none.")
+
+ settings.verbalizePunctuationStyle = newLevel
+ speech.speak(line)
+ speech.updatePunctuationLevel()
+ self.displayBrailleMessage(line, flashTime=settings.brailleFlashTime)
+ return True
+
def toggleTableCellReadMode(self, inputEvent=None):
"""Toggles an indicator for whether we should just read the current
table cell or read the whole row."""
diff --git a/src/orca/gnomespeechfactory.py b/src/orca/gnomespeechfactory.py
index 91a85d4..f098bdc 100644
--- a/src/orca/gnomespeechfactory.py
+++ b/src/orca/gnomespeechfactory.py
@@ -905,6 +905,14 @@ class SpeechServer(speechserver.SpeechServer):
return newText
+ def updatePunctuationLevel(self):
+ """ Punctuation level changed, inform this speechServer. """
+
+ # We dont need to do anything, __addVerbalizedPunctuation
+ # already does this work for us.
+ #
+ pass
+
def __speak(self, text=None, acss=None, interrupt=True):
"""Speaks all queued text immediately. If text is not None,
it is added to the queue before speaking.
diff --git a/src/orca/speech.py b/src/orca/speech.py
index 7a02fe8..8914462 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -317,6 +317,20 @@ def stop():
if _speechserver:
_speechserver.stop()
+
+
+def updatePunctuationLevel(script=None, inputEvent=None):
+ """ Punctuation level changed, inform this speechServer. """
+
+ if _speechserver:
+ _speechserver.updatePunctuationLevel()
+ else:
+ logLine = "SPEECH OUTPUT: 'punctuation level' updated"
+ debug.println(debug.LEVEL_INFO, logLine)
+ log.info(logLine)
+
+ return True
+
def increaseSpeechRate(script=None, inputEvent=None):
if _speechserver:
_speechserver.increaseSpeechRate()
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 96b064d..0a906bf 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -188,7 +188,12 @@ class SpeechServer(speechserver.SpeechServer):
self._current_voice_properties = {}
mode = self._PUNCTUATION_MODE_MAP[settings.verbalizePunctuationStyle]
client.set_punctuation(mode)
-
+
+ def updatePunctuationLevel(self):
+ """ Punctuation level changed, inform this speechServer. """
+ mode = self._PUNCTUATION_MODE_MAP[settings.verbalizePunctuationStyle]
+ self._client.set_punctuation(mode)
+
def _send_command(self, command, *args, **kwargs):
if hasattr(speechd, 'SSIPCommunicationError'):
try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]