[orca] Fix for bgo#620205 - Orca doesn't speak changes in bullets and numbers resulting from Tab, Shift+Tab



commit d779e586d0d1cc275ec8e463c982f9cff957ef81
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Tue Jun 1 00:02:11 2010 -0400

    Fix for bgo#620205 - Orca doesn't speak changes in bullets and numbers resulting from Tab, Shift+Tab, or BackSpace being pressed

 src/orca/default.py                               |    4 ++
 src/orca/script_utilities.py                      |   10 ++++++
 src/orca/scripts/apps/soffice/script.py           |   11 +------
 src/orca/scripts/apps/soffice/script_utilities.py |   32 +++++++++++++++++++++
 4 files changed, 48 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index b1fe627..c7e8267 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -3430,6 +3430,10 @@ class Script(script.Script):
                 string = "*"
                 speakThis = True
 
+        # Auto-completed, auto-corrected, auto-inserted, etc.
+        #
+        speakThis = speakThis or self.utilities.isAutoTextEvent(event)
+
         # We might need to echo this if it is a single character.
         #
         speakThis = speakThis \
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index c687072..191993e 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2489,6 +2489,16 @@ class Utilities:
         else:
             return newText
 
+    def isAutoTextEvent(self, event):
+        """Returns True if event is associated with text being autocompleted
+        or autoinserted or autocorrected or autosomethingelsed.
+
+        Arguments:
+        - event: the accessible event being examined
+        """
+
+        return False
+
     def isSentenceDelimiter(self, currentChar, previousChar):
         """Returns True if we are positioned at the end of a sentence.
         This is determined by checking if the current character is a
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 4f1ce2d..5b7c366 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -1730,15 +1730,8 @@ class Script(default.Script):
         # spoken. So we'll speak them before sending this event off to the
         # default script.
         #
-        lastKey, mods = self.utilities.lastKeyAndModifiers()
-        if lastKey == "Return" \
-           and event.source.getRole() == pyatspi.ROLE_PARAGRAPH:
-            try:
-                charCount = event.source.queryText().characterCount
-            except:
-                charCount = 0
-            if charCount:
-                speech.speak(self.speechGenerator.generateSpeech(event.source))
+        if self.utilities.isAutoTextEvent(event):
+            speech.speak(self.speechGenerator.generateSpeech(event.source))
 
         default.Script.onFocus(self, event)
 
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py b/src/orca/scripts/apps/soffice/script_utilities.py
index 3b873be..257d572 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -407,3 +407,35 @@ class Utilities(script_utilities.Utilities):
     # Miscellaneous Utilities                                               #
     #                                                                       #
     #########################################################################
+
+    def isAutoTextEvent(self, event):
+        """Returns True if event is associated with text being autocompleted
+        or autoinserted or autocorrected or autosomethingelsed.
+
+        Arguments:
+        - event: the accessible event being examined
+        """
+
+        if event.source.getRole() != pyatspi.ROLE_PARAGRAPH:
+            return False
+
+        lastKey, mods = self.lastKeyAndModifiers()
+        if event.type.startswith("object:text-changed:insert"):
+            if not event.any_data:
+                return False
+
+            if lastKey == "Tab" and event.any_data != "\t":
+                return True
+
+            if lastKey in ["BackSpace", "ISO_Left_Tab"]:
+                return True
+
+        if event.type.startswith("focus:"):
+            if lastKey == "Return":
+                try:
+                    charCount = event.source.queryText().characterCount
+                except:
+                    charCount = 0
+                return charCount > 0
+
+        return False



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