[orca] Make Flat Review SayAll binding independent of focus-tracking SayAll binding



commit dba8290a591b5cfa73145eeb002467c8a0332a0f
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun Feb 14 21:25:00 2016 -0500

    Make Flat Review SayAll binding independent of focus-tracking SayAll binding

 src/orca/cmdnames.py            |    8 +++++++
 src/orca/desktop_keyboardmap.py |    5 +++-
 src/orca/laptop_keyboardmap.py  |    5 +++-
 src/orca/scripts/default.py     |   43 ++++++++++++++------------------------
 4 files changed, 32 insertions(+), 29 deletions(-)
---
diff --git a/src/orca/cmdnames.py b/src/orca/cmdnames.py
index 59173d0..45d0be3 100644
--- a/src/orca/cmdnames.py
+++ b/src/orca/cmdnames.py
@@ -58,6 +58,14 @@ RIGHT_CLICK_REVIEW_ITEM = _("Performs right click on current flat review item.")
 # and the cursor will be positioned at the point where the speech was interrupted.
 SAY_ALL = _("Speaks entire document.")
 
+# Translators: the 'flat review' feature of Orca allows the user to explore the
+# text in a window in a 2D fashion. That is, Orca treats all the text from all
+# objects in a window (e.g., buttons, labels, etc.) as a sequence of words in a
+# sequence of lines. The flat review feature allows the user to explore this text
+# by the {previous,next} {line,word,character}. This string is the name of a command
+# which causes Orca to speak the entire contents of the window using flat review.
+SAY_ALL_FLAT_REVIEW = _("Speaks entire window using flat review.")
+
 # Translators: the "Where am I" feature of Orca allows a user to press a key and
 # then have information about their current context spoken and brailled to them.
 # For example, the information may include the name of the current pushbutton
diff --git a/src/orca/desktop_keyboardmap.py b/src/orca/desktop_keyboardmap.py
index 2547843..46536e0 100644
--- a/src/orca/desktop_keyboardmap.py
+++ b/src/orca/desktop_keyboardmap.py
@@ -56,7 +56,10 @@ keymap = (
     "toggleFlatReviewModeHandler"),
 
     ("KP_Add", defaultModifierMask, NO_MODIFIER_MASK,
-    "sayAllHandler"),
+    "sayAllHandler", 1),
+
+    ("KP_Add", defaultModifierMask, NO_MODIFIER_MASK,
+    "flatReviewSayAllHandler", 2),
 
     ("KP_Enter", defaultModifierMask, NO_MODIFIER_MASK,
     "whereAmIBasicHandler", 1),
diff --git a/src/orca/laptop_keyboardmap.py b/src/orca/laptop_keyboardmap.py
index d71e631..fdb3b70 100644
--- a/src/orca/laptop_keyboardmap.py
+++ b/src/orca/laptop_keyboardmap.py
@@ -58,7 +58,10 @@ keymap = (
     "toggleFlatReviewModeHandler"),
 
     ("semicolon", defaultModifierMask, ORCA_MODIFIER_MASK,
-    "sayAllHandler"),
+    "sayAllHandler", 1),
+
+    ("semicolon", defaultModifierMask, ORCA_MODIFIER_MASK,
+    "flatReviewSayAllHandler", 2),
 
     ("Return", defaultModifierMask, ORCA_MODIFIER_MASK,
     "whereAmIBasicHandler", 1),
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 3cf5bff..81e53b1 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -153,6 +153,11 @@ class Script(script.Script):
                 Script.sayAll,
                 cmdnames.SAY_ALL)
 
+        self.inputEventHandlers["flatReviewSayAllHandler"] = \
+            input_event.InputEventHandler(
+                Script.flatReviewSayAll,
+                cmdnames.SAY_ALL_FLAT_REVIEW)
+
         self.inputEventHandlers["whereAmIBasicHandler"] = \
             input_event.InputEventHandler(
                 Script.whereAmIBasic,
@@ -1729,36 +1734,20 @@ class Script(script.Script):
 
         return True
 
-    def sayAll(self, inputEvent, obj=None, offset=None):
-        try:
-            clickCount = inputEvent.getClickCount()
-        except:
-            clickCount = 1
-        doubleClick = clickCount == 2
-
-        if doubleClick:
-            # Try to "say all" for the current dialog/window by flat
-            # reviewing everything. See bug #354462 for more details.
-            #
-            context = self.getFlatReviewContext()
-
-            utterances = []
-            context.goBegin()
-            while True:
-                [wordString, x, y, width, height] = \
-                         context.getCurrent(flat_review.Context.ZONE)
-
-                utterances.append(wordString)
-
-                moved = context.goNext(flat_review.Context.ZONE,
-                                       flat_review.Context.WRAP_LINE)
+    def flatReviewSayAll(self, inputEvent):
+        context = self.getFlatReviewContext()
+        context.goBegin()
 
-                if not moved:
-                    break
+        while True:
+            [wordString, x, y, width, height] = context.getCurrent(flat_review.Context.ZONE)
+            speech.speak(wordString)
+            moved = context.goNext(flat_review.Context.ZONE, flat_review.Context.WRAP_LINE)
+            if not moved:
+                break
 
-            speech.speak(utterances)
-            return
+        return True
 
+    def sayAll(self, inputEvent, obj=None, offset=None):
         obj = obj or orca_state.locusOfFocus
         try:
             text = obj.queryText()


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