[orca] Cleaning up of Fix for bgo#616820 - There is no command to speak the list of available Orca keyboard



commit b2d07cac876cdab5a5ed1069fa7c5b40d4f5eb2c
Author: Mesar Hameed <mhameed src gnome org>
Date:   Sun May 23 20:29:02 2010 +0100

    Cleaning up of Fix for bgo#616820 - There is no command to speak the list of available Orca keyboard shortcuts.

 src/orca/default.py |   20 ++++----------------
 src/orca/orca.py    |   38 +++++++++++++++++---------------------
 2 files changed, 21 insertions(+), 37 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index baf2b1f..0c3dd56 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -1585,27 +1585,15 @@ class Script(script.Script):
         # shortcuts for the application under focus can be listed by
         # pressing 2. User can press Up/ Down to navigate and hear
         # the list, toggle among the lists pressing 1 or 2,
-        # and exit the "List Shortcuts Mode" by pressing Escape. 
-        # This text here is what is spoken to the user.
-        #
-        speech.speak(_("Entering list shortcuts mode.  Press 1 to list and " \
-          "hear, Orca default shortcuts.  Press 2 to list and hear, Orca " \
-          "shortcuts for the application under focus.  To exit list " \
-          "shortcuts mode, press the escape key."))
-
-        # Translators: Orca has a "List Shortcuts Mode" that allows 
-        # the user to list a group of keyboard shortcuts. The Orca
-        # default shortcuts can be listed by pressing 1, and Orca 
-        # shortcuts for the application under focus can be listed by
-        # pressing 2. User can press Up/ Down to navigate and hear
-        # the list, toggle among the lists pressing 1 or 2,
         # and exit the "List Shortcuts Mode" by pressng Escape. 
         # This text here is what is to be presented on the braille
         # display.
         #
-        self.displayBrailleMessage(_("List shortcuts mode.  Press 1 for " \
+        message = _("List shortcuts mode.  Press 1 for " \
           "Orca default shortcuts.  Press 2 for Orca application " \
-          "shortcuts.  Press escape to exit."))
+          "shortcuts.  Press escape to exit.")
+        speech.speak(message)
+        self.displayBrailleMessage(message, -1, -1) 
         settings.listShortcutsModeEnabled = True
         return True
 
diff --git a/src/orca/orca.py b/src/orca/orca.py
index aa1a89e..23a2a9c 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -79,7 +79,6 @@ else:
 import pyatspi
 import braille
 import debug
-import default
 import httpserver
 import keynames
 import keybindings
@@ -372,8 +371,7 @@ def exitLearnMode(self, inputEvent=None):
     # mode.
     #
     message = _("Exiting learn mode.")
-    speech.speak(message)
-    default.Script.displayBrailleMessage(message, settings.brailleFlashTime)
+    orca_state.activeScript.presentMessage(message)
     settings.learnModeEnabled = False
     return True
 
@@ -397,8 +395,7 @@ def exitListShortcutsMode(self, inputEvent=None):
     # and exit the "List Shortcuts Mode" by pressing Escape.
     #
     message = _("Exiting list shortcuts mode.")
-    speech.speak(message)
-    default.Script.displayBrailleMessage(message, settings.brailleFlashTime)
+    orca_state.activeScript.presentMessage(message)
     return True
 
 ########################################################################
@@ -1294,15 +1291,15 @@ def listShortcuts(event):
             # We inform them how many general Orca shortcuts are available
             # and how to return to normal interaction mode.
             #
-            message = _("%d Orca default shortcuts are listed. Use Up and " \
+            msg1 = _("%d Orca default shortcuts are listed. Use Up and " \
               "Down keys to navigate the list; or press Escape to exit.") % \
               numShortcuts
-            speech.speak(message)
-            default.Script.displayBrailleMessage(message, -1, -1) 
+
             message = orca_state.listOfShortcuts[orca_state.ptrToShortcut][0]+ \
               "\t" + orca_state.listOfShortcuts[orca_state.ptrToShortcut][1]
             speech.speak(message)
-            default.Script.displayBrailleMessage(message, -1, -1)
+            orca_state.activeScript.displayBrailleMessage(message, -1, -1)
+            orca_state.activeScript.presentMessage(msg1)
             consumed = True
         elif (event.event_string == "2"):
             if (numShortcuts==0) or (orca_state.typeOfShortcuts!="orcaAppln"):
@@ -1321,12 +1318,12 @@ def listShortcuts(event):
                   "keys to navigate the list; or press Escape to exit.") % \
                   (numShortcuts, orca_state.activeScript.app.name)
                 speech.speak(message)
-                default.Script.displayBrailleMessage(message, -1, -1)
+                orca_state.activeScript.displayBrailleMessage(message, -1, -1)
                 message = \
                   orca_state.listOfShortcuts[orca_state.ptrToShortcut][0] + \
                   "\t" + orca_state.listOfShortcuts[orca_state.ptrToShortcut][1]
                 speech.speak(message)
-                default.Script.displayBrailleMessage(message, -1, -1)
+                orca_state.activeScript.displayBrailleMessage(message, -1, -1)
             else:
                 # Translators: This message is presented when
                 # the user is in 'list of shortcuts mode'
@@ -1336,7 +1333,7 @@ def listShortcuts(event):
                 message = _("There are no Orca shortcuts, specific to %s") % \
                   (orca_state.activeScript.app.name)
                 speech.speak(message)
-                default.Script.displayBrailleMessage(message, -1, -1)
+                orca_state.activeScript.displayBrailleMessage(message, -1, -1)
             consumed = True
         elif (event.event_string == "Up"):
             if (numShortcuts > 0):
@@ -1351,13 +1348,12 @@ def listShortcuts(event):
                     # informing them that we are cycling round to the bottom.
                     #
                     message = _("Wrapping down to end of list.")
-                    speech.speak(message)
-                    default.Script.displayBrailleMessage(message, -1, -1)
+                    orca_state.activeScript.presentMessage(message)
+
                 message = \
                   orca_state.listOfShortcuts[orca_state.ptrToShortcut][0] + \
                   "\t" + orca_state.listOfShortcuts[orca_state.ptrToShortcut][1]
-                speech.speak(message)
-                default.Script.displayBrailleMessage(message, -1, -1)
+                orca_state.activeScript.displayBrailleMessage(message, -1, -1)
             consumed = True
         elif (event.event_string == "Down"):
             if (numShortcuts > 0): 
@@ -1371,13 +1367,13 @@ def listShortcuts(event):
                     # are informing them that we are cycling round to the top.
                     #
                     message = _("Wrapping up to beginning of list.")
-                    speech.speak(message)
-                    default.Script.displayBrailleMessage(message, -1, -1)
+                    orca_state.activeScript.presentMessage(message)
+
                 message = \
                   orca_state.listOfShortcuts[orca_state.ptrToShortcut][0] + \
                   "\t" + orca_state.listOfShortcuts[orca_state.ptrToShortcut][1]
                 speech.speak(message)
-                default.Script.displayBrailleMessage(message, -1, -1)
+                orca_state.activeScript.displayBrailleMessage(message, -1, -1)
             consumed = True
         elif (event.event_string == "Escape"):
             exitListShortcutsMode(event)
@@ -1394,7 +1390,7 @@ def listShortcuts(event):
               "to list Orca shortcuts for the application under focus. " \
               "To exit list shortcuts mode, press the escape key.")
             speech.speak(message)
-            default.Script.displayBrailleMessage(message, -1, -1)
+            orca_state.activeScript.displayBrailleMessage(message, -1, -1)
             consumed = True
     elif (event.type == pyatspi.KEY_RELEASED_EVENT) and (event.event_string \
       == "Escape"):
@@ -1422,7 +1418,7 @@ def getListOfShortcuts(typeOfShortcuts):
     clickCount = ""
     brlKeyName = ""     
     brlHandler = None
-    defScript = default.Script(None)
+    defScript = orca_state.activeScript.Script(None)
     defKeyBindings = defScript.getKeyBindings()
     defBrlBindings = defScript.getBrailleBindings()
     kbindings = keybindings.KeyBindings()



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