[orca/570658] Port Thunderbird speech generator to new speech generator



commit b040423f9efb2c83afa505ef0a0684dc2cb0d893
Author: Willie Walker <william walker sun com>
Date:   Fri May 22 18:35:20 2009 -0400

    Port Thunderbird speech generator to new speech generator
---
 src/orca/scripts/apps/Thunderbird/script.py        |    2 +-
 .../scripts/apps/Thunderbird/speech_generator.py   |   67 +++++++-------------
 2 files changed, 23 insertions(+), 46 deletions(-)

diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index dcf90e1..dc76e4c 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -23,7 +23,7 @@
 __id__        = "$Id$"
 __version__   = "$Revision$"
 __date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
+__copyright__ = "Copyright (c) 2004-2008 Sun Microsystems Inc."
 __license__   = "LGPL"
 
 import gtk
diff --git a/src/orca/scripts/apps/Thunderbird/speech_generator.py b/src/orca/scripts/apps/Thunderbird/speech_generator.py
index cf1e5f0..8ad4cd6 100644
--- a/src/orca/scripts/apps/Thunderbird/speech_generator.py
+++ b/src/orca/scripts/apps/Thunderbird/speech_generator.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2004-2008 Sun Microsystems Inc.
+# Copyright 2004-2009 Sun Microsystems Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -23,12 +23,11 @@
 __id__        = "$Id$"
 __version__   = "$Revision$"
 __date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
+__copyright__ = "Copyright (c) 2004-2009 Sun Microsystems Inc."
 __license__   = "LGPL"
 
 import pyatspi
 
-import orca.debug as debug
 import orca.scripts.toolkits.Gecko as Gecko
 
 from orca.orca_i18n import _
@@ -43,51 +42,29 @@ class SpeechGenerator(Gecko.SpeechGenerator):
     """Provides a speech generator specific to Thunderbird.
     """
 
-    def __init__(self, script):
-        # Set the debug level for all the methods in this script.
-        #
-        self.debugLevel = debug.LEVEL_FINEST
+    # pylint: disable-msg=W0142
 
-        self._debug("__init__")
+    def __init__(self, script):
         Gecko.SpeechGenerator.__init__(self, script)
 
-    def _debug(self, msg):
-        """ 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.
+    def _getUnrelatedLabels(self, obj, **args):
+        """Finds all labels not in a label for or labelled by relation.
+        If this is the spell checking dialog, then there are no
+        unrelated labels.  See bug #535192 for more details.
         """
+        result = []
 
-        # If this is the spell checking dialog, then just return the title
-        # of the dialog. See bug #535192 for more details.
+        # 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.
         #
-        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)
+        if obj.name.startswith(_("Check Spelling")) \
+           and self._script.isDesiredFocusedItem(
+                   obj, [pyatspi.ROLE_DIALOG,
+                         pyatspi.ROLE_APPLICATION]):
+            pass
+        else:
+            result.extend(Gecko.SpeechGenerator._getUnrelatedLabels(
+                              self, obj, **args))
+        return result



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