[orca] Add a command to toggle speech verbosity levels on the fly



commit 1017844d4c3dc86dfdb04189702eccdd4ed37cfb
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Sep 6 20:19:22 2014 -0400

    Add a command to toggle speech verbosity levels on the fly

 src/orca/cmdnames.py           |    6 ++++++
 src/orca/common_keyboardmap.py |    3 +++
 src/orca/messages.py           |   14 ++++++++++++++
 src/orca/scripts/default.py    |   20 ++++++++++++++++++++
 4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/cmdnames.py b/src/orca/cmdnames.py
index b30a333..5822f59 100644
--- a/src/orca/cmdnames.py
+++ b/src/orca/cmdnames.py
@@ -392,6 +392,12 @@ INCREASE_SPEECH_PITCH = _("Increases the speech pitch.")
 #  We call it 'silencing'.
 TOGGLE_SPEECH = _("Toggles the silencing of speech.")
 
+# Translators: Orca's verbosity levels control how much (or how little)
+# Orca will speak when presenting objects as the user navigates within
+# applications and reads content. The levels can be toggled via command.
+# This string describes that command.
+TOGGLE_SPEECH_VERBOSITY = _("Toggles speech verbosity level.")
+
 # Translators: this string is associated with the keyboard shortcut to quit
 # Orca.
 QUIT_ORCA = _("Quits the screen reader")
diff --git a/src/orca/common_keyboardmap.py b/src/orca/common_keyboardmap.py
index 3ff0a1a..cd01075 100644
--- a/src/orca/common_keyboardmap.py
+++ b/src/orca/common_keyboardmap.py
@@ -60,6 +60,9 @@ keymap = (
     ("s", defaultModifierMask, ORCA_MODIFIER_MASK,
     "toggleSilenceSpeechHandler"),
 
+    ("v", defaultModifierMask, ORCA_MODIFIER_MASK,
+    "toggleSpeechVerbosityHandler"),
+
     ("t", defaultModifierMask, ORCA_MODIFIER_MASK,
     "presentTimeHandler", 1),
 
diff --git a/src/orca/messages.py b/src/orca/messages.py
index ffc550e..9ab7d24 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -1476,6 +1476,20 @@ SPEECH_HIGHER = _("higher.")
 # Translators: This string announces speech pitch change.
 SPEECH_LOWER  = _("lower.")
 
+# Translators: Orca's verbosity levels control how much (or how little)
+# Orca will speak when presenting objects as the user navigates within
+# applications and reads content. The two levels are "brief" and "verbose".
+# The following string is a message spoken to the user upon toggling
+# this setting via command.
+SPEECH_VERBOSITY_BRIEF = C_("Speech", "Verbosity level: brief")
+
+# Translators: Orca's verbosity levels control how much (or how little)
+# Orca will speak when presenting objects as the user navigates within
+# applications and reads content. The two levels are "brief" and "verbose".
+# The following string is a message spoken to the user upon toggling
+# this setting via command.
+SPEECH_VERBOSITY_VERBOSE = C_("Speech", "Verbosity level: verbose")
+
 # Translators: We replace the ellipses (both manual and UTF-8) with a spoken
 # string. The extra space you see at the beginning is because we need the
 # speech synthesis engine to speak the new string well. For example, "Open..."
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 7986dba..493dd3b 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -414,6 +414,11 @@ class Script(script.Script):
                 Script.toggleSilenceSpeech,
                 cmdnames.TOGGLE_SPEECH)
 
+        self.inputEventHandlers["toggleSpeechVerbosityHandler"] = \
+            input_event.InputEventHandler(
+                Script.toggleSpeechVerbosity,
+                cmdnames.TOGGLE_SPEECH_VERBOSITY)
+
         self.inputEventHandlers[ \
           "toggleSpeakingIndentationJustificationHandler"] = \
             input_event.InputEventHandler(
@@ -1875,6 +1880,21 @@ class Script(script.Script):
             _settingsManager.setSetting('silenceSpeech', True)
         return True
 
+    def toggleSpeechVerbosity(self, inputEvent=None):
+        """Toggles speech verbosity level between verbose and brief."""
+
+        value = _settingsManager.getSetting('speechVerbosityLevel')
+        if value == settings.VERBOSITY_LEVEL_BRIEF:
+            self.presentMessage(messages.SPEECH_VERBOSITY_VERBOSE)
+            _settingsManager.setSetting(
+                'speechVerbosityLevel', settings.VERBOSITY_LEVEL_VERBOSE)
+        else:
+            self.presentMessage(messages.SPEECH_VERBOSITY_BRIEF)
+            _settingsManager.setSetting(
+                'speechVerbosityLevel', settings.VERBOSITY_LEVEL_BRIEF)
+
+        return True
+
     def toggleSpeakingIndentationJustification(self, inputEvent=None):
         """Toggles the speaking of indentation and justification."""
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]