[orca/570658] Add braille formatting for ROLE_SCROLL_PANE



commit d3860ee0d25d5b92c7eab0fa12cf8d5f64b0cf50
Author: Willie Walker <william walker sun com>
Date:   Thu Jun 25 13:34:28 2009 -0400

    Add braille formatting for ROLE_SCROLL_PANE

 src/orca/braille_generator.py |   31 +++++++++++++++++++++++++++++++
 src/orca/formatting.py        |    5 ++++-
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index fd90a27..bade0ec 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -75,6 +75,7 @@ class BrailleGenerator(generator.Generator):
         for element in result:
             if isinstance(element, braille.Region):
                 print "FOO", element.string, element.cursorOffset
+        return result
 
     #####################################################################
     #                                                                   #
@@ -140,6 +141,36 @@ class BrailleGenerator(generator.Generator):
 
     #####################################################################
     #                                                                   #
+    # Unfortunate hacks.                                                #
+    #                                                                   #
+    #####################################################################
+
+    def _generateAsPageTabOrScrollPane(self, obj, **args):
+        """If this scroll pane is labelled by a page tab, then return the page
+        tab information for the braille context instead. Thunderbird
+        folder properties is such a case. See bug #507922 for more
+        details.
+        """
+        result = []
+        relations = obj.getRelationSet()
+        for relation in relations:
+            if relation.getRelationType() ==  pyatspi.RELATION_LABELLED_BY:
+                labelledBy = relation.getTarget(0)
+                result.extend(self.generateBraille(labelledBy, **args))
+                break
+        if not result:
+            # NOTE: there is no REAL_ROLE_SCROLL_PANE in formatting.py
+            # because currently fallback to the default formatting.
+            # We will provide the support for someone to override this,
+            # however, so we use REAL_ROLE_SCROLL_PANE here.
+            #
+            oldRole = self._overrideRole('REAL_ROLE_SCROLL_PANE', args)
+            result.extend(self.generateBraille(obj, **args))
+            self._restoreRole(oldRole, args)
+        return result
+
+    #####################################################################
+    #                                                                   #
     # Other things for spacing                                          #
     #                                                                   #
     #####################################################################
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 0b80d9c..047e3f8 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -411,7 +411,10 @@ formatting = {
             },
         #pyatspi.ROLE_ROW_HEADER: 'default'
         #pyatspi.ROLE_SCROLL_BAR: 'default'
-        #pyatspi.ROLE_SCROLL_PANE: [[[TODO: WDW - needs to be done]]]
+        pyatspi.ROLE_SCROLL_PANE: {
+            'unfocused': 'asPageTabOrScrollPane'
+            },
+        #'REAL_ROLE_SCROLL_PANE': 'default'
         pyatspi.ROLE_SLIDER: {
             'unfocused': '[Component(obj,\
                                      asString(label + value + roleName + required))]'



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