[orca/570658] Fix up braille generator for comboboxes.



commit d0f8f0b80535578f69b306e767e9010ba4549cd9
Author: Willie Walker <william walker sun com>
Date:   Sat Jun 27 10:17:24 2009 -0400

    Fix up braille generator for comboboxes.
    
    With this, the default braille generator has been fully migrated to use
    the new formatting strings.  One question remains, which whether or not
    we want to always include the entire row of a table in braille (with
    focus put on the appropriate cell) if read-by-row is enabled.  We did
    this in earlier versions, but it disappeared somewhere along the line.
    This new generator code has restored that ability.

 src/orca/braille_generator.py              |   11 ++++++++++-
 src/orca/formatting.py                     |   10 +++++++---
 test/keystrokes/gtk-demo/role_combo_box.py |    2 +-
 3 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 033c669..dc6af33 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -83,7 +83,10 @@ class BrailleGenerator(generator.Generator):
 
         # We guess at the focused region.  It's going to be a
         # Component or Text region whose accessible is the same
-        # as the object we're generating braille for.
+        # as the object we're generating braille for.  There is
+        # a small hack-like thing here where we include knowledge
+        # that we represent the text area of editable comboboxes
+        # instead of the combobox itself.
         #
         try:
             focusedRegion = result[0]
@@ -94,6 +97,12 @@ class BrailleGenerator(generator.Generator):
                and region.accessible == obj:
                 focusedRegion = region
                 break
+            elif isinstance(region, braille.Text) \
+                 and obj.getRole() == pyatspi.ROLE_COMBO_BOX \
+                 and region.accessible.parent == obj:
+                focusedRegion = region
+                break
+
         return [result, focusedRegion]
 
     #####################################################################
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 86926e1..aff61e8 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -364,10 +364,14 @@ formatting = {
             },
         #pyatspi.ROLE_COLUMN_HEADER: 'default'
         pyatspi.ROLE_COMBO_BOX: {
+            # [[[TODO: WDW - maybe pass the label into the region constructor?
+            # We could then use the cursorOffset field to indicate where the
+            # combobox starts.]]]
+            #
             'unfocused': '(label and [Region(asString(label) + " ")])\
-                          + (comboBoxTextObj and [Text(comboBoxTextObj[0])])\
-                            or [Component(obj, asString(displayedText)),\
-                                Region(" " + asString(roleName))]'
+                          + ((comboBoxTextObj and [Text(comboBoxTextObj[0])])\
+                             or [Component(obj, asString(displayedText))])\
+                          + [Region(" " + asString(roleName))]'
             },
         #pyatspi.ROLE_DESKTOP_ICON: 'default'
         #pyatspi.ROLE_DIAL: 'default'
diff --git a/test/keystrokes/gtk-demo/role_combo_box.py b/test/keystrokes/gtk-demo/role_combo_box.py
index dfc1a04..d7a7348 100644
--- a/test/keystrokes/gtk-demo/role_combo_box.py
+++ b/test/keystrokes/gtk-demo/role_combo_box.py
@@ -265,7 +265,7 @@ sequence.append(utils.AssertPresentationAction(
      "     VISIBLE:  'Combo boxes Frame', cursor=1",
      "BRAILLE LINE:  'gtk-demo Application Combo boxes Frame Editable Panel Two Combo'",
      "     VISIBLE:  'Two Combo', cursor=1",
-     "SPEECH OUTPUT: 'Combo boxes frame",
+     "SPEECH OUTPUT: 'Combo boxes frame'",
      "SPEECH OUTPUT: 'Editable panel Two combo box'"]))
 
 sequence.append(KeyComboAction("<Shift>ISO_Left_Tab"))



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