orca r3467 - in trunk: . src/orca/scripts



Author: richb
Date: Wed Jan 16 16:00:57 2008
New Revision: 3467
URL: http://svn.gnome.org/viewvc/orca?rev=3467&view=rev

Log:
        * src/orca/scripts/Evolution.py:
          Work on fix for bug #432308 - Problem with Evolution and threads 
          always speaking "expanded 0 items". Adding in code to no longer
          speak the "0 items" if this is a table cell in the mail message 
          header list with an expanded state.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/Evolution.py

Modified: trunk/src/orca/scripts/Evolution.py
==============================================================================
--- trunk/src/orca/scripts/Evolution.py	(original)
+++ trunk/src/orca/scripts/Evolution.py	Wed Jan 16 16:00:57 2008
@@ -36,6 +36,7 @@
 import orca.orca as orca
 import orca.orca_state as orca_state
 import orca.speech as speech
+import orca.speechgenerator as speechgenerator
 import orca.speechserver as speechserver
 import orca.settings as settings
 import orca.chnames as chnames
@@ -232,6 +233,45 @@
 
         return [textContents, startOffset, endOffset]
 
+class SpeechGenerator(speechgenerator.SpeechGenerator):
+    """Overrides _getSpeechForTableCell so that, if this is an expanded 
+       table cell,  we can strip off the "0 items".
+    """
+
+    def __init__(self, script):
+        speechgenerator.SpeechGenerator.__init__(self, script)
+
+    def _getSpeechForTableCell(self, obj, already_focused):
+        """Get the speech utterances for a single table cell
+
+        Arguments:
+        - obj: the table
+        - already_focused: False if object just received focus
+
+        Returns a list of utterances to be spoken for the object.
+        """
+
+        utterances = speechgenerator.SpeechGenerator.\
+                      _getSpeechForTableCell(self, obj, already_focused)
+
+        # Check that we are in a table cell in the mail message header list.
+        # If we are and this table cell has an expanded state, and the first
+        # token of the last utterances is "0", then strip off that last 
+        # utterance ("0 items"). See bug #432308 for more details.
+        #
+        self.rolesList = [pyatspi.ROLE_TABLE_CELL, \
+                          pyatspi.ROLE_TREE_TABLE, \
+                          pyatspi.ROLE_UNKNOWN]
+        if self._script.isDesiredFocusedItem(obj, self.rolesList):
+            state = obj.getState()
+            if state and state.contains(pyatspi.STATE_EXPANDABLE):
+                if state.contains(pyatspi.STATE_EXPANDED):
+                    tokens = utterances[-1].split()
+                    if tokens[0] == "0":
+                        utterances = utterances[0:-1]
+
+        return utterances
+
 ########################################################################
 #                                                                      #
 # The Evolution script class.                                          #
@@ -319,6 +359,12 @@
             #
             _("calendar event"))
 
+    def getSpeechGenerator(self):
+        """Returns the speech generator for this script.
+        """
+
+        return SpeechGenerator(self)
+
     def getWhereAmI(self):
         """Returns the "where am I" class for this script.
         """



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