[orca] Two SayAll fixes:



commit e992ccff234142b51c2725bcdc2c425c9a6aab4e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jul 8 10:01:55 2014 -0400

    Two SayAll fixes:
    
    1. Use the default script's progress callback in Firefox because the
       Gecko one is buggy.
    2. Don't set the caret at the offset of an embedded object because it
       results in focus changes we do not want to trigger.

 src/orca/scripts/default.py               |   19 ++++++++++-------
 src/orca/scripts/toolkits/Gecko/script.py |   32 -----------------------------
 2 files changed, 11 insertions(+), 40 deletions(-)
---
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 2b5b107..6c1d192 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -3001,19 +3001,22 @@ class Script(script.Script):
         # the visual progress of what is being spoken as well as
         # positioning the cursor when speech has stopped.]]]
         #
-        text = context.obj.queryText()
+        try:
+            text = context.obj.queryText()
+            char = text.getText(context.currentOffset, context.currentOffset+1)
+        except:
+            return
+
+        # Setting the caret at the offset of an embedded object results in
+        # focus changes.
+        if char == self.EMBEDDED_OBJECT_CHARACTER:
+            return
+
         if progressType == speechserver.SayAllContext.PROGRESS:
-            #print "PROGRESS", context.utterance, context.currentOffset
-            #obj = context.obj
-            #[x, y, width, height] = obj.text.getCharacterExtents(
-            #    context.currentOffset, 0)
-            #print context.currentOffset, x, y, width, height
             return
         elif progressType == speechserver.SayAllContext.INTERRUPTED:
-            #print "INTERRUPTED", context.utterance, context.currentOffset
             text.setCaretOffset(context.currentOffset)
         elif progressType == speechserver.SayAllContext.COMPLETED:
-            #print "COMPLETED", context.utterance, context.currentOffset
             orca.setLocusOfFocus(None, context.obj, notifyScript=False)
             text.setCaretOffset(context.currentOffset)
 
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 24fb08b..1786a0c 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -757,38 +757,6 @@ class Script(default.Script):
                     self.findNextLine(obj, characterOffset)
             done = (obj == None)
 
-    def __sayAllProgressCallback(self, context, callbackType):
-        if callbackType == speechserver.SayAllContext.PROGRESS:
-            #print "PROGRESS", context.utterance, context.currentOffset
-            #
-            # Attempt to keep the content visible on the screen as
-            # it is being read, but avoid links as grabFocus sometimes
-            # makes them disappear and sayAll to subsequently stop.
-            #
-            if context.currentOffset == 0 and \
-               context.obj.getRole() in [pyatspi.ROLE_HEADING,
-                                         pyatspi.ROLE_SECTION,
-                                         pyatspi.ROLE_PARAGRAPH] \
-               and context.obj.parent.getRole() != pyatspi.ROLE_LINK:
-                characterCount = context.obj.queryText().characterCount
-                self.setCaretPosition(context.obj, characterCount-1)
-        elif callbackType == speechserver.SayAllContext.INTERRUPTED:
-            #print "INTERRUPTED", context.utterance, context.currentOffset
-            try:
-                self.setCaretPosition(context.obj, context.currentOffset)
-            except:
-                characterCount = context.obj.queryText().characterCount
-                self.setCaretPosition(context.obj, characterCount-1)
-            self.updateBraille(context.obj)
-        elif callbackType == speechserver.SayAllContext.COMPLETED:
-            #print "COMPLETED", context.utterance, context.currentOffset
-            try:
-                self.setCaretPosition(context.obj, context.currentOffset)
-            except:
-                characterCount = context.obj.queryText().characterCount
-                self.setCaretPosition(context.obj, characterCount-1)
-            self.updateBraille(context.obj)
-
     def presentFindResults(self, obj, offset):
         """Updates the caret context to the match indicated by obj and
         offset.  Then presents the results according to the user's


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