orca r4207 - branches/phase2/src/orca



Author: wwalker
Date: Sat Sep 13 19:01:58 2008
New Revision: 4207
URL: http://svn.gnome.org/viewvc/orca?rev=4207&view=rev

Log:
Get braille input working.


Modified:
   branches/phase2/src/orca/default.py
   branches/phase2/src/orca/input_bindings.py
   branches/phase2/src/orca/input_event.py
   branches/phase2/src/orca/script.py

Modified: branches/phase2/src/orca/default.py
==============================================================================
--- branches/phase2/src/orca/default.py	(original)
+++ branches/phase2/src/orca/default.py	Sat Sep 13 19:01:58 2008
@@ -533,6 +533,20 @@
                 #
                 _("Reports information on current script.")),
 
+            "brailleCursorKeyHandler" : input_bindings.Handler(
+                Script._processBrailleCursorKey,
+                # Translators: a refreshable braille display is an
+                # external hardware device that presents braille
+                # character to the user.  There are a limited number
+                # of cells on the display (typically 40 cells).  
+                # There is typically a small button called a 'cursor
+                # routing key' over each cell.  The typical use is
+                # to move the text caret to the given spot when one
+                # presses the button.
+                #
+                _("Handles presses of braille cursor routing keys."),
+                False), # Do not enable learn mode for this action
+
             "panBrailleLeftHandler" : input_bindings.Handler(
                 Script._panBrailleLeft,
                 # Translators: a refreshable braille display is an
@@ -1115,6 +1129,11 @@
         """
         log.debug("_reportScriptInfo: %s" % inputEvent)
 
+    def _processBrailleCursorKey(self, inputEvent=None, modifiers=None):
+        """The brailleCursorKeyHandler handler.
+        """
+        log.debug("_processBrailleCursorKey: %s" % inputEvent)
+
     def _panBrailleLeft(self, inputEvent=None, modifiers=None):
         """The panBrailleLeft handler.
         """

Modified: branches/phase2/src/orca/input_bindings.py
==============================================================================
--- branches/phase2/src/orca/input_bindings.py	(original)
+++ branches/phase2/src/orca/input_bindings.py	Sat Sep 13 19:01:58 2008
@@ -486,7 +486,7 @@
             self,
             script,
             brailleEvent,
-            brailleEvent["command"],
+            brailleEvent.command,
             modifiers,
             True)
 

Modified: branches/phase2/src/orca/input_event.py
==============================================================================
--- branches/phase2/src/orca/input_event.py	(original)
+++ branches/phase2/src/orca/input_event.py	Sat Sep 13 19:01:58 2008
@@ -192,6 +192,10 @@
         """
         InputEvent.__init__(self)
         self.event = event
+        self.command = event["command"]
+        self.type = event["type"]
+        self.argument = event["argument"]
+        self.flags = event["flags"]
 
     def __str__(self):
         return "braille event %s" % self.event

Modified: branches/phase2/src/orca/script.py
==============================================================================
--- branches/phase2/src/orca/script.py	(original)
+++ branches/phase2/src/orca/script.py	Sat Sep 13 19:01:58 2008
@@ -200,8 +200,8 @@
         consumes = False
         if not consumes:
             handler = self._brailleBindings.getHandler(
-                brailleEvent["command"],
-                None, # TODO: add current keyboard modifiers
+                brailleEvent.command,
+                0, # TODO: add current keyboard modifiers
                 self.getClickCount())
             consumes = handler != None
         return consumes
@@ -224,7 +224,7 @@
         self._brailleBindings.processInputEvent(
             self,
             brailleEvent,
-            None) # TODO: add current keyboard modifiers
+            0) # TODO: add current keyboard modifiers
 
     def processObjectEvent(self, event):
         """Processes all AT-SPI object events of interest to this
@@ -264,35 +264,37 @@
         if self._isActive:
             return
 
-        log.debug("%s has been activated" % self)
+        log.debug("activating %s..." % self)
 
         for eventType in self._objectEventListeners.keys():
             utils.registerEventListener(eventType)
 
-        # TODO: Tell BrlTTY which commands we care about by looking at
-        # self._brailleBindings
-        #
-        braille.setupKeyRanges([])
+        keys = []
+        for binding in self._brailleBindings:
+            keys.append(binding.command)
+        braille.setupKeyRanges(keys)
 
         self._isActive = True
 
+        log.debug("...%s has been activated" % self)
+
     def deactivate(self):
         """Called when this script is deactivated.
         """
         if not self._isActive:
             return
 
-        log.debug("%s has been deactivated" % self)
+        log.debug("deactivating %s..." % self)
 
         for eventType in self._objectEventListeners.keys():
             utils.deregisterEventListener(eventType)
 
-        # Tell BrlTTY which commands we don't care about events any more.
-        #
         braille.setupKeyRanges([])
 
         self._isActive = False
 
+        log.debug("...%s has been deactivated" % self)
+
 if __name__ == "__main__":
     logging.basicConfig(format="%(name)s %(message)s")
     log.setLevel(logging.DEBUG)



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