[orca] Fix for bug 638285 - debug.getAccessibleDetails() is called by the generator and scripts regardless
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bug 638285 - debug.getAccessibleDetails() is called by the generator and scripts regardless
- Date: Wed, 29 Dec 2010 17:32:41 +0000 (UTC)
commit 1b2ca57dbf8d5d0d94a51e0b40cc7edf565e4ee5
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Wed Dec 29 12:29:03 2010 -0500
Fix for bug 638285 - debug.getAccessibleDetails() is called by the generator and scripts regardless of the debug level
src/orca/debug.py | 25 +++++++++++++++----
src/orca/generator.py | 3 +-
src/orca/script_utilities.py | 18 +++++++++----
src/orca/scripts/apps/evolution/script.py | 5 +--
src/orca/scripts/apps/gedit/script.py | 15 ++++-------
src/orca/scripts/apps/gnome-search-tool/script.py | 5 +--
src/orca/scripts/apps/liferea/script.py | 5 +--
src/orca/scripts/apps/nautilus/script.py | 5 +--
src/orca/scripts/apps/soffice/script.py | 21 ++++++----------
src/orca/scripts/apps/soffice/script_utilities.py | 5 ++-
.../scripts/toolkits/Gecko/script_utilities.py | 3 +-
11 files changed, 60 insertions(+), 50 deletions(-)
---
diff --git a/src/orca/debug.py b/src/orca/debug.py
index f44e069..39e3387 100644
--- a/src/orca/debug.py
+++ b/src/orca/debug.py
@@ -201,9 +201,10 @@ def printDetails(level, indent, accessible, includeApp=True):
"""
if level >= debugLevel and accessible:
- println(level, getAccessibleDetails(accessible, indent, includeApp))
+ println(level,
+ getAccessibleDetails(level, accessible, indent, includeApp))
-def getAccessibleDetails(acc, indent="", includeApp=True):
+def getAccessibleDetails(level, acc, indent="", includeApp=True):
"""Returns a string, suitable for printing, that describes the
given accessible.
@@ -213,6 +214,9 @@ def getAccessibleDetails(acc, indent="", includeApp=True):
for this accessible.
"""
+ if level < debugLevel:
+ return ""
+
if includeApp:
app = acc.getApplication()
if app:
@@ -223,15 +227,24 @@ def getAccessibleDetails(acc, indent="", includeApp=True):
string = indent
# create the States string
- stateSet = acc.getState()
- states = stateSet.getStates()
+ try:
+ stateSet = acc.getState()
+ except:
+ string += "(exception getting state set)"
+ try:
+ states = stateSet.getStates()
+ except:
+ string += "(exception getting states)"
state_strings = []
for state in states:
state_strings.append(pyatspi.stateToString(state))
state_string = ' '.join(state_strings)
# create the relations string
- relations = acc.getRelationSet()
+ try:
+ relations = acc.getRelationSet()
+ except:
+ string += "(exception getting relation set)"
if relations:
relation_strings = []
for relation in relations:
@@ -245,7 +258,7 @@ def getAccessibleDetails(acc, indent="", includeApp=True):
string += "name='%s' role='%s' state='%s' relations='%s'" \
% (acc.name or 'None', acc.getRoleName(),
state_string, rel_string)
- except DataError:
+ except:
string += "(exception fetching data)"
return string
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 158ed5b..a2f3329 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -219,12 +219,13 @@ class Generator:
else:
firstTimeCalled = False
+ details = debug.getAccessibleDetails(debug.LEVEL_ALL, obj)
debug.println(
debug.LEVEL_ALL,
"\n\n\ngenerate %s for %s %s (args=%s) using '%s'" \
% (self._mode,
args['formatType'],
- debug.getAccessibleDetails(obj),
+ details,
repr(args),
format))
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 9c53533..d921a91 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -800,9 +800,10 @@ class Utilities:
state = obj.getState()
readOnly = state.contains(pyatspi.STATE_FOCUSABLE) \
and not state.contains(pyatspi.STATE_EDITABLE)
+ details = debug.getAccessibleDetails(debug.LEVEL_ALL, obj)
debug.println(debug.LEVEL_ALL,
"isReadOnlyTextArea=%s for %s" \
- % (readOnly, debug.getAccessibleDetails(obj)))
+ % (readOnly, details))
return readOnly
@@ -2181,7 +2182,8 @@ class Utilities:
indent = ""
for ancestor in ancestorList:
- line = indent + "+- " + debug.getAccessibleDetails(ancestor)
+ line = indent + "+- " + \
+ debug.getAccessibleDetails(debug.LEVEL_OFF, ancestor)
debug.println(debug.LEVEL_OFF, line)
print line
indent += " "
@@ -2194,11 +2196,13 @@ class Utilities:
debug.println(debug.LEVEL_OFF, line)
print line
for app in apps:
- line = debug.getAccessibleDetails(app, " App: ", False)
+ line = debug.getAccessibleDetails(
+ debug.LEVEL_OFF, app, " App: ", False)
debug.println(debug.LEVEL_OFF, line)
print line
for child in app:
- line = debug.getAccessibleDetails(child, " Window: ", False)
+ line = debug.getAccessibleDetails(
+ debug.LEVEL_OFF, child, " Window: ", False)
debug.println(debug.LEVEL_OFF, line)
print line
if child.parent != app:
@@ -2223,9 +2227,11 @@ class Utilities:
return
if root == ooi:
- line = indent + "(*) " + debug.getAccessibleDetails(root)
+ line = indent + "(*) " + debug.getAccessibleDetails(
+ debug.LEVEL_OFF, root)
else:
- line = indent + "+- " + debug.getAccessibleDetails(root)
+ line = indent + "+- " + debug.getAccessibleDetails(
+ debug.LEVEL_OFF, root)
debug.println(debug.LEVEL_OFF, line)
print line
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 53f0533..164cced 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -277,9 +277,8 @@ class Script(default.Script):
brailleGen = self.brailleGenerator
speechGen = self.speechGenerator
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# We always automatically go back to focus tracking mode when
# the focus changes.
diff --git a/src/orca/scripts/apps/gedit/script.py b/src/orca/scripts/apps/gedit/script.py
index 8c81363..29b6524 100644
--- a/src/orca/scripts/apps/gedit/script.py
+++ b/src/orca/scripts/apps/gedit/script.py
@@ -337,9 +337,8 @@ class Script(default.Script):
- newLocusOfFocus: Accessible that is the new locus of focus
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
@@ -437,9 +436,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
@@ -537,9 +535,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
diff --git a/src/orca/scripts/apps/gnome-search-tool/script.py b/src/orca/scripts/apps/gnome-search-tool/script.py
index b39270e..513cd20 100644
--- a/src/orca/scripts/apps/gnome-search-tool/script.py
+++ b/src/orca/scripts/apps/gnome-search-tool/script.py
@@ -108,9 +108,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
diff --git a/src/orca/scripts/apps/liferea/script.py b/src/orca/scripts/apps/liferea/script.py
index 29dca94..927cb2b 100644
--- a/src/orca/scripts/apps/liferea/script.py
+++ b/src/orca/scripts/apps/liferea/script.py
@@ -86,9 +86,8 @@ class Script(default.Script):
brailleGen = self.brailleGenerator
speechGen = self.speechGenerator
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# [[[TODO - JD: what follows here should be replaced with methods
# in this script's speech and braille generators. That will require
diff --git a/src/orca/scripts/apps/nautilus/script.py b/src/orca/scripts/apps/nautilus/script.py
index 72c19fc..22829b1 100644
--- a/src/orca/scripts/apps/nautilus/script.py
+++ b/src/orca/scripts/apps/nautilus/script.py
@@ -149,9 +149,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
if event.source.getRole() == pyatspi.ROLE_FRAME:
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index b77daed..06a200c 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -1315,10 +1315,8 @@ class Script(default.Script):
"""
brailleGen = self.brailleGenerator
-
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
@@ -1609,9 +1607,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
@@ -1659,9 +1656,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
@@ -2013,9 +2009,8 @@ class Script(default.Script):
- event: the Event
"""
- debug.printObjectEvent(self.debugLevel,
- event,
- debug.getAccessibleDetails(event.source))
+ details = debug.getAccessibleDetails(self.debugLevel, event.source)
+ debug.printObjectEvent(self.debugLevel, event, details)
# self.printAncestry(event.source)
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py b/src/orca/scripts/apps/soffice/script_utilities.py
index 901b1c8..15f293a 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -83,9 +83,10 @@ class Utilities(script_utilities.Utilities):
state = obj.getState()
readOnly = state.contains(pyatspi.STATE_FOCUSABLE) \
and not state.contains(pyatspi.STATE_EDITABLE)
+ details = debug.getAccessibleDetails(debug.LEVEL_ALL, obj)
debug.println(debug.LEVEL_ALL,
- "soffice - isReadOnlyTextArea=%s for %s" \
- % (readOnly, debug.getAccessibleDetails(obj)))
+ "soffice - isReadOnlyTextArea=%s for %s" % \
+ (readOnly, details))
return readOnly
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index e3270da..86691d1 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -273,9 +273,10 @@ class Utilities(script_utilities.Utilities):
state = obj.getState()
readOnly = state.contains(pyatspi.STATE_FOCUSABLE) \
and not state.contains(pyatspi.STATE_EDITABLE)
+ details = debug.getAccessibleDetails(debug.LEVEL_ALL, obj)
debug.println(debug.LEVEL_ALL,
"Gecko - isReadOnlyTextArea=%s for %s" \
- % (readOnly, debug.getAccessibleDetails(obj)))
+ % (readOnly, details))
return readOnly
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]