[orca/570658] More work on braille formatting. Start looking at braille context.
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] More work on braille formatting. Start looking at braille context.
- Date: Fri, 26 Jun 2009 20:11:00 +0000 (UTC)
commit 2727d000ab591076bb39bc41eb15aa0648ed59b5
Author: Willie Walker <william walker sun com>
Date: Fri Jun 26 16:09:49 2009 -0400
More work on braille formatting. Start looking at braille context.
src/orca/braille_generator.py | 63 ++++++++++++++++++++++++++++++++++++----
src/orca/formatting.py | 12 ++++++-
2 files changed, 66 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 379b61f..cc98098 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -72,12 +72,9 @@ class BrailleGenerator(generator.Generator):
and not args.get('formatType', None):
args['formatType'] = 'focused'
result = self.generate(obj, **args)
- print "RESULT", result
+ print "RESULTS:"
for element in result:
- if isinstance(element, braille.Region):
- print " '%s', %d" % (element.string, element.cursorOffset)
- else:
- print " ", element
+ print " ", element
return result
#####################################################################
@@ -143,6 +140,58 @@ class BrailleGenerator(generator.Generator):
alertAndDialogCount) % alertAndDialogCount)
return result
+ def _generateAncestors(self, obj, **args):
+ """Returns an array of strings (and possibly voice and audio
+ specifications) that represent the text of the ancestors for
+ the object. This is typically used to present the context for
+ an object (e.g., the names of the window, the panels, etc.,
+ that the object is contained in). If the 'priorObj' attribute
+ of the args dictionary is set, only the differences in
+ ancestry between the 'priorObj' and the current obj will be
+ computed. The 'priorObj' is typically set by Orca to be the
+ previous object with focus.
+ """
+ result = []
+ if not settings.enableBrailleContext:
+ return result
+ args['includeContext'] = False
+
+ parent = obj.parent
+ if parent and (parent.getRole() in self.SKIP_CONTEXT_ROLES):
+ parent = parent.parent
+ while parent and (parent.parent != parent):
+ # [[[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
+ # as bugzilla bug 319751.]]]
+ #
+ if (parent.getRole() != pyatspi.ROLE_FILLER) \
+ 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))
+ # [[[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
+ # grouping is done via a FILLER with two children - one
+ # child is the overall label, and the other is the
+ # container for the grouped objects. When we detect this,
+ # we add the label to the overall context.]]]
+ #
+ 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))
+ parent = parent.parent
+ print "ANCESTORS"
+ for foo in result:
+ print " ", foo
+ result.reverse()
+ return result
+
#####################################################################
# #
# Unfortunate hacks. #
@@ -160,7 +209,7 @@ class BrailleGenerator(generator.Generator):
for relation in relations:
if relation.getRelationType() == pyatspi.RELATION_LABELLED_BY:
labelledBy = relation.getTarget(0)
- result.extend(self.generateBraille(labelledBy, **args))
+ result.extend(self.generate(labelledBy, **args))
break
if not result:
# NOTE: there is no REAL_ROLE_SCROLL_PANE in formatting.py
@@ -169,7 +218,7 @@ class BrailleGenerator(generator.Generator):
# however, so we use REAL_ROLE_SCROLL_PANE here.
#
oldRole = self._overrideRole('REAL_ROLE_SCROLL_PANE', args)
- result.extend(self.generateBraille(obj, **args))
+ result.extend(self.generate(obj, **args))
self._restoreRole(oldRole, args)
return result
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index dd5f924..bd5ac42 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -304,8 +304,16 @@ formatting = {
'braille': {
'prefix': {
+# 'focused': 'ancestors\
+# + (rowHeader and [Region(" " + asString(rowHeader))])\
+# + (columnHeader and [Region(" " + asString(columnHeader))])\
+# + (radioButtonGroup and [Region(" " + asString(radioButtonGroup))])',
+# 'unfocused': 'ancestors\
+# + (rowHeader and [Region(" " + asString(rowHeader))])\
+# + (columnHeader and [Region(" " + asString(columnHeader))])\
+# + (radioButtonGroup and [Region(" " + asString(radioButtonGroup))])',
'focused': '[]',
- 'unfocused': '[]',
+ 'unfocused': '[]'
},
'suffix': {
'focused': '(nodeLevel and [Region(" " + asString(nodeLevel))])',
@@ -349,7 +357,7 @@ formatting = {
},
pyatspi.ROLE_FRAME: {
'unfocused': '[Component(obj,\
- asString(label + displayedText + value + roleName + alertAndDialogCount))]'
+ asString(((label + displayedText) or name) + value + roleName + alertAndDialogCount))]'
},
#pyatspi.ROLE_HTML_CONTAINER: 'default'
pyatspi.ROLE_ICON: {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]