[orca/gnome-3-10] Present the wifi network and battery-charged state in the new system status menu



commit 7f7e1a94cb024268ad9c935c11259b9b634740b6
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Oct 14 11:41:01 2013 -0400

    Present the wifi network and battery-charged state in the new system status menu

 src/orca/braille_generator.py                 |    9 ++++
 src/orca/scripts/toolkits/CALLY/Makefile.am   |    1 +
 src/orca/scripts/toolkits/CALLY/formatting.py |   64 +++++++++++++++++++++++++
 src/orca/scripts/toolkits/CALLY/script.py     |    7 +++
 4 files changed, 81 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 76df4d7..b5380ef 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -181,6 +181,15 @@ class BrailleGenerator(generator.Generator):
 
         return Atk.role_get_localized_name(atkRole)
 
+    def _generateUnrelatedLabels(self, obj, **args):
+        result = []
+        labels = self._script.utilities.unrelatedLabels(obj)
+        for label in labels:
+            name = self._generateName(label, **args)
+            result.extend(name)
+
+        return result
+
     #####################################################################
     #                                                                   #
     # Keyboard shortcut information                                     #
diff --git a/src/orca/scripts/toolkits/CALLY/Makefile.am b/src/orca/scripts/toolkits/CALLY/Makefile.am
index 997257e..71118c0 100644
--- a/src/orca/scripts/toolkits/CALLY/Makefile.am
+++ b/src/orca/scripts/toolkits/CALLY/Makefile.am
@@ -1,5 +1,6 @@
 orca_python_PYTHON = \
        __init__.py \
+       formatting.py \
        script.py
 
 orca_pythondir=$(pkgpythondir)/scripts/toolkits/CALLY
diff --git a/src/orca/scripts/toolkits/CALLY/formatting.py b/src/orca/scripts/toolkits/CALLY/formatting.py
new file mode 100644
index 0000000..87dabc9
--- /dev/null
+++ b/src/orca/scripts/toolkits/CALLY/formatting.py
@@ -0,0 +1,64 @@
+# Orca
+#
+# Copyright 2013 Igalia, S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser 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.
+
+__id__ = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2013 Igalia, S.L."
+__license__   = "LGPL"
+
+import copy
+import pyatspi
+
+import orca.formatting
+import orca.settings
+
+formatting = {
+    'speech': {
+        pyatspi.ROLE_MENU_ITEM: {
+            'focused': 'expandableState',
+            'unfocused': 'labelAndName + unrelatedLabels + menuItemCheckedState + expandableState + 
availability + ' + orca.formatting.MNEMONIC + ' + accelerator + positionInList',
+            'basicWhereAmI': 'ancestors + labelAndName + unrelatedLabels + accelerator + positionInList + ' 
+ orca.formatting.MNEMONIC
+            },
+    },
+    'braille': {
+        pyatspi.ROLE_MENU_ITEM: {
+            'unfocused': '[Component(obj,\
+                                     asString(label + (displayedText or unrelatedLabels) + expandableState + 
availability) + asString(accelerator),\
+                                     indicator=asString(menuItemCheckedState))]'
+            },
+    }
+}
+
+if orca.settings.useExperimentalSpeechProsody:
+    formatting['speech'][pyatspi.ROLE_MENU_ITEM]['unfocused'] = 'labelAndName + pause + unrelatedLabels + 
pause + menuItemCheckedState + expandableState + availability + ' + orca.formatting.MNEMONIC + ' + 
accelerator + pause + positionInList'
+    formatting['speech'][pyatspi.ROLE_MENU_ITEM]['basicWhereAmI'] = \
+        'ancestors + pause + labelAndName + pause + unrelatedLabels + pause + accelerator + pause + 
positionInList + ' + orca.formatting.MNEMONIC
+
+class Formatting(orca.formatting.Formatting):
+    def __init__(self, script):
+        orca.formatting.Formatting.__init__(self, script)
+        self.update(copy.deepcopy(formatting))
+        self._defaultFormatting = orca.formatting.Formatting(script)
+
+    def getFormat(self, **args):
+        if args.get('useDefaultFormatting', False):
+            return self._defaultFormatting.getFormat(**args)
+        else:
+            return orca.formatting.Formatting.getFormat(self, **args)
diff --git a/src/orca/scripts/toolkits/CALLY/script.py b/src/orca/scripts/toolkits/CALLY/script.py
index dc71e67..b1f71b4 100644
--- a/src/orca/scripts/toolkits/CALLY/script.py
+++ b/src/orca/scripts/toolkits/CALLY/script.py
@@ -34,6 +34,8 @@ import orca.orca as orca
 import orca.scripts.default as default
 import orca.debug as debug
 
+from .formatting import Formatting
+
 # Set with non printable unicode categories. Full table:
 # http://www.fileformat.info/info/unicode/category/index.htm
 #
@@ -116,6 +118,11 @@ class Script(default.Script):
         self._activeDialog = (None, 0) # (Accessible, Timestamp)
         self._activeDialogLabels = {}  # key == hash(obj), value == name
 
+    def getFormatting(self):
+        """Returns the formatting strings for this script."""
+
+        return Formatting(self)
+
     def checkKeyboardEventData(self, keyboardEvent):
         """Processes the given keyboard event.
 


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