[orca] Add additional debugging output
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add additional debugging output
- Date: Thu, 27 Aug 2015 20:58:34 +0000 (UTC)
commit a8b8d1589cfcbafc4f385e4bc1f5abee94bec1ba
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Aug 27 16:57:09 2015 -0400
Add additional debugging output
src/orca/scripts/web/script_utilities.py | 74 ++++++++++++++++++++++++------
1 files changed, 59 insertions(+), 15 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index b241e58..4c7285b 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -132,7 +132,15 @@ class Utilities(script_utilities.Utilities):
return None
roles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB, pyatspi.ROLE_EMBEDDED]
- isDocument = lambda x: x and x.getRole() in roles
+
+ def isDocument(x):
+ try:
+ return x and x.getRole() in roles
+ except:
+ msg = "WEB: Exception getting role for %s" % x
+ debug.println(debug.LEVEL_INFO, msg)
+ return False
+
if isDocument(obj):
return obj
@@ -188,13 +196,21 @@ class Utilities(script_utilities.Utilities):
try:
state = obj.getState()
except:
+ msg = "WEB: Exception getting state for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
return
orca.setLocusOfFocus(None, obj, notifyScript=False)
if state.contains(pyatspi.STATE_FOCUSABLE):
try:
obj.queryComponent().grabFocus()
+ except NotImplementedError:
+ msg = "WEB: %s does not implement the component interface" % obj
+ debug.println(debug.LEVEL_INFO, msg)
+ return
except:
+ msg = "WEB: Exception grabbing focus on %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
return
text = self.queryNonEmptyText(obj)
@@ -450,6 +466,8 @@ class Utilities(script_utilities.Utilities):
except NotImplementedError:
pass
except:
+ msg = "WEB: Exception getting range extents for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
return [0, 0, 0, 0]
role = obj.getRole()
@@ -458,12 +476,24 @@ class Utilities(script_utilities.Utilities):
and parentRole in [pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_LIST_BOX]:
try:
ext = obj.parent.queryComponent().getExtents(0)
+ except NotImplementedError:
+ msg = "WEB: %s does not implement the component interface" % obj.parent
+ debug.println(debug.LEVEL_INFO, msg)
+ return [0, 0, 0, 0]
except:
+ msg = "WEB: Exception getting extents for %s" % obj.parent
+ debug.println(debug.LEVEL_INFO, msg)
return [0, 0, 0, 0]
else:
try:
ext = obj.queryComponent().getExtents(0)
+ except NotImplementedError:
+ msg = "WEB: %s does not implement the component interface" % obj
+ debug.println(debug.LEVEL_INFO, msg)
+ return [0, 0, 0, 0]
except:
+ msg = "WEB: Exception getting extents for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
return [0, 0, 0, 0]
return [ext.x, ext.y, ext.width, ext.height]
@@ -1104,31 +1134,31 @@ class Utilities(script_utilities.Utilities):
if obj is None:
obj, offset = self.getCaretContext()
- msg = "INFO: Current context is: %s, %i" % (obj, offset)
+ msg = "WEB: Current context is: %s, %i" % (obj, offset)
debug.println(debug.LEVEL_INFO, msg)
if obj and self.isZombie(obj):
- msg = "INFO: Current context obj %s is zombie" % obj
+ msg = "WEB: Current context obj %s is zombie" % obj
debug.println(debug.LEVEL_INFO, msg)
line = self.getLineContentsAtOffset(obj, offset, layoutMode, useCache)
- msg = "INFO: Line contents for %s, %i: %s" % (obj, offset, line)
+ msg = "WEB: Line contents for %s, %i: %s" % (obj, offset, line)
debug.println(debug.LEVEL_INFO, msg)
if not (line and line[0]):
return []
firstObj, firstOffset = line[0][0], line[0][1]
- msg = "INFO: First context on line is: %s, %i" % (firstObj, firstOffset)
+ msg = "WEB: First context on line is: %s, %i" % (firstObj, firstOffset)
debug.println(debug.LEVEL_INFO, msg)
obj, offset = self.previousContext(firstObj, firstOffset, True)
- msg = "INFO: Previous context is: %s, %i" % (obj, offset)
+ msg = "WEB: Previous context is: %s, %i" % (obj, offset)
debug.println(debug.LEVEL_INFO, msg)
contents = self.getLineContentsAtOffset(obj, offset, layoutMode, useCache)
if not contents:
- msg = "INFO: Could not get line contents for %s, %i" % (obj, offset)
+ msg = "WEB: Could not get line contents for %s, %i" % (obj, offset)
debug.println(debug.LEVEL_INFO, msg)
return []
@@ -1138,15 +1168,15 @@ class Utilities(script_utilities.Utilities):
if obj is None:
obj, offset = self.getCaretContext()
- msg = "INFO: Current context is: %s, %i" % (obj, offset)
+ msg = "WEB: Current context is: %s, %i" % (obj, offset)
debug.println(debug.LEVEL_INFO, msg)
if obj and self.isZombie(obj):
- msg = "INFO: Current context obj %s is zombie" % obj
+ msg = "WEB: Current context obj %s is zombie" % obj
debug.println(debug.LEVEL_INFO, msg)
line = self.getLineContentsAtOffset(obj, offset, layoutMode, useCache)
- msg = "INFO: Line contents for %s, %i: %s" % (obj, offset, line)
+ msg = "WEB: Line contents for %s, %i: %s" % (obj, offset, line)
debug.println(debug.LEVEL_INFO, msg)
if not (line and line[0]):
@@ -1157,16 +1187,16 @@ class Utilities(script_utilities.Utilities):
lastObj, lastOffset = self.lastContext(math)
else:
lastObj, lastOffset = line[-1][0], line[-1][2] - 1
- msg = "INFO: Last context on line is: %s, %i" % (lastObj, lastOffset)
+ msg = "WEB: Last context on line is: %s, %i" % (lastObj, lastOffset)
debug.println(debug.LEVEL_INFO, msg)
obj, offset = self.nextContext(lastObj, lastOffset, True)
- msg = "INFO: Next context is: %s, %i" % (obj, offset)
+ msg = "WEB: Next context is: %s, %i" % (obj, offset)
debug.println(debug.LEVEL_INFO, msg)
contents = self.getLineContentsAtOffset(obj, offset, layoutMode, useCache)
if not contents:
- msg = "INFO: Could not get line contents for %s, %i" % (obj, offset)
+ msg = "WEB: Could not get line contents for %s, %i" % (obj, offset)
debug.println(debug.LEVEL_INFO, msg)
return []
@@ -1177,6 +1207,8 @@ class Utilities(script_utilities.Utilities):
role = obj.getRole()
state = obj.getState()
except:
+ msg = "WEB: Exception getting role and state for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
return False
if state.contains(pyatspi.STATE_EDITABLE) \
@@ -1220,8 +1252,14 @@ class Utilities(script_utilities.Utilities):
if rv is not None:
return rv
- role = obj.getRole()
- state = obj.getState()
+ try:
+ role = obj.getRole()
+ state = obj.getState()
+ except:
+ msg = "WEB: Exception getting role and state for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
+ return False
+
textBlockElements = [pyatspi.ROLE_CAPTION,
pyatspi.ROLE_COLUMN_HEADER,
pyatspi.ROLE_DOCUMENT_FRAME,
@@ -2044,7 +2082,13 @@ class Utilities(script_utilities.Utilities):
def getChildIndex(obj, offset):
try:
hypertext = obj.queryHypertext()
+ except NotImplementedError:
+ msg = "WEB: %s does not implement the hypertext interface" % obj
+ debug.println(debug.LEVEL_INFO, msg)
+ return -1
except:
+ msg = "WEB: Exception querying hypertext interface for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
return -1
return hypertext.getLinkIndex(offset)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]