[orca/570658] Actually hook the Gecko formatting module up (duh).



commit 9f242431dd21de2ea8c2c4e28f50444fef3acc37
Author: Willie Walker <william walker sun com>
Date:   Tue May 19 18:20:05 2009 -0400

    Actually hook the Gecko formatting module up (duh).
    Also work to get the list stuff working better.
    Also improve debug output of what the generators are providing.
---
 src/orca/scripts/toolkits/Gecko/formatting.py      |    3 ++-
 src/orca/scripts/toolkits/Gecko/script.py          |    6 +++++-
 .../scripts/toolkits/Gecko/speech_generator.py     |   19 ++++++++++++++++++-
 src/orca/speechgenerator.py                        |    3 +++
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index 2fe7b04..dc6f8d2 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -38,7 +38,8 @@ formatting = {
             'unfocused': 'name + roleName'
             },
         pyatspi.ROLE_LIST: {
-            'unfocused': 'labelOrName + multiselectableState + numberOfChildren'
+            'focused': 'focusedItem',
+            'unfocused': 'labelOrName + focusedItem + multiselectableState + numberOfChildren'
             },
     }
 }
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 92dc1af..0f26757 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -64,13 +64,13 @@ import orca.speechserver as speechserver
 import script_settings
 from braille_generator import BrailleGenerator
 from speech_generator import SpeechGenerator
+from formatting import Formatting
 from where_am_i import GeckoWhereAmI
 from bookmarks import GeckoBookmarks
 from structural_navigation import GeckoStructuralNavigation
 
 from orca.orca_i18n import _
 
-
 ########################################################################
 #                                                                      #
 # Script                                                               #
@@ -310,6 +310,10 @@ class Script(default.Script):
         """
         return SpeechGenerator(self)
 
+    def getFormatting(self):
+        """Returns the formatting strings for this script."""
+        return Formatting(self)
+
     def getEnabledStructuralNavigationTypes(self):
         """Returns a list of the structural navigation object types
         enabled in this script.
diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index e35cbdc..140f60b 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -116,6 +116,7 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
         else:
             result.extend(speechgenerator.SpeechGenerator._getLabelOrName(
                 self, obj, **args))
+        return result
 
     def _getRoleName(self, obj, **args):
         """Prevents some roles from being spoken."""
@@ -228,7 +229,6 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
     def _getNumberOfChildren(self, obj, **args):
         result = []
         role = args.get('role', obj.getRole())
-
         if role == pyatspi.ROLE_LIST:
             # Translators: this represents a list in HTML.
             #
@@ -240,6 +240,23 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
                 self, obj, **args))
         return result
 
+    def _getFocusedItem(self, obj, **args):
+        result = []
+        role = args.get('role', obj.getRole())
+        if role == pyatspi.ROLE_LIST:
+            item = None
+            selection = obj.querySelection()
+            for i in xrange(obj.childCount):
+                if selection.isChildSelected(i):
+                    item = obj[i]
+                    break
+            item = item or obj[0]
+            if item:
+                name = self._getName(item, **args)
+                if name and name != self._getLabel(obj, **args):
+                    result.extend(name)
+        return result
+
     def _getAncestors(self, obj, **args):
         result = []
         priorObj = args.get('priorObj', None)
diff --git a/src/orca/speechgenerator.py b/src/orca/speechgenerator.py
index 22da38c..f902c3a 100644
--- a/src/orca/speechgenerator.py
+++ b/src/orca/speechgenerator.py
@@ -120,6 +120,7 @@ class SpeechGenerator:
                                 debug.println(
                                     debug.LEVEL_SEVERE,
                                     "Unable to find function for '%s'\n" % arg)
+                            methods[arg] = []
                         except:
                             debug.printException(debug.LEVEL_SEVERE)
                             debug.println(
@@ -1092,6 +1093,8 @@ class SpeechGenerator:
                             "Unable to find function for '%s'\n" % arg)
                         break
                     methods[arg] = self._methodsDict[arg](obj, **args)
+                    debug.println(debug.LEVEL_ALL,
+                                  "%s=%s" % (arg, repr(methods[arg])))
         except:
             debug.printException(debug.LEVEL_SEVERE)
             result = []



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