[orca/570658] Simplified evolution formatting and speech_generator.
- From: Mesar Hameed <mhameed src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Simplified evolution formatting and speech_generator.
- Date: Sun, 17 May 2009 14:51:47 -0400 (EDT)
commit 651a3f981dc718a51ef44dcdd4b547663b2c345f
Author: Mesar Hameed <mhameed src gnome org>
Date: Sun May 17 19:51:31 2009 +0100
Simplified evolution formatting and speech_generator.
---
src/orca/scripts/apps/evolution/formatting.py | 11 +----
.../scripts/apps/evolution/speech_generator.py | 42 +++++++++++++-------
2 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/src/orca/scripts/apps/evolution/formatting.py b/src/orca/scripts/apps/evolution/formatting.py
index 8b179e4..5957c09 100644
--- a/src/orca/scripts/apps/evolution/formatting.py
+++ b/src/orca/scripts/apps/evolution/formatting.py
@@ -29,20 +29,15 @@ __license__ = "LGPL"
import orca.formatting
-unfocusedWithCount = '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and (expandableState + numberOfChildren)) + required)'
-unfocusedWithoutCount = '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and expandableState ) + required)'
-focusedWithCount = '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and (expandableState + numberOfChildren)) + required)'
-focusedWithoutCount = '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and expandableState ) + required)'
-
formatting = {
'speech': {
- 'REAL_ROLE_TABLE_CELL': {
+ 'ALTERNATIVE_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 ' + focusedWithoutCount + ') or ' + focusedWithCount,
- 'unfocused': '(isDesiredFocusedItem and (' + unfocusedWithoutCount + ' ) or ' + unfocusedWithCount
+ 'focused': '(tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and expandableState ) + required',
+ 'unfocused': '(tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState + (realActiveDescendantDisplayedText or imageDescription + image) + (expandableState and expandableState ) + required',
},
}
}
diff --git a/src/orca/scripts/apps/evolution/speech_generator.py b/src/orca/scripts/apps/evolution/speech_generator.py
old mode 100644
new mode 100755
index e5cf696..a59ab38
--- a/src/orca/scripts/apps/evolution/speech_generator.py
+++ b/src/orca/scripts/apps/evolution/speech_generator.py
@@ -29,6 +29,18 @@ import pyatspi
import orca.speechgenerator as speechgenerator
+
+def _overrideRole(newRole, args):
+ oldRole = args.get('role', None)
+ args['role'] = newRole
+ return oldRole
+
+def _restoreRole(oldRole, args):
+ if oldRole:
+ args['role'] = oldRole
+ else:
+ del args['role']
+
class SpeechGenerator(speechgenerator.SpeechGenerator):
"""Overrides _getSpeechForTableCell so that, if this is an expanded
table cell, we can strip off the "0 items".
@@ -37,24 +49,24 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
def __init__(self, script):
speechgenerator.SpeechGenerator.__init__(self, script)
- def _getIsDesiredFocusedItem(self, obj, **args):
- """Helps us to get the speech utterances for a single table cell
-
- Arguments:
- - obj: the table
-
- Returns a boolean to state if the given object is in DesiredFocusedItem
- """
-
+ def _getRealTableCell(self, obj, **args):
+ # pylint: disable-msg=W0142
# 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.
+ # If we are and this table cell has an expanded state, then
+ # dont speak the number of items.
+ # See bug #432308 for more details.
#
rolesList = [pyatspi.ROLE_TABLE_CELL, \
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):
+ oldRole = _overrideRole(
+ 'ALTERNATIVE_REAL_ROLE_TABLE_CELL', args)
+ result = self.getSpeech(obj, **args)
+ _restoreRole(oldRole, args)
+ return result
+ return speechgenerator.SpeechGenerator._getRealTableCell(
+ self, obj, **args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]