[orca/570658] Add braille formatting for ROLE_COMBO_BOX



commit 78bdc6adba0007e65520606f2c565687452a5aa0
Author: Willie Walker <william walker sun com>
Date:   Thu Jun 25 15:34:09 2009 -0400

    Add braille formatting for ROLE_COMBO_BOX

 src/orca/braille_generator.py |   18 ++++++++++++++++++
 src/orca/formatting.py        |    6 +++++-
 2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index bade0ec..7abc906 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -169,6 +169,24 @@ class BrailleGenerator(generator.Generator):
             self._restoreRole(oldRole, args)
         return result
 
+    def _generateComboBoxTextObj(self, obj, **args):
+        """For a combo box, we check to see if the text is editable. If so,
+        then we want to show the text attributes (such as selection --
+        see bug 496846 for more details).  This will return an array
+        containing a single object, which is the accessible for the
+        text object. Note that this is different from the rest of the
+        generators, which all return an array of strings.  Yes, this
+        is a hack.
+        """
+        result = []
+        textObj = None
+        for child in obj:
+            if child and child.getRole() == pyatspi.ROLE_TEXT:
+                textObj = child
+        if textObj and textObj.getState().contains(pyatspi.STATE_EDITABLE):
+            result.append(textObj)
+        return result
+
     #####################################################################
     #                                                                   #
     # Other things for spacing                                          #
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 432f368..16f363b 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -325,7 +325,11 @@ formatting = {
                                      indicator=asString(checkedState))]'
             },
         #pyatspi.ROLE_COLUMN_HEADER: 'default'
-        #pyatspi.ROLE_COMBO_BOX: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_COMBO_BOX: {
+            'unfocused': '[label and Region(asString(label) + " "),\
+                           (comboBoxTextObj and Text(comboBoxTextObj[0])) or Region(asString(displayedText)),\
+                           Region(" " + asString(roleName))]'
+            },
         #pyatspi.ROLE_DESKTOP_ICON: 'default'
         #pyatspi.ROLE_DIAL: 'default'
         #pyatspi.ROLE_DIALOG: 'default'



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