[orca] Fix for bgo#480883 - Braille navigation on Webpages



commit d358836f06917f60378b58e1fbda09da85dcd039
Author: Willie Walker <william walker sun com>
Date:   Mon Jul 27 09:48:20 2009 -0400

    Fix for bgo#480883 - Braille navigation on Webpages
    
    This addresses the issue in the, but with one slight issue where the
    user can pan right indefinitely on the last line in the content.

 src/orca/scripts/toolkits/Gecko/script.py |   71 +++++++++++++++++++++++++++-
 1 files changed, 68 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 2daed96..5f9c7c9 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -529,6 +529,36 @@ class Script(default.Script):
                 #
                 _("Speaks entire document."))
 
+        self.inputEventHandlers["panBrailleLeftHandler"] = \
+            input_event.InputEventHandler(
+                Script.panBrailleLeft,
+                # 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).  Orca
+                # provides the feature to build up a longer logical
+                # line and allow the user to press buttons on the
+                # braille display so they can pan left and right over
+                # this line.
+                #
+                _("Pans the braille display to the left."),
+                False) # Do not enable learn mode for this action
+
+        self.inputEventHandlers["panBrailleRightHandler"] = \
+            input_event.InputEventHandler(
+                Script.panBrailleRight,
+                # 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).  Orca
+                # provides the feature to build up a longer logical
+                # line and allow the user to press buttons on the
+                # braille display so they can pan left and right over
+                # this line.
+                #
+                _("Pans the braille display to the right."),
+                False) # Do not enable learn mode for this action
+
         self.inputEventHandlers["moveToMouseOverHandler"] = \
             input_event.InputEventHandler(
                 Script.moveToMouseOver,
@@ -2250,7 +2280,8 @@ class Script(default.Script):
         if index < 0:
             self.currentLineContents = self.getLineContentsAtOffset(obj,
                                                                     offset)
-        self.speakContents(self.currentLineContents)
+        if not isinstance(orca_state.lastInputEvent, input_event.BrailleEvent):
+            self.speakContents(self.currentLineContents)
         self.updateBraille(obj)
 
     def updateBraille(self, obj, extraRegion=None):
@@ -2561,6 +2592,38 @@ class Script(default.Script):
 
         self.speakContents(self.getLineContentsAtOffset(obj, characterOffset))
 
+    def panBrailleLeft(self, inputEvent=None, panAmount=0):
+        """In document content, we want to use the panning keys to browse the
+        entire document.
+        """
+        if self.flatReviewContext \
+           or self.isAriaWidget(orca_state.locusOfFocus) \
+           or not self.inDocumentContent() \
+           or not braille.beginningIsShowing:
+            default.Script.panBrailleLeft(self, inputEvent, panAmount)
+        else:
+            self.goPreviousLine(inputEvent)
+            while braille.panRight():
+                pass
+            braille.refresh(False)
+        return True
+
+    def panBrailleRight(self, inputEvent=None, panAmount=0):
+        """In document content, we want to use the panning keys to browse the
+        entire document.
+        """
+        if self.flatReviewContext \
+           or self.isAriaWidget(orca_state.locusOfFocus) \
+           or not self.inDocumentContent() \
+           or not braille.endIsShowing:
+            default.Script.panBrailleRight(self, inputEvent, panAmount)
+        else:
+            self.goNextLine(inputEvent)
+            while braille.panLeft():
+                pass
+            braille.refresh(False)
+        return True
+
     ####################################################################
     #                                                                  #
     # Methods for debugging.                                           #
@@ -6281,7 +6344,8 @@ class Script(default.Script):
                or self.getLineContentsAtOffset(obj, characterOffset)
         obj, characterOffset = line[0][0], line[0][1]
         self.setCaretPosition(obj, characterOffset)
-        self.speakCharacterAtOffset(obj, characterOffset)
+        if not isinstance(orca_state.lastInputEvent, input_event.BrailleEvent):
+            self.speakCharacterAtOffset(obj, characterOffset)
         self.updateBraille(obj)
 
     def goEndOfLine(self, inputEvent):
@@ -6292,7 +6356,8 @@ class Script(default.Script):
                or self.getLineContentsAtOffset(obj, characterOffset)
         obj, characterOffset = line[-1][0], line[-1][2] - 1
         self.setCaretPosition(obj, characterOffset)
-        self.speakCharacterAtOffset(obj, characterOffset)
+        if not isinstance(orca_state.lastInputEvent, input_event.BrailleEvent):
+            self.speakCharacterAtOffset(obj, characterOffset)
         self.updateBraille(obj)
 
     def goTopOfFile(self, inputEvent):



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