orca r3999 - in trunk: . src/orca/scripts/apps/Thunderbird



Author: joanied
Date: Tue Jun 24 02:34:45 2008
New Revision: 3999
URL: http://svn.gnome.org/viewvc/orca?rev=3999&view=rev

Log:
* src/orca/scripts/apps/Thunderbird/script.py:
  Fix for bug #533042 - Orca should be less verbose when reading
  autocompletes in Thunderbird.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/Thunderbird/script.py

Modified: trunk/src/orca/scripts/apps/Thunderbird/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/Thunderbird/script.py	(original)
+++ trunk/src/orca/scripts/apps/Thunderbird/script.py	Tue Jun 24 02:34:45 2008
@@ -60,6 +60,11 @@
         # Set the debug level for all the methods in this script.
         self.debugLevel = debug.LEVEL_FINEST
 
+        # Store the last autocompleted string for the address fields
+        # so that we're not too 'chatty'.  See bug #533042.
+        #
+        self._lastAutoComplete = ""
+
         Gecko.Script.__init__(self, app)
 
         # This will be used to cache a handle to the Thunderbird text area for
@@ -119,6 +124,10 @@
         top = self.getTopLevel(obj)
         consume = False
 
+        # Clear the stored autocomplete string.
+        #
+        self._lastAutoComplete = ""
+
         # Don't speak chrome URLs.
         #
         if obj.name.startswith("chrome://"):
@@ -237,18 +246,21 @@
         obj = event.source
         parent = obj.parent
 
+        # Speak the autocompleted text, but only if it is different
+        # address so that we're not too "chatty." See bug #533042.
+        #
         if parent.getRole() == pyatspi.ROLE_AUTOCOMPLETE:
-            # Thunderbird does not present all the text in an
-            # autocompletion text entry. This is a workaround.
-            #
-            speech.stop()
-
-            utterances = []
-            [text, caretOffset, startOffset] = self.getTextLineAtCaret(obj)
-            utterances.append(text)
-            self._debug("onTextInserted: utterances='%s'" % utterances)
-
-            speech.speakUtterances(utterances)
+            if event.type.endswith("system") and event.any_data:
+                # The autocompleted address may start with the name,
+                # or it might start with the text typed by the user
+                # followed by ">>" followed by the address. Therefore
+                # we'll look at whatever follows the ">>" should it
+                # exist.
+                #
+                address = event.any_data.split(">>")[-1]
+                if self._lastAutoComplete != address:
+                    speech.speak(address)
+                self._lastAutoComplete = address
         else:
             Gecko.Script.onTextInserted(self, event)
 



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