[orca] Generate all child widgets of GtkListBox items



commit 2cb880d9cc9c743c0ac1e64ccf1ea0f1ab52d473
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Nov 12 17:49:29 2015 -0500

    Generate all child widgets of GtkListBox items

 src/orca/braille_generator.py |   17 +++++++++++++++++
 src/orca/formatting.py        |    6 +++---
 src/orca/speech_generator.py  |   16 ++++++++++++++++
 3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index c22ea2a..4462c95 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -330,6 +330,23 @@ class BrailleGenerator(generator.Generator):
 
         return result
 
+    def _generateListBoxItemWidgets(self, obj, **args):
+        widgetRoles = [pyatspi.ROLE_CHECK_BOX,
+                       pyatspi.ROLE_COMBO_BOX,
+                       pyatspi.ROLE_PUSH_BUTTON,
+                       pyatspi.ROLE_RADIO_BUTTON,
+                       pyatspi.ROLE_SLIDER,
+                       pyatspi.ROLE_TOGGLE_BUTTON]
+        isWidget = lambda x: x and x.getRole() in widgetRoles
+        result = []
+        if obj.parent and obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
+            widgets = pyatspi.findAllDescendants(obj, isWidget)
+            for widget in widgets:
+                result.extend(self.generate(widget, includeContext=False))
+                result.append(braille.Region(" "))
+
+        return result
+
     #####################################################################
     #                                                                   #
     # Unfortunate hacks.                                                #
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 861780c..c6284a6 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -225,7 +225,7 @@ formatting = {
             },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState',
-            'unfocused': 'label + displayedText + allTextSelection + pause + expandableState + pause + 
positionInList + pause + childWidget',
+            'unfocused': 'label + displayedText + allTextSelection + pause + expandableState + pause + 
positionInList + pause + listBoxItemWidgets',
             'basicWhereAmI': 'label + roleName + pause + name + pause + positionInList + pause + 
expandableState + (nodeLevel or nestingLevel) + pause'
             },
         pyatspi.ROLE_MATH: {
@@ -566,11 +566,11 @@ formatting = {
                           or ([Component(obj,\
                                      asString(label + displayedText + expandableState + roleName + 
availability) + asString(accelerator))]\
                           + (nestingLevel and [Region(" " + asString(nestingLevel))])\
-                          + (childWidget and ([Region(" ")] + childWidget))))',
+                          + (listBoxItemWidgets and ([Region(" ")] + listBoxItemWidgets))))',
             'unfocused': '((substring and ' + BRAILLE_TEXT + ')\
                           or ([Component(obj, asString(labelOrName + expandableState))]\
                               + (nestingLevel and [Region(" " + asString(nestingLevel))])\
-                              + (childWidget and ([Region(" ")] + childWidget))))',
+                              + (listBoxItemWidgets and ([Region(" ")] + listBoxItemWidgets))))',
             },
         pyatspi.ROLE_MENU: {
             'focused':   '[Component(obj,\
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 9f346e2..8f90e8e 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1779,6 +1779,22 @@ class SpeechGenerator(generator.Generator):
             result.append(dialogs)
         return result
 
+    def _generateListBoxItemWidgets(self, obj, **args):
+        widgetRoles = [pyatspi.ROLE_CHECK_BOX,
+                       pyatspi.ROLE_COMBO_BOX,
+                       pyatspi.ROLE_PUSH_BUTTON,
+                       pyatspi.ROLE_RADIO_BUTTON,
+                       pyatspi.ROLE_SLIDER,
+                       pyatspi.ROLE_TOGGLE_BUTTON]
+        isWidget = lambda x: x and x.getRole() in widgetRoles
+        result = []
+        if obj.parent and obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
+            widgets = pyatspi.findAllDescendants(obj, isWidget)
+            for widget in widgets:
+                result.append(self.generate(widget, includeContext=False))
+
+        return result
+
     #####################################################################
     #                                                                   #
     # Keyboard shortcut information                                     #


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