[orca/570658] Add _generateRealActiveDescendantRoleName



commit d074243b1337b9a9bdc0b6f3c832d7ebb1f22f59
Author: Willie Walker <william walker sun com>
Date:   Sat Jul 4 03:56:09 2009 -0400

    Add _generateRealActiveDescendantRoleName
    
    This is for presenting table cell contents.  We *may* want to consider
    just finding the active descendant and presenting the generator results
    for it, but for now I'm going to keep it simple.

 src/orca/generator.py |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 63ee9a4..18859e4 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -260,6 +260,15 @@ class Generator:
     #                                                                   #
     #####################################################################
 
+    def _generateRoleName(self, obj, **args):
+        """Returns the role name for the object in an array of strings, with
+        the exception that the pyatspi.ROLE_UNKNOWN role will yield an
+        empty array.  Note that a 'role' attribute in args will
+        override the accessible role of the obj.
+        """
+        # Subclasses must override this.
+        return []
+
     def _generateName(self, obj, **args):
         """Returns an array of strings for use by speech and braille that
         represent the name of the object.  If the object is directly
@@ -970,9 +979,9 @@ class Generator:
     def _generateRealActiveDescendantDisplayedText(self, obj, **args ):
         """Objects, such as tables and trees, can represent individual cells
         via a complicated nested hierarchy.  This method returns an
-        array of strings (and possibly voice and audio specifications)
-        that represents the text actually being painted in the cell,
-        if it can be found.  Otherwise, an empty array is returned.
+        array of strings for use by speech and braille that represents
+        the text actually being painted in the cell, if it can be
+        found.  Otherwise, an empty array is returned.
         """
         result = []
         text = self._script.getDisplayedText(
@@ -980,3 +989,14 @@ class Generator:
         if text:
             result = [text]
         return result
+
+    def _generateRealActiveDescendantRoleName(self, obj, **args ):
+        """Objects, such as tables and trees, can represent individual cells
+        via a complicated nested hierarchy.  This method returns an
+        array of strings for use by speech and braille that represents
+        the role of the object actually being painted in the cell.
+        """
+        rad = self._script.getRealActiveDescendant(obj)
+        args['role'] = rad.getRole()
+        print "RAD for", obj, "is", rad, self._generateRoleName(rad, **args)
+        return self._generateRoleName(rad, **args)



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