[orca] Add more debugging
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add more debugging
- Date: Wed, 29 Apr 2020 03:17:42 +0000 (UTC)
commit 892f4974a9696ca5d4f6f1f0b9812b6d7ad2db06
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Apr 28 23:05:22 2020 -0400
Add more debugging
src/orca/braille.py | 6 ++++++
src/orca/flat_review.py | 12 +++++++++++-
src/orca/scripts/default.py | 9 +++++++--
3 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index a9012d0a8..c9be96e39 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -774,6 +774,9 @@ class ReviewComponent(Component):
cursorOffset, expandOnCursor=True)
self.zone = zone
+ def __str__(self):
+ return "ReviewComponent: %s, %d" % (self.zone, self.cursorOffset)
+
class ReviewText(Region):
"""A subclass of Region backed by a Text object. This Region will
does not react to the caret changes, but will react if one updates
@@ -795,6 +798,9 @@ class ReviewText(Region):
self.lineOffset = lineOffset
self.zone = zone
+ def __str__(self):
+ return "ReviewText: %s, %d" % (self.zone, 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.
diff --git a/src/orca/flat_review.py b/src/orca/flat_review.py
index 7b0176888..7441df9f7 100644
--- a/src/orca/flat_review.py
+++ b/src/orca/flat_review.py
@@ -90,7 +90,11 @@ class Word:
self.chars = []
def __str__(self):
- return "WORD: '%s' %s" % (self.string.replace("\n", "\\n"), self.zone.accessible)
+ return "WORD: '%s' (%i-%i) %s" % \
+ (self.string.replace("\n", "\\n"),
+ self.startOffset,
+ self.endOffset,
+ self.zone.accessible)
def __getattribute__(self, attr):
if attr != "chars":
@@ -231,7 +235,13 @@ class Zone:
return self._extentsAreOnSameLine(zone)
def getWordAtOffset(self, charOffset):
+ msg = "FLAT REVIEW: Searching for word at offset %i" % charOffset
+ debug.println(debug.LEVEL_INFO, msg, True)
+
for word in self.words:
+ msg = "FLAT REVIEW: Checking %s" % word
+ debug.println(debug.LEVEL_INFO, msg, True)
+
offset = word.getRelativeOffset(charOffset)
if offset >= 0:
return word, offset
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 64f92e0a4..7add12596 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -3460,8 +3460,10 @@ class Script(script.Script):
braille.setLines([line])
self.setBrailleFocus(regionWithFocus, False)
if regionWithFocus:
- self.panBrailleToOffset(regionWithFocus.brailleOffset \
- + regionWithFocus.cursorOffset)
+ offset = regionWithFocus.brailleOffset + regionWithFocus.cursorOffset
+ msg = "DEFAULT: Update to %i in %s" % (offset, regionWithFocus)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ self.panBrailleToOffset(offset)
if self.justEnteredFlatReviewMode:
self.refreshBraille(True, self.targetCursorCell)
@@ -3480,6 +3482,9 @@ class Script(script.Script):
isTextOrComponent = lambda x: isinstance(x, (braille.ReviewText, braille.ReviewComponent))
regions = list(filter(isTextOrComponent, regions))
+ msg = "DEFAULT: Text/Component regions on line:\n%s" % "\n".join(map(str, regions))
+ debug.println(debug.LEVEL_INFO, msg, True)
+
# TODO - JD: The current code was stopping on the first region which met the
# following condition. Is that definitely the right thing to do? Assume so for now.
# Also: Should the default script be accessing things like the viewport directly??
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]