[orca/570658] Fix lists for new braille generator (I hope)



commit 465b20875b9af56effb6abced0dd40a956fc2083
Author: Willie Walker <william walker sun com>
Date:   Thu Jul 2 10:12:59 2009 -0400

    Fix lists for new braille generator (I hope)

 .../scripts/toolkits/Gecko/braille_generator.py    |   35 ++++++++++++++-----
 src/orca/scripts/toolkits/Gecko/formatting.py      |    5 +++
 2 files changed, 31 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/braille_generator.py b/src/orca/scripts/toolkits/Gecko/braille_generator.py
index f1016e0..733683c 100644
--- a/src/orca/scripts/toolkits/Gecko/braille_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/braille_generator.py
@@ -210,6 +210,23 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
             result.append(text)
         return result
 
+    def _generateFocusedItem(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._generateName(item, **args)
+                if name and name != self._generateLabel(obj, **args):
+                    result.extend(name)
+        return result
+
     def generateBraille(self, obj, **args):
         result = []
         # ARIA widgets get treated like regular default widgets.
@@ -296,7 +313,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForCheckBox(self, obj)
-#        
+#
 #        # In document content (I'm not sure about XUL widgets yet), a
 #        # checkbox is its own little beast with no text.  So...  if it
 #        # is in document content and has a label, we're likely to be
@@ -359,7 +376,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForRadioButton(self, obj)
-#        
+#
 #        # In document content (I'm not sure about XUL widgets yet), a
 #        # radio button is its own little beast with no text.  So...  if it
 #        # is in document content and has a label, we're likely to be
@@ -415,7 +432,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForText(self, obj)
-#        
+#
 #        parent = obj.parent
 #        if parent.getRole() != pyatspi.ROLE_AUTOCOMPLETE:
 #            return braillegenerator.BrailleGenerator._getBrailleRegionsForText(
@@ -464,7 +481,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                     _getBrailleRegionsForComboBox(self, obj)
-#        
+#
 #        regions = []
 #
 #        label = self._script.getDisplayedLabel(obj)
@@ -546,7 +563,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                     _getBrailleRegionsForMenuItem(self, obj)
-#        
+#
 #        if not self._script.inDocumentContent():
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForMenuItem(self, obj)
@@ -596,7 +613,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForList(self, obj)
-#        
+#
 #        if not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForList(self, obj)
@@ -654,13 +671,13 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
 #        if self._script.isAriaWidget(obj):
 #            return braillegenerator.BrailleGenerator.\
 #                       _getBrailleRegionsForImage(self, obj)
-#        
+#
 #        text = ""
-#        text = self._script.appendString(text, 
+#        text = self._script.appendString(text,
 #                                         self._script.getDisplayedLabel(obj))
 #        text = self._script.appendString(text,
 #                                         self._script.getDisplayedText(obj))
-#        link = self._script.getAncestor(obj, 
+#        link = self._script.getAncestor(obj,
 #                                        [pyatspi.ROLE_LINK],
 #                                        [pyatspi.ROLE_DOCUMENT_FRAME])
 #        if link:
diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index 3e295a9..4f30639 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -106,6 +106,11 @@ formatting = {
             'unfocused': '[Link(obj, asString(currentLineText)\
                                      or asString(displayedText)\
                                      or asString(name))]',
+        },
+        pyatspi.ROLE_LIST: {
+            'unfocused': '[Component(obj,\
+                                     asString(label + focusedItem + roleName),\
+                                     asString(label) and (len(asString(label)) + 1) or 0)]'
         }
     }
 }



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