[orca/570658] Add in guessing of braille region of focus
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Add in guessing of braille region of focus
- Date: Fri, 26 Jun 2009 21:25:06 +0000 (UTC)
commit d406d55ae11ed578f2452fd23d6b97bd39d696d4
Author: Willie Walker <william walker sun com>
Date: Fri Jun 26 17:23:10 2009 -0400
Add in guessing of braille region of focus
This merely makes sure that there is a Component region in the list.
The region of focus is the first Component region we find whose
accessible is the object we generated the braille for.
src/orca/braille.py | 9 ++++++---
src/orca/braille_generator.py | 6 +++++-
src/orca/formatting.py | 14 +++++++-------
3 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 244a4d5..63d08fc 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -324,7 +324,7 @@ class Region:
self.cursorOffset = cursorOffset
def __str__(self):
- return "REGION: '%s', %d" % (self.string, self.cursorOffset)
+ return "Region: '%s', %d" % (self.string, self.cursorOffset)
def processRoutingKey(self, offset):
"""Processes a cursor routing key press on this Component. The offset
@@ -457,7 +457,7 @@ class Component(Region):
self.accessible = accessible
def __str__(self):
- return "COMPONENT: '%s', %d" % (self.string, self.cursorOffset)
+ return "Component: '%s', %d" % (self.string, self.cursorOffset)
def getCaretOffset(self, offset):
"""Returns the caret position of the given offset if the object
@@ -500,6 +500,9 @@ class Link(Component):
have the region expand on cursor."""
Component.__init__(self, accessible, string, cursorOffset, '', True)
+ def __str__(self):
+ return "Link: '%s', %d" % (self.string, self.cursorOffset)
+
def getAttributeMask(self, getLinkMask=True):
"""Creates a string which can be used as the attrOr field of brltty's
write structure for the purpose of indicating text attributes and
@@ -584,7 +587,7 @@ class Text(Region):
self.string += self.eol
def __str__(self):
- return "TEXT: '%s', %d" % (self.string, self.cursorOffset)
+ return "Text: '%s', %d" % (self.string, self.cursorOffset)
def repositionCursor(self):
"""Attempts to reposition the cursor in response to a new
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index cc98098..087b3a8 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -74,7 +74,11 @@ class BrailleGenerator(generator.Generator):
result = self.generate(obj, **args)
print "RESULTS:"
for element in result:
- print " ", element
+ if isinstance(element, (braille.Component, braille.Text)) \
+ and element.accessible == obj:
+ print " (*)", element
+ else:
+ print " ", element
return result
#####################################################################
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index bd5ac42..482024f 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -344,7 +344,7 @@ formatting = {
#pyatspi.ROLE_COLUMN_HEADER: 'default'
pyatspi.ROLE_COMBO_BOX: {
'unfocused': '[label and Region(asString(label) + " "),\
- (comboBoxTextObj and Text(comboBoxTextObj[0])) or Region(asString(displayedText)),\
+ (comboBoxTextObj and Text(comboBoxTextObj[0])) or Component(obj, asString(displayedText)),\
Region(" " + asString(roleName))]'
},
#pyatspi.ROLE_DESKTOP_ICON: 'default'
@@ -460,9 +460,9 @@ formatting = {
'REAL_ROLE_TABLE_CELL' : {
'unfocused': '(tableCell2ChildToggle + tableCell2ChildLabel)\
or (cellCheckedState\
- + (columnHeaderIfToggleAndNoText and [Region(" " + asString(columnHeaderIfToggleAndNoText))])\
- + ((realActiveDescendantDisplayedText and [Region(asString(realActiveDescendantDisplayedText))])\
- or (imageDescription and [Region(" " + asString(imageDescription))]))\
+ + (columnHeaderIfToggleAndNoText and [Region(" "), Component(obj, asString(columnHeaderIfToggleAndNoText))])\
+ + ((realActiveDescendantDisplayedText and [Component(obj, asString(realActiveDescendantDisplayedText))])\
+ or (imageDescription and [Region(" "), Component(obj, asString(imageDescription))]))\
+ [Region(" " + asString(roleName))]\
+ (expandableState and [Region(" " + asString(expandableState))])\
+ (required and [Region(" " + asString(required))]))'
@@ -479,9 +479,9 @@ formatting = {
pyatspi.ROLE_TEXT: {
'unfocused': '[Text(obj,\
asString(label),\
- asString(eol)),\
- (required and Region(" " + asString(required))) or [],\
- (readOnly and Region(" " + asString(readOnly))) or []]'
+ asString(eol))]\
+ + (required and [Region(" " + asString(required))])\
+ + (readOnly and [Region(" " + asString(readOnly))])'
},
pyatspi.ROLE_TOGGLE_BUTTON: {
'unfocused': '[Component(obj,\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]