[orca/570658] Hook the new braile generator up
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Hook the new braile generator up
- Date: Fri, 26 Jun 2009 21:52:06 +0000 (UTC)
commit 90b80a42a760dda8887b1584007eb8c5867ae166
Author: Willie Walker <william walker sun com>
Date: Fri Jun 26 17:50:34 2009 -0400
Hook the new braile generator up
This can be turned off by setting braillegenerator.py:EXPERIMENTAL to False
src/orca/braille_generator.py | 27 ++++++++++++++++----
src/orca/braillegenerator.py | 5 +++-
src/orca/formatting.py | 52 ++++++++++++++++++----------------------
3 files changed, 48 insertions(+), 36 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 087b3a8..4cd678e 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -72,14 +72,29 @@ class BrailleGenerator(generator.Generator):
and not args.get('formatType', None):
args['formatType'] = 'focused'
result = self.generate(obj, **args)
+
print "RESULTS:"
- for element in result:
- if isinstance(element, (braille.Component, braille.Text)) \
- and element.accessible == obj:
- print " (*)", element
+ for region in result:
+ if isinstance(region, (braille.Component, braille.Text)) \
+ and region.accessible == obj:
+ print " (*)", region
else:
- print " ", element
- return result
+ print " ", region
+
+ # 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.
+ #
+ try:
+ focusedRegion = result[0]
+ except:
+ focusedRegion = None
+ for region in result:
+ if isinstance(region, (braille.Component, braille.Text)) \
+ and region.accessible == obj:
+ focusedRegion = region
+ break
+ return [result, focusedRegion]
#####################################################################
# #
diff --git a/src/orca/braillegenerator.py b/src/orca/braillegenerator.py
index 31dbfd6..888e593 100644
--- a/src/orca/braillegenerator.py
+++ b/src/orca/braillegenerator.py
@@ -1654,7 +1654,7 @@ class BrailleGenerator:
"""
if EXPERIMENTAL:
- self._experimental.generateBraille(obj)
+ return self._experimental.generateBraille(obj)
# If we want to group the children, first see if obj is a child of
# something we like to group. If so, then reset the obj to the obj's
@@ -1740,6 +1740,9 @@ class BrailleGenerator:
Returns a list of Regions to display.
"""
+ if EXPERIMENTAL:
+ return []
+
brailleRolenameStyle = settings.brailleRolenameStyle
regions = []
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 482024f..47976ff 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -36,13 +36,19 @@ import settings
TUTORIAL = '(tutorial and (pause + tutorial) or [])'
MNEMONIC = '(mnemonic and (pause + mnemonic + lineBreak) or [])'
+BRAILLE_TEXT = '[Text(obj, asString(label), asString(eol))]\
+ + (required and [Region(" " + asString(required))])\
+ + (readOnly and [Region(" " + asString(readOnly))])'
+
formatting = {
+
####################################################################
# #
# Strings Orca includes on its own (versus getting them from the #
# application. #
# #
####################################################################
+
'strings' : {
'speech' : {
'required' : settings.speechRequiredStateString,
@@ -304,20 +310,20 @@ 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': '[]'
+ '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': '[]'
},
'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,\
@@ -373,9 +379,9 @@ formatting = {
#pyatspi.ROLE_LIST: 'default'
pyatspi.ROLE_LIST_ITEM: {
'focused': '[Component(obj,\
- asString(label + displayedText + expandableState + roleName + availability) + asString(accelerator) + (asString(nodeLevel) and (" " + asString(nodeLevel))))]',
+ asString(label + displayedText + expandableState + roleName + availability) + asString(accelerator))]',
'unfocused': '[Component(obj,\
- asString(label + displayedText + expandableState + nodeLevel))]',
+ asString(label + displayedText + expandableState))]',
},
pyatspi.ROLE_MENU: {
'focused': '[Component(obj,\
@@ -402,18 +408,10 @@ formatting = {
asString((label or displayedText) + roleName))]'
},
pyatspi.ROLE_PARAGRAPH: {
- 'unfocused': '[Text(obj,\
- asString(label),\
- asString(eol)),\
- (required and Region(" " + asString(required))) or [],\
- (readOnly and Region(" " + asString(readOnly))) or []]'
+ 'unfocused': BRAILLE_TEXT
},
pyatspi.ROLE_PASSWORD_TEXT: {
- 'unfocused': '[Text(obj,\
- asString(label),\
- asString(eol)),\
- (required and Region(" " + asString(required))) or [],\
- (readOnly and Region(" " + asString(readOnly))) or []]'
+ 'unfocused': BRAILLE_TEXT
},
#pyatspi.ROLE_PROGRESS_BAR: 'default'
pyatspi.ROLE_PUSH_BUTTON: {
@@ -477,11 +475,7 @@ formatting = {
'unfocused': '[Text(obj)]'
},
pyatspi.ROLE_TEXT: {
- 'unfocused': '[Text(obj,\
- asString(label),\
- asString(eol))]\
- + (required and [Region(" " + asString(required))])\
- + (readOnly and [Region(" " + asString(readOnly))])'
+ 'unfocused': BRAILLE_TEXT
},
pyatspi.ROLE_TOGGLE_BUTTON: {
'unfocused': '[Component(obj,\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]