[orca/570658] Adjust braille spacing for tables and fix broken braille ancestry



commit 2eab54e576625a6e6c9e968ebdb2ca81bcaee7b9
Author: Willie Walker <william walker sun com>
Date:   Fri Jun 26 19:50:47 2009 -0400

    Adjust braille spacing for tables and fix broken braille ancestry

 src/orca/braille_generator.py |   16 ++++++++--------
 src/orca/formatting.py        |   14 +++++++-------
 src/orca/generator.py         |   21 ++++++++++++++++-----
 src/orca/settings.py          |    4 ++++
 4 files changed, 35 insertions(+), 20 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 4cd678e..2dd83eb 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -179,6 +179,7 @@ class BrailleGenerator(generator.Generator):
         if parent and (parent.getRole() in self.SKIP_CONTEXT_ROLES):
             parent = parent.parent
         while parent and (parent.parent != parent):
+            parentResult = []
             # [[[TODO: WDW - we might want to include more things here
             # besides just those things that have labels.  For example,
             # page tab lists might be a nice thing to include. Logged
@@ -188,9 +189,8 @@ class BrailleGenerator(generator.Generator):
                 and (parent.getRole() != pyatspi.ROLE_SECTION) \
                 and (parent.getRole() != pyatspi.ROLE_SPLIT_PANE) \
                 and (not self._script.isLayoutOnly(parent)):
-                print "ADDING", parent, self._script.getDisplayedText(parent)
-                result.append(braille.Region(" "))
-                result.extend(self.generate(parent, **args))
+                args['role'] = parent.getRole()
+                parentResult = self.generate(parent, **args)
             # [[[TODO: HACK - we've discovered oddness in hierarchies
             # such as the gedit Edit->Preferences dialog.  In this
             # dialog, we have labeled groupings of objects.  The
@@ -202,12 +202,12 @@ class BrailleGenerator(generator.Generator):
             if parent.getRole() == pyatspi.ROLE_FILLER:
                 label = self._script.getDisplayedLabel(parent)
                 if label and len(label) and not label.isspace():
-                    result.append(braille.Region(" "))
-                    result.extend(self.generate(parent, **args))
+                    args['role'] = parent.getRole()
+                    parentResult = self.generate(parent, **args)
+            if result and parentResult:
+                result.append(braille.Region(" "))
+            result.extend(parentResult)
             parent = parent.parent
-        print "ANCESTORS"
-        for foo in result:
-            print "  ", foo
         result.reverse()
         return result
 
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 47976ff..5bef7b5 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -313,17 +313,17 @@ formatting = {
             'focused':   'ancestors\
                          + (rowHeader and [Region(" " + asString(rowHeader))])\
                          + (columnHeader and [Region(" " + asString(columnHeader))])\
-                         + (radioButtonGroup and [Region(" " + asString(radioButtonGroup))])',
+                         + (radioButtonGroup and [Region(" " + asString(radioButtonGroup))])\
+                         + [Region(" ")]',
             'unfocused': 'ancestors\
                          + (rowHeader and [Region(" " + asString(rowHeader))])\
                          + (columnHeader and [Region(" " + asString(columnHeader))])\
-                         + (radioButtonGroup and [Region(" " + asString(radioButtonGroup))])',
-#            'focused':   '[]',
-#            'unfocused': '[]'
+                         + (radioButtonGroup and [Region(" " + asString(radioButtonGroup))])\
+                         + [Region(" ")]',
             },
         'suffix': {
-            'focused':   '(nodeLevel and [Region(asString(nodeLevel))])',
-            'unfocused': '(nodeLevel and [Region(asString(nodeLevel))])',
+            'focused':   '(nodeLevel and [Region(" " + asString(nodeLevel))])',
+            'unfocused': '(nodeLevel and [Region(" " + asString(nodeLevel))])',
             },
         'default': {
             'focused':   '[Component(obj,\
@@ -461,7 +461,7 @@ formatting = {
                               + (columnHeaderIfToggleAndNoText and [Region(" "), Component(obj, asString(columnHeaderIfToggleAndNoText))])\
                               + ((realActiveDescendantDisplayedText and [Component(obj, asString(realActiveDescendantDisplayedText))])\
                                  or (imageDescription and [Region(" "), Component(obj, asString(imageDescription))]))\
-                              + [Region(" " + asString(roleName))]\
+                              + (roleName and [Region(" " + asString(roleName))])\
                               + (expandableState and [Region(" " + asString(expandableState))])\
                               + (required and [Region(" " + asString(required))]))'
             },
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 5597f91..27e1539 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -30,6 +30,7 @@ import traceback
 
 import pyatspi
 
+import braille
 import debug
 import rolenames
 import settings
@@ -215,8 +216,13 @@ class Generator:
             else:
                 firstTimeCalled = False
 
-            debug.println(debug.LEVEL_ALL, "generate %s for %s using '%s'" \
-                          % (self._mode, repr(args), format))
+            debug.println(
+                debug.LEVEL_ALL,
+                "generate %s for %s (args=%s) using '%s'" \
+                % (self._mode,
+                   debug.getAccessibleDetails(obj),
+                   repr(args),
+                   format))
 
             assert(format)
             while True:
@@ -242,8 +248,9 @@ class Generator:
             debug.printException(debug.LEVEL_SEVERE)
             result = []
 
-        debug.println(debug.LEVEL_ALL,
-                      "generate %s generated '%s'" % (self._mode, repr(result)))
+        debug.println(debug.LEVEL_ALL, "generate %s results:" % self._mode)
+        for foo in result:
+            debug.println(debug.LEVEL_ALL, "  " + str(foo))
 
         return result
 
@@ -814,7 +821,11 @@ class Generator:
                     state = cell.getState()
                     showing = state.contains(pyatspi.STATE_SHOWING)
                     if showing:
-                        result.extend(self._generateRealTableCell(cell, **args))
+                        cellResult = self._generateRealTableCell(cell, **args)
+                        if cellResult and result and self._mode == 'braille':
+                            result.append(braille.Region(
+                                    settings.brailleTableCellDelimiter))
+                        result.extend(cellResult)
             else:
                 result.extend(self._generateRealTableCell(obj, **args))
         else:
diff --git a/src/orca/settings.py b/src/orca/settings.py
index c8f8dc4..9fbf62b 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -1298,3 +1298,7 @@ brailleExpansionIndicators = [_("collapsed"), _("expanded")]
 # be presented on a braille display.
 #
 brailleNodeLevelString = _("LEVEL %d")
+
+# String for delimiters between table cells
+#
+brailleTableCellDelimiter = " "



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