orca r3857 - in trunk: . src/orca



Author: richb
Date: Mon Apr 28 20:04:30 2008
New Revision: 3857
URL: http://svn.gnome.org/viewvc/orca?rev=3857&view=rev

Log:
        * src/orca/default.py:
          src/orca/orca.py:
          Fixed bug #528507 - Escape doesn't exit "learn mode" if the 
          active script changes.


Modified:
   trunk/ChangeLog
   trunk/src/orca/default.py
   trunk/src/orca/orca.py

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Mon Apr 28 20:04:30 2008
@@ -691,18 +691,6 @@
                 #
                 _("Enters learn mode.  Press escape to exit learn mode."))
 
-        self.inputEventHandlers["exitLearnModeHandler"] = \
-            input_event.InputEventHandler(
-                Script.exitLearnMode,
-                # Translators: Orca has a "Learn Mode" that will allow
-                # the user to type any key on the keyboard and hear what
-                # the effects of that key would be.  The effects might
-                # be what Orca would do if it had a handler for the
-                # particular key combination, or they might just be to
-                # echo the name of the key if Orca doesn't have a handler.
-                #
-                _("Exits learn mode."))
-
         self.inputEventHandlers["decreaseSpeechRateHandler"] = \
             input_event.InputEventHandler(
                 speech.decreaseSpeechRate,
@@ -1970,10 +1958,6 @@
         - keyboardEvent: an instance of input_event.KeyboardEvent
         """
 
-        if (keyboardEvent.type == pyatspi.KEY_PRESSED_EVENT) and \
-           (keyboardEvent.event_string == "Escape"):
-            settings.learnModeEnabled = False
-
         return script.Script.processKeyboardEvent(self, keyboardEvent)
 
     def __sayAllProgressCallback(self, context, progressType):
@@ -4068,13 +4052,6 @@
         if settings.learnModeEnabled:
             return True
 
-        self.exitLearnModeKeyBinding = keybindings.KeyBinding(
-            "Escape",
-            0,
-            0,
-            self.inputEventHandlers["exitLearnModeHandler"])
-        self.keyBindings.add(self.exitLearnModeKeyBinding)
-
         speech.speak(
             # Translators: Orca has a "Learn Mode" that will allow
             # the user to type any key on the keyboard and hear what
@@ -4100,28 +4077,6 @@
         settings.learnModeEnabled = True
         return True
 
-    def exitLearnMode(self, inputEvent=None):
-        """Turns learn mode off.
-
-        Returns True to indicate the input event has been consumed.
-        """
-
-        self.keyBindings.remove(self.exitLearnModeKeyBinding)
-
-        # Translators: Orca has a "Learn Mode" that will allow
-        # the user to type any key on the keyboard and hear what
-        # the effects of that key would be.  The effects might
-        # be what Orca would do if it had a handler for the
-        # particular key combination, or they might just be to
-        # echo the name of the key if Orca doesn't have a handler.
-        # Exiting learn mode puts the user back in normal operating
-        # mode.
-        #
-        message = _("Exiting learn mode.")
-        speech.speak(message)
-        braille.displayMessage(message)
-        return True
-
     def pursueForFlatReview(self, obj):
         """Determines if we should look any further at the object
         for flat review."""

Modified: trunk/src/orca/orca.py
==============================================================================
--- trunk/src/orca/orca.py	(original)
+++ trunk/src/orca/orca.py	Mon Apr 28 20:04:30 2008
@@ -315,6 +315,27 @@
 
     return True
 
+def exitLearnMode(self, inputEvent=None):
+    """Turns learn mode off.
+
+    Returns True to indicate the input event has been consumed.
+    """
+
+    # Translators: Orca has a "Learn Mode" that will allow
+    # the user to type any key on the keyboard and hear what
+    # the effects of that key would be.  The effects might
+    # be what Orca would do if it had a handler for the
+    # particular key combination, or they might just be to
+    # echo the name of the key if Orca doesn't have a handler.
+    # Exiting learn mode puts the user back in normal operating
+    # mode.
+    #
+    message = _("Exiting learn mode.")
+    speech.speak(message)
+    braille.displayMessage(message)
+    settings.learnModeEnabled = False
+    return True
+
 ########################################################################
 #                                                                      #
 # METHODS FOR PRE-PROCESSING AND MASSAGING KEYBOARD EVENTS.            #
@@ -757,6 +778,10 @@
                         event_string = keyboardEvent.event_string
                         event_string = keynames.getKeyName(event_string)
                         speech.speak(event_string)
+                elif (event.type == pyatspi.KEY_RELEASED_EVENT) and \
+                     (keyboardEvent.event_string == "Escape"):
+                    exitLearnMode(keyboardEvent)
+
                 consumed = True
     except:
         debug.printException(debug.LEVEL_SEVERE)



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