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



Author: richb
Date: Tue Jun  3 19:07:47 2008
New Revision: 3951
URL: http://svn.gnome.org/viewvc/orca?rev=3951&view=rev

Log:
        * src/orca/scripts/apps/Thunderbird/speech_generator.py
          src/orca/scripts/apps/Thunderbird/script.py:
          Fix for bug #535192 - Misspelled word and suggestion not spoken 
          in Thunderbird spell check.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/Thunderbird/script.py
   trunk/src/orca/scripts/apps/Thunderbird/speech_generator.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  3 19:07:47 2008
@@ -104,6 +104,27 @@
             orca.setLocusOfFocus(event, acc)
             consume = True
 
+        # If we get a "focus:" event for the "Replace with:" entry in the
+        # spell checking dialog, then clear the current locus of focus so
+        # that this item will be spoken and brailled. See bug #535192 for
+        # more details.
+        #
+        if event.type.startswith("focus:"):
+            rolesList = [pyatspi.ROLE_ENTRY, \
+                         pyatspi.ROLE_DIALOG, \
+                         pyatspi.ROLE_APPLICATION]
+            if self.isDesiredFocusedItem(obj, rolesList):
+                dialog = obj.parent
+
+                # Translators: this is what the name of the spell checking
+                # dialog in Thunderbird begins with. The translated form
+                # has to match what Thunderbird is using.  We hate keying
+                # off stuff like this, but we're forced to do so in this case.
+                #
+                if dialog.name.startswith(_("Check Spelling")):
+                    orca_state.locusOfFocus = None
+                    orca.setLocusOfFocus(event, obj)
+
         # Handle dialogs.
         #
         if top and top.getRole() == pyatspi.ROLE_DIALOG:
@@ -163,6 +184,38 @@
         #
         return
 
+    def onNameChanged(self, event):
+        """Called whenever a property on an object changes.
+
+        Arguments:
+        - event: the Event
+        """
+
+        obj = event.source
+
+        # If we get a "object:property-change:accessible-name" event for 
+        # the first item in the Suggestions lists for the spell checking
+        # dialog, then speak the first two labels in that dialog. These
+        # will by the "Misspelled word:" label and the currently misspelled
+        # word. See bug #535192 for more details.
+        #
+        rolesList = [pyatspi.ROLE_LIST_ITEM, \
+                     pyatspi.ROLE_LIST, \
+                     pyatspi.ROLE_DIALOG, \
+                     pyatspi.ROLE_APPLICATION]
+        if self.isDesiredFocusedItem(obj, rolesList):
+            dialog = obj.parent.parent
+
+            # Translators: this is what the name of the spell checking 
+            # dialog in Thunderbird begins with. The translated form
+            # has to match what Thunderbird is using.  We hate keying
+            # off stuff like this, but we're forced to do so in this case.
+            #
+            if dialog.name.startswith(_("Check Spelling")):
+                if obj.getIndexInParent() == 0:
+                    speech.speak(self.getDisplayedText(dialog[0]))
+                    speech.speak(self.getDisplayedText(dialog[1]))
+
     def _speakEnclosingPanel(self, obj):
         """Speak the enclosing panel for the object, if it is
         named. Going two containers up the hierarchy appears to be far

Modified: trunk/src/orca/scripts/apps/Thunderbird/speech_generator.py
==============================================================================
--- trunk/src/orca/scripts/apps/Thunderbird/speech_generator.py	(original)
+++ trunk/src/orca/scripts/apps/Thunderbird/speech_generator.py	Tue Jun  3 19:07:47 2008
@@ -26,9 +26,12 @@
 __copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
 __license__   = "LGPL"
 
+import pyatspi
+
 import orca.debug as debug
 import orca.scripts.toolkits.Gecko as Gecko
 
+from orca.orca_i18n import _
 
 ########################################################################
 #                                                                      #
@@ -52,3 +55,39 @@
         """ Convenience method for printing debug messages
         """
         debug.println(self.debugLevel, "Thunderbird.SpeechGenerator: "+msg)
+
+    def _getSpeechForAlert(self, obj, already_focused):
+        """Gets the title of the dialog and the contents of labels inside the
+        dialog that are not associated with any other objects.
+
+        Arguments:
+        - obj: the Accessible dialog
+        - already_focused: False if object just received focus
+
+        Returns a list of utterances be spoken.
+        """
+
+        # If this is the spell checking dialog, then just return the title
+        # of the dialog. See bug #535192 for more details.
+        #
+        rolesList = [pyatspi.ROLE_DIALOG, \
+                     pyatspi.ROLE_APPLICATION]
+        if self._script.isDesiredFocusedItem(obj, rolesList):
+            # Translators: this is what the name of the spell checking
+            # dialog in Thunderbird begins with. The translated form
+            # has to match what Thunderbird is using.  We hate keying
+            # off stuff like this, but we're forced to do so in this case.
+            #
+            if obj.name.startswith(_("Check Spelling")):
+                utterances = []
+                utterances.extend(self._getSpeechForObjectName(obj))
+
+                self._debugGenerator("Thunderbird: _getSpeechForAlert",
+                                     obj,
+                                     already_focused,
+                                     utterances)
+
+                return utterances
+
+        return Gecko.SpeechGenerator._getSpeechForAlert(self, obj,
+                                                        already_focused)



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