[orca/570658] Add __str__ methods to braille regions to help debugging
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Add __str__ methods to braille regions to help debugging
- Date: Fri, 26 Jun 2009 20:10:50 +0000 (UTC)
commit c21f9466065f5ea413563551f54cfe1d9a147608
Author: Willie Walker <william walker sun com>
Date: Fri Jun 26 16:08:00 2009 -0400
Add __str__ methods to braille regions to help debugging
src/orca/braille.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 1e7f301..244a4d5 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -323,6 +323,9 @@ class Region:
self.string = self.rawLine
self.cursorOffset = cursorOffset
+ def __str__(self):
+ return "REGION: '%s', %d" % (self.string, self.cursorOffset)
+
def processRoutingKey(self, offset):
"""Processes a cursor routing key press on this Component. The offset
is 0-based, where 0 represents the leftmost character of string
@@ -453,6 +456,9 @@ class Component(Region):
self.accessible = accessible
+ def __str__(self):
+ return "COMPONENT: '%s', %d" % (self.string, self.cursorOffset)
+
def getCaretOffset(self, offset):
"""Returns the caret position of the given offset if the object
has text with a caret. Otherwise, returns -1.
@@ -577,6 +583,9 @@ class Text(Region):
if not self.contracted and not settings.disableBrailleEOL:
self.string += self.eol
+ def __str__(self):
+ return "TEXT: '%s', %d" % (self.string, self.cursorOffset)
+
def repositionCursor(self):
"""Attempts to reposition the cursor in response to a new
caret position. If it is possible (i.e., the caret is on
@@ -1108,6 +1117,7 @@ def refresh(panToCursor=True, targetCursorCell=0, getLinkMask=True):
cursorCell += 1 # Normalize to 1-based offset
logLine = "BRAILLE LINE: '%s'" % string
+ print logLine
debug.println(debug.LEVEL_INFO, logLine)
log.info(logLine.encode("UTF-8"))
logLine = " VISIBLE: '%s', cursor=%d" % \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]