[orca/570658-whereami] Removal of Evo whereAmI



commit 58268710309214b47b6f2b735941728e7ee9f566
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Jun 8 22:53:57 2009 -0400

    Removal of Evo whereAmI
---
 src/orca/scripts/apps/evolution/Makefile.am        |    3 +-
 src/orca/scripts/apps/evolution/script.py          |    7 --
 .../scripts/apps/evolution/speech_generator.py     |   70 +++++++++++++++++
 src/orca/scripts/apps/evolution/where_am_i.py      |   81 --------------------
 4 files changed, 71 insertions(+), 90 deletions(-)

diff --git a/src/orca/scripts/apps/evolution/Makefile.am b/src/orca/scripts/apps/evolution/Makefile.am
index 1ca5519..ef31b58 100644
--- a/src/orca/scripts/apps/evolution/Makefile.am
+++ b/src/orca/scripts/apps/evolution/Makefile.am
@@ -4,8 +4,7 @@ orca_python_PYTHON = \
     __init__.py \
     formatting.py \
     script.py \
-    speech_generator.py \
-    where_am_i.py
+    speech_generator.py
 
 orca_pythondir=$(pyexecdir)/orca/scripts/apps/evolution
 
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 9b77cd2..abd6fb5 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -41,7 +41,6 @@ import orca.settings as settings
 
 from orca.orca_i18n import _ # for gettext support
 
-from where_am_i import WhereAmI
 from speech_generator import SpeechGenerator
 from formatting import Formatting
 ########################################################################
@@ -140,12 +139,6 @@ class Script(default.Script):
 
         return SpeechGenerator(self)
 
-    def getWhereAmI(self):
-        """Returns the "where am I" class for this script.
-        """
-
-        return WhereAmI(self)
-
     def getFormatting(self):
         """Returns the formatting strings for this script."""
         return Formatting(self)
diff --git a/src/orca/scripts/apps/evolution/speech_generator.py b/src/orca/scripts/apps/evolution/speech_generator.py
index fce1b07..6cf61b8 100644
--- a/src/orca/scripts/apps/evolution/speech_generator.py
+++ b/src/orca/scripts/apps/evolution/speech_generator.py
@@ -29,6 +29,8 @@ import pyatspi
 
 import orca.speech_generator as speech_generator
 
+from orca.orca_i18n import _ # for gettext support
+
 class SpeechGenerator(speech_generator.SpeechGenerator):
     """Overrides _generateSpeechForTableCell so that, if this is an
        expanded table cell, we can strip off the "0 items".
@@ -59,3 +61,71 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
                     return result
         return speech_generator.SpeechGenerator._generateRealTableCell(
             self, obj, **args)
+
+    def _generateTableCellRow(self, obj, **args):
+        """Orca has a feature to automatically read an entire row of a table
+        as the user arrows up/down the roles.  This leads to complexity in
+        the code.  This method is used to return an array of strings
+        (and possibly voice and audio specifications) for an entire row
+        in a table if that's what the user has requested and if the row
+        has changed.  Otherwise, it will return an array for just the
+        current cell.
+        """
+        # The only time we want to override things is if we're doing
+        # a detailed whereAmI. In that case, we want to minimize the
+        # chattiness associated with presenting the full row of the
+        # message list.
+        #
+        if args.get('formatType', 'unfocused') != 'detailedWhereAmI':
+            return speech_generator.SpeechGenerator.\
+                _generateTableCellRow(self, obj, **args)
+
+        # [[[TODO - JD: Maybe we can do something clever with a
+        # formatting string to address the headers associated with
+        # toggle columns. That's really the difference here.]]]
+        #
+        result = []
+        try:
+            parentTable = obj.parent.queryTable()
+        except NotImplementedError:
+            parentTable = None
+        if parentTable and parentTable.nColumns > 1 \
+           and not self._script.isLayoutOnly(obj.parent):
+            for i in range(0, parentTable.nColumns):
+                index = self._script.getCellIndex(obj)
+                row = parentTable.getRowAtIndex(index)
+                cell = parentTable.getAccessibleAt(row, i)
+                if not cell:
+                    continue
+                state = cell.getState()
+                if state.contains(pyatspi.STATE_SHOWING):
+                    # Don't speak check box cells that area not checked.
+                    #
+                    notChecked = False
+                    try:
+                        action = cell.queryAction()
+                    except NotImplementedError:
+                        action = None
+                    if action:
+                        for i in range(0, action.nActions):
+                            # Translators: this is the action name for
+                            # the 'toggle' action. It must be the same
+                            # string used in the *.po file for gail.
+                            #
+                            if action.getName(i) in ["toggle", _("toggle")]:
+                                if not state.contains(pyatspi.STATE_CHECKED):
+                                    notChecked = True
+                                break
+                    if notChecked:
+                        continue
+
+                    descendant = self._script.getRealActiveDescendant(cell)
+                    text = self._script.getDisplayedText(descendant)
+                    if text == "Status":
+                        # Translators: this in reference to an e-mail message
+                        # status of having been read or unread.
+                        #
+                        text = _("Read")
+                    result.append(text)
+
+        return result
diff --git a/src/orca/scripts/apps/evolution/where_am_i.py b/src/orca/scripts/apps/evolution/where_am_i.py
deleted file mode 100644
index 85a67f3..0000000
--- a/src/orca/scripts/apps/evolution/where_am_i.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Orca
-#
-# Copyright 2005-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 script for Evolution."""
-
-__id__        = "$Id$"
-__version__   = "$Revision$"
-__date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
-__license__   = "LGPL"
-
-import pyatspi
-
-import orca.debug as debug
-import orca.where_am_I as where_am_I
-
-from orca.orca_i18n import _ # for gettext support
-
-class WhereAmI(where_am_I.WhereAmI):
-
-    def __init__(self, script):
-        """Create a new WhereAmI that will be used to speak information
-        about the current object of interest.
-        """
-
-        where_am_I.WhereAmI.__init__(self, script)
-
-    def _getTableCell(self, obj):
-        """Get the speech utterances for a single table cell.
-        """
-
-        # Don't speak check box cells that area not checked.
-        notChecked = False
-        try:
-            action = obj.queryAction()
-        except NotImplementedError:
-            action = None
-
-        if action:
-            for i in range(0, action.nActions):
-                # Translators: this is the action name for
-                # the 'toggle' action. It must be the same
-                # string used in the *.po file for gail.
-                #
-                if action.getName(i) in ["toggle", _("toggle")]:
-                    if not obj.getState().contains(pyatspi.STATE_CHECKED):
-                        notChecked = True
-                    break
-
-        if notChecked:
-            return ""
-
-        descendant = self._script.getRealActiveDescendant(obj)
-        text = self._script.getDisplayedText(descendant)
-
-        # For Evolution mail header list.
-        if text == "Status":
-            # Translators: this in reference to an e-mail message status of
-            # having been read or unread.
-            #
-            text = _("Read")
-
-        debug.println(self._debugLevel, "cell=<%s>" % text)
-
-        return text



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