[orca] Fix for bug 654795 - Need to improve Orca's speech presentation of WebKitGtk access keys



commit c963f0cd7dedbdd12e5f53d86668cc5b92c88306
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Jul 17 16:07:06 2011 -0400

    Fix for bug 654795 - Need to improve Orca's speech presentation of WebKitGtk access keys

 src/orca/formatting.py                             |    6 ++--
 .../scripts/toolkits/WebKitGtk/speech_generator.py |   34 ++++++++++++++++++++
 2 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index a9332ce..4fa5ca8 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -165,8 +165,8 @@ formatting = {
             'detailedWhereAmI': 'labelAndName + roleName + selectedItemCount + selectedItems'
             },
         pyatspi.ROLE_LINK: {
-            'unfocused': 'labelAndName + roleName + availability',
-            'basicWhereAmI': 'linkInfo + siteDescription + fileSize'
+            'unfocused': 'labelAndName + roleName + availability + ' + MNEMONIC,
+            'basicWhereAmI': 'linkInfo + siteDescription + fileSize + ' + MNEMONIC
             },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState + availability',
@@ -549,7 +549,7 @@ if settings.useExperimentalSpeechProsody:
     formatting['speech'][pyatspi.ROLE_LAYERED_PANE]['detailedWhereAmI'] = \
         'labelAndName + pause + roleName + pause + selectedItemCount + pause+ selectedItems + pause'
     formatting['speech'][pyatspi.ROLE_LINK]['basicWhereAmI'] = \
-        'linkInfo + pause + siteDescription + pause + fileSize'
+        'linkInfo + pause + siteDescription + pause + fileSize + pause + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_LIST_ITEM]['unfocused'] = \
         'labelAndName + allTextSelection + pause + expandableState + pause + availability + positionInList'
     formatting['speech'][pyatspi.ROLE_LIST_ITEM]['basicWhereAmI'] = \
diff --git a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
index 03bc798..4ba39c9 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
@@ -27,12 +27,16 @@ __license__   = "LGPL"
 
 import pyatspi
 
+import orca.keynames as keynames
+import orca.orca as orca
 import orca.rolenames as rolenames
 import orca.settings as settings
 import orca.speech_generator as speech_generator
 
 from orca.orca_i18n import _
 
+_settingsManager = getattr(orca, '_settingsManager')
+
 ########################################################################
 #                                                                      #
 # Custom SpeechGenerator                                               #
@@ -123,3 +127,33 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
 
         return speech_generator.SpeechGenerator._generateAncestors(
             self, obj, **args)
+
+    def _generateMnemonic(self, obj, **args):
+        """Returns an array of strings (and possibly voice and audio
+        specifications) that represent the mnemonic for the object, or
+        an empty array if no mnemonic can be found.
+        """
+
+        if _settingsManager.getSetting('onlySpeakDisplayedText'):
+            return []
+
+        if not (_settingsManager.getSetting('enableMnemonicSpeaking') \
+                or args.get('forceMnemonic', False)):
+            return []
+
+        if not self._script.utilities.isWebKitGtk(obj):
+            return speech_generator.SpeechGenerator._generateMnemonic(
+                self, obj, **args)
+
+        result = []
+        acss = self.voice(speech_generator.SYSTEM)
+        mnemonic, shortcut, accelerator = \
+            self._script.utilities.mnemonicShortcutAccelerator(obj)
+        if shortcut:
+            if _settingsManager.getSetting('speechVerbosityLevel') == \
+               settings.VERBOSITY_LEVEL_VERBOSE:
+                shortcut = 'Alt Shift %s' % shortcut
+            result = [keynames.localizeKeySequence(shortcut)]
+            result.extend(acss)
+
+        return result



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