[orca/gnome-2-28] Fix for bgo#595117 - Need to customize the presentation of the Packagemanager package list toggle
- From: Joanmarie Diggs <joanied src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [orca/gnome-2-28] Fix for bgo#595117 - Need to customize the presentation of the Packagemanager package list toggle
- Date: Mon, 14 Sep 2009 19:47:54 +0000 (UTC)
commit b4e7543fdf5ec81ab67a09c984483376a736e0ef
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Mon Sep 14 00:44:28 2009 -0400
Fix for bgo#595117 - Need to customize the presentation of the Packagemanager package list toggle
src/orca/scripts/apps/packagemanager/Makefile.am | 2 +
.../apps/packagemanager/braille_generator.py | 53 +++++++++++++++++
src/orca/scripts/apps/packagemanager/script.py | 49 +++++++++++++++
.../apps/packagemanager/speech_generator.py | 62 ++++++++++++++++++++
4 files changed, 166 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/packagemanager/Makefile.am b/src/orca/scripts/apps/packagemanager/Makefile.am
index 4da7e38..a294d4d 100644
--- a/src/orca/scripts/apps/packagemanager/Makefile.am
+++ b/src/orca/scripts/apps/packagemanager/Makefile.am
@@ -2,7 +2,9 @@ orca_pathdir=$(pyexecdir)
orca_python_PYTHON = \
__init__.py \
+ braille_generator.py \
script.py \
+ speech_generator.py \
tutorialgenerator.py
orca_pythondir=$(pyexecdir)/orca/scripts/apps/packagemanager
\ No newline at end of file
diff --git a/src/orca/scripts/apps/packagemanager/braille_generator.py b/src/orca/scripts/apps/packagemanager/braille_generator.py
new file mode 100644
index 0000000..1a1d8c6
--- /dev/null
+++ b/src/orca/scripts/apps/packagemanager/braille_generator.py
@@ -0,0 +1,53 @@
+# Orca
+#
+# Copyright 2005-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
+# 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 braille generator for Packagemanager."""
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+import orca.braille_generator as braille_generator
+
+class BrailleGenerator(braille_generator.BrailleGenerator):
+ """Special handling to minimize chattiness and maximize accuracy when
+ presenting the package list toggle. In particular, the toggle column
+ header is now a (de)select all rather than a sort. The PM GUI team
+ has provided an accessible name reflective of the new functionality
+ for the column header. Unfortunately, that functionality only applies
+ when the column header has focus. Therefore, don't present the name
+ when in the list proper.
+ """
+
+ def __init__(self, script):
+ braille_generator.BrailleGenerator.__init__(self, script)
+
+ def _generateColumnHeaderIfToggleAndNoText(self, obj, **args):
+ """If this table cell has a "toggle" action, and doesn't have any
+ label associated with it then also present the table column header
+ Unless we're in the package list.
+ """
+
+ result = []
+ if not self._script.isPackageListToggle(obj):
+ result.extend(braille_generator.BrailleGenerator.\
+ _generateColumnHeaderIfToggleAndNoText(self, obj, **args))
+ return result
diff --git a/src/orca/scripts/apps/packagemanager/script.py b/src/orca/scripts/apps/packagemanager/script.py
index 3ca4d96..85e7e69 100644
--- a/src/orca/scripts/apps/packagemanager/script.py
+++ b/src/orca/scripts/apps/packagemanager/script.py
@@ -33,6 +33,8 @@ import orca.speech as speech
from orca.orca_i18n import _
+from braille_generator import BrailleGenerator
+from speech_generator import SpeechGenerator
from tutorialgenerator import TutorialGenerator
########################################################################
@@ -61,6 +63,16 @@ class Script(default.Script):
return listeners
+ def getBrailleGenerator(self):
+ """Returns the braille generator for this script."""
+
+ return BrailleGenerator(self)
+
+ def getSpeechGenerator(self):
+ """Returns the speech generator for this script."""
+
+ return SpeechGenerator(self)
+
def getTutorialGenerator(self):
"""Returns the tutorial generator for this script."""
@@ -154,3 +166,40 @@ class Script(default.Script):
return True
return False
+
+ def isPackageListToggle(self, obj):
+ """Attempts to identify the toggle-able cell in the package list.
+
+ Arguments:
+ -obj: the accessible being examined
+
+ Returns True if we think obj is the toggle-able cell in the package
+ list.
+ """
+
+ if obj and obj.getRole() == pyatspi.ROLE_TABLE_CELL:
+ try:
+ action = obj.queryAction()
+ except NotImplementedError:
+ action = None
+ if action:
+ for i in range(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")]:
+ try:
+ table = obj.parent.queryTable()
+ except:
+ col = -1
+ else:
+ index = self.getCellIndex(obj)
+ col = table.getColumnAtIndex(index)
+ if col == 0:
+ top = self.getTopLevel(obj)
+ if top and top.getRole() == pyatspi.ROLE_FRAME:
+ return True
+ return False
+
+ return False
diff --git a/src/orca/scripts/apps/packagemanager/speech_generator.py b/src/orca/scripts/apps/packagemanager/speech_generator.py
new file mode 100644
index 0000000..aa118a3
--- /dev/null
+++ b/src/orca/scripts/apps/packagemanager/speech_generator.py
@@ -0,0 +1,62 @@
+# Orca
+#
+# Copyright 2005-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
+# 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 speech generator for Packagemanager."""
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
+__license__ = "LGPL"
+
+import orca.speech_generator as speech_generator
+
+class SpeechGenerator(speech_generator.SpeechGenerator):
+ """Special handling to minimize chattiness and maximize accuracy when
+ presenting the package list toggle.
+ """
+
+ def __init__(self, script):
+ speech_generator.SpeechGenerator.__init__(self, script)
+
+ def _generateColumnHeader(self, obj, **args):
+ """Returns an array of strings (and possibly voice and audio
+ specifications) that represent the column header for an object
+ that is in a table, if it exists. Otherwise, an empty array
+ is returned. Overridden here because we don't want to do this
+ for the toggle in the package list.
+ """
+
+ result = []
+ if not self._script.isPackageListToggle(obj):
+ result.extend(speech_generator.SpeechGenerator.\
+ _generateColumnHeader(self, obj, **args))
+ return result
+
+ def _generateColumnHeaderIfToggleAndNoText(self, obj, **args):
+ """If this table cell has a "toggle" action, and doesn't have any
+ label associated with it then also speak the table column
+ header. Unless we're in the package list.
+ """
+
+ result = []
+ if not self._script.isPackageListToggle(obj):
+ result.extend(speech_generator.SpeechGenerator.\
+ _generateColumnHeaderIfToggleAndNoText(self, obj, **args))
+ return result
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]