[orca/570658] Updated planner script to use formatting, and modified speech_generator to match.
- From: Mesar Hameed <mhameed src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Updated planner script to use formatting, and modified speech_generator to match.
- Date: Thu, 14 May 2009 13:55:36 -0400 (EDT)
commit 1ddadf64371b16825cf1c59d637fcd1e2cc9e36f
Author: Mesar Hameed <mhameed src gnome org>
Date: Thu May 14 18:55:22 2009 +0100
Updated planner script to use formatting, and modified speech_generator to match.
---
.../apps/gnome-window-properties/Makefile.am | 5 +-
src/orca/scripts/apps/planner/Makefile.am | 9 ++--
src/orca/scripts/apps/planner/formatting.py | 46 ++++++++++++++++++++
src/orca/scripts/apps/planner/script.py | 7 +++-
src/orca/scripts/apps/planner/speech_generator.py | 28 ++----------
5 files changed, 64 insertions(+), 31 deletions(-)
diff --git a/src/orca/scripts/apps/gnome-window-properties/Makefile.am b/src/orca/scripts/apps/gnome-window-properties/Makefile.am
index e8612ee..1e8a46c 100755
--- a/src/orca/scripts/apps/gnome-window-properties/Makefile.am
+++ b/src/orca/scripts/apps/gnome-window-properties/Makefile.am
@@ -2,8 +2,9 @@ orca_pathdir=$(pyexecdir)
orca_python_PYTHON = \
__init__.py \
- script.py \
- formatting.py
+ formatting.py \
+ script.py
+
orca_pythondir=$(pyexecdir)/orca/scripts/apps/gnome-window-properties
diff --git a/src/orca/scripts/apps/planner/Makefile.am b/src/orca/scripts/apps/planner/Makefile.am
old mode 100644
new mode 100755
index f5da4c1..817a7df
--- a/src/orca/scripts/apps/planner/Makefile.am
+++ b/src/orca/scripts/apps/planner/Makefile.am
@@ -1,10 +1,11 @@
orca_pathdir=$(pyexecdir)
orca_python_PYTHON = \
- __init__.py \
- braille_generator.py \
- script.py \
- speech_generator.py
+ __init__.py \
+ braille_generator.py \
+ formatting.py \
+ script.py \
+ speech_generator.py
orca_pythondir=$(pyexecdir)/orca/scripts/apps/planner
diff --git a/src/orca/scripts/apps/planner/formatting.py b/src/orca/scripts/apps/planner/formatting.py
new file mode 100755
index 0000000..da8090c
--- /dev/null
+++ b/src/orca/scripts/apps/planner/formatting.py
@@ -0,0 +1,46 @@
+# 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 planner."""
+
+__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': {
+ pyatspi.ROLE_TOGGLE_BUTTON: {
+ 'unfocused': '(isDesiredFocusedItem and _("Display more options") + labelAndName + allTextSelection + roleName + toggleState + availability) or label'
+ 'focused': '(isDesiredFocusedItem and toggleState) or label'
+ },
+ }
+}
+
+class Formatting(defaultFormatting.Formatting):
+
+ def __init__(self, script):
+ defaultFormatting.Formatting.__init__(self, script)
+ self.update(scriptFormatting)
+
diff --git a/src/orca/scripts/apps/planner/script.py b/src/orca/scripts/apps/planner/script.py
old mode 100644
new mode 100755
index a837129..d63c4d3
--- a/src/orca/scripts/apps/planner/script.py
+++ b/src/orca/scripts/apps/planner/script.py
@@ -27,8 +27,9 @@ __license__ = "LGPL"
import orca.default as default
-from speech_generator import SpeechGenerator
from braille_generator import BrailleGenerator
+from formatting import Formatting
+from speech_generator import SpeechGenerator
########################################################################
# #
@@ -55,3 +56,7 @@ class Script(default.Script):
def getSpeechGenerator(self):
return SpeechGenerator(self)
+
+ def getFormatting(self):
+ """Returns the formatting strings for this script."""
+ return Formatting(self)
diff --git a/src/orca/scripts/apps/planner/speech_generator.py b/src/orca/scripts/apps/planner/speech_generator.py
old mode 100644
new mode 100755
index 7a164cf..3979437
--- a/src/orca/scripts/apps/planner/speech_generator.py
+++ b/src/orca/scripts/apps/planner/speech_generator.py
@@ -41,10 +41,7 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
#
# Also for each one of the grphics buttons in the main window
#
- def _getSpeechForToggleButton(self, obj, already_focused):
- utterances = []
- tmp = []
-
+ def _getIsDesiredFocusedItem(self, obj, already_focused):
# Application should implement an accessible name in this
# component, but until this is made We speech/braille "display
# more options" when the focus is in one of these toggle
@@ -55,23 +52,6 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
pyatspi.ROLE_TOOL_BAR]
if self._script.isDesiredFocusedItem(obj, roleList) and not obj.name:
- if not already_focused:
- tmp.append(_("Display more options"))
- tmp.extend(self._getDefaultSpeech(obj, already_focused))
-
- if obj.getState().contains(pyatspi.STATE_CHECKED):
- tmp.append(_("pressed"))
- else:
- tmp.append(_("not pressed"))
-
- utterances.extend(tmp)
- utterances.extend(self._getSpeechForObjectAvailability(obj))
- else:
- if obj.getState().contains(pyatspi.STATE_CHECKED):
- utterances.append(_("pressed"))
- else:
- utterances.append(_("not pressed"))
-
- return utterances
-
- return self._getSpeechForLabel(obj, already_focused)
+ return True
+ else:
+ return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]