[orca/570658] Cache realActiveDescendant
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] Cache realActiveDescendant
- Date: Sat, 4 Jul 2009 08:41:53 +0000 (UTC)
commit a563bea99edff2b6a94d3a28b0b1fc4c5c866d74
Author: Willie Walker <william walker sun com>
Date: Sat Jul 4 03:55:44 2009 -0400
Cache realActiveDescendant
src/orca/default.py | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index 0be44cd..06d84dd 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -77,6 +77,7 @@ class Script(script.Script):
KEY_BINDING = 'keyBinding'
NESTING_LEVEL = 'nestingLevel'
NODE_LEVEL = 'nodeLevel'
+ REAL_ACTIVE_DESCENDANT = 'realActiveDescendant'
def __init__(self, app):
"""Creates a new script for the given application.
@@ -6245,6 +6246,13 @@ class Script(script.Script):
manages its descendants.
"""
+ try:
+ return self.generatorCache[self.REAL_ACTIVE_DESCENDANT][obj]
+ except:
+ if not self.generatorCache.has_key(self.REAL_ACTIVE_DESCENDANT):
+ self.generatorCache[self.REAL_ACTIVE_DESCENDANT] = {}
+ realActiveDescendant = None
+
# If obj is a table cell and all of it's children are table cells
# (probably cell renderers), then return the first child which has
# a non zero length text string. If no such object is found, just
@@ -6264,7 +6272,7 @@ class Script(script.Script):
continue
else:
if text.getText(0, -1):
- return child
+ realActiveDescendant = child
# [[[TODO: WDW - this is an odd hacky thing I've somewhat drawn
# from Gnopernicus. The notion here is that we get an active
@@ -6281,10 +6289,12 @@ class Script(script.Script):
# comment is here to remind us this is being done in poor taste
# and we need to eventually clean up our act.]]]
#
- if obj and obj.childCount:
- return obj[-1]
- else:
- return obj
+ if not realActiveDescendant and obj and obj.childCount:
+ realActiveDescendant = obj[-1]
+
+ self.generatorCache[self.REAL_ACTIVE_DESCENDANT][obj] = \
+ realActiveDescendant or obj
+ return self.generatorCache[self.REAL_ACTIVE_DESCENDANT][obj]
def isDesiredFocusedItem(self, obj, rolesList):
"""Called to determine if the given object and it's hierarchy of
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]