[orca/570658] Revert "updated evolution script, speech_generator, added in formatting.py."



commit c991e5ae935ba4a5491f1c926210fc72430f525b
Author: Mesar Hameed <mhameed src gnome org>
Date:   Thu May 14 20:42:02 2009 +0100

    Revert "updated evolution script, speech_generator, added in formatting.py."
    
    This reverts commit ff17d888f02c28eb47b0c5c34e085d64015367e3.
---
 src/orca/scripts/apps/evolution/Makefile.am        |    9 ++--
 src/orca/scripts/apps/evolution/formatting.py      |   58 --------------------
 src/orca/scripts/apps/evolution/script.py          |    5 --
 .../scripts/apps/evolution/speech_generator.py     |   25 +++++++--
 4 files changed, 25 insertions(+), 72 deletions(-)

diff --git a/src/orca/scripts/apps/evolution/Makefile.am b/src/orca/scripts/apps/evolution/Makefile.am
old mode 100755
new mode 100644
index 1ca5519..9a00a0b
--- a/src/orca/scripts/apps/evolution/Makefile.am
+++ b/src/orca/scripts/apps/evolution/Makefile.am
@@ -1,11 +1,10 @@
 orca_pathdir=$(pyexecdir)
 
 orca_python_PYTHON = \
-    __init__.py \
-    formatting.py \
-    script.py \
-    speech_generator.py \
-    where_am_i.py
+	__init__.py \
+	script.py \
+	speech_generator.py \
+	where_am_i.py
 
 orca_pythondir=$(pyexecdir)/orca/scripts/apps/evolution
 
diff --git a/src/orca/scripts/apps/evolution/formatting.py b/src/orca/scripts/apps/evolution/formatting.py
deleted file mode 100755
index 40a6d95..0000000
--- a/src/orca/scripts/apps/evolution/formatting.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Orca
-#
-# Copyright 2006-2008 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
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
-# Boston MA  02110-1301 USA.
-
-"""Custom formatting for evolution."""
-
-__id__ = "$Id$"
-__version__   = "$Revision$"
-__date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
-__license__   = "LGPL"
-
-import pyatspi
-
-import orca.formatting as defaultFormatting
-
-scriptFormatting = {
-    'speech': {
-        'REAL_ROLE_TABLE_CELL': {
-            # the real cell information
-            # note that pyatspi.ROLE_TABLE_CELL is used to work out if we need to
-            # read a whole row. It calls REAL_ROLE_TABLE_CELL internally.
-            #
-            'focused': '(isDesiredFocusedItem and ' \
-            '(tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and (expandableState )) + required)' \
-            ' or ((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and (expandableState + numberOfChildren)) + required)',
-            'unfocused': '(isDesiredFocusedItem ' \
-            ' and ' \
-              '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription ' \
-              ' + image) +   (expandableState and (expandableState + numberOfChildren)) + required)' \
-            ') or ' \
-              '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription ' \
-              ' + image) +   (expandableState and (expandableState + numberOfChildren)) + required)'
-            },
-    }
-}
-
-class Formatting(defaultFormatting.Formatting):
-
-    def __init__(self, script):
-        defaultFormatting.Formatting.__init__(self, script)
-        self.update(scriptFormatting)
-
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
old mode 100755
new mode 100644
index abada76..5f626fe
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -43,7 +43,6 @@ from orca.orca_i18n import _ # for gettext support
 
 from where_am_i import WhereAmI
 from speech_generator import SpeechGenerator
-from formatting import Formatting
 ########################################################################
 #                                                                      #
 # The Evolution script class.                                          #
@@ -146,10 +145,6 @@ class Script(default.Script):
 
         return WhereAmI(self)
 
-    def getFormatting(self):
-        """Returns the formatting strings for this script."""
-        return Formatting(self)
-
     def setupInputEventHandlers(self):
         """Defines InputEventHandler fields for this script that can be
         called by the key and braille bindings. In this particular case,
diff --git a/src/orca/scripts/apps/evolution/speech_generator.py b/src/orca/scripts/apps/evolution/speech_generator.py
old mode 100755
new mode 100644
index 026a68b..aa0bbb1
--- a/src/orca/scripts/apps/evolution/speech_generator.py
+++ b/src/orca/scripts/apps/evolution/speech_generator.py
@@ -37,7 +37,19 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
     def __init__(self, script):
         speechgenerator.SpeechGenerator.__init__(self, script)
 
-    def _getIsDesiredFocusedItem(self, obj, already_focused):
+    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 
@@ -47,6 +59,11 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
                      pyatspi.ROLE_TREE_TABLE, \
                      pyatspi.ROLE_UNKNOWN]
         if self._script.isDesiredFocusedItem(obj, rolesList):
-            return True
-        else:
-            return False
+            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



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