[orca] Validate reportedly selected children - needed for Evolution (at least)



commit 8004bddb75b6c737342e2357c4726147260f3397
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Jan 21 01:47:32 2015 -0500

    Validate reportedly selected children - needed for Evolution (at least)
    
    When Evo's Mail Folders Tree gets focus, it reports having selected
    children via the accessible selection interface. We were trusting that
    those children were not dead, defunct, or otherwise bogus. As a result,
    we were presenting nothing. This needs to be fixed in Evo, but doing a
    sanity check will at least cause Orca to present the tree table.

 src/orca/script_utilities.py                       |   30 ++++++++++++++++++-
 .../scripts/toolkits/Gecko/script_utilities.py     |   20 -------------
 2 files changed, 28 insertions(+), 22 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index db6ef92..dc62c0d 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2743,9 +2743,15 @@ class Utilities:
         except:
             return []
 
+        count = selection.nSelectedChildren
+        msg = "INFO: %s reports %i selected children" % (obj, count)
+        debug.println(debug.LEVEL_INFO, msg)
+
         children = []
-        for x in range(selection.nSelectedChildren):
-            children.append(selection.getSelectedChild(x))
+        for x in range(count):
+            child = selection.getSelectedChild(x)
+            if not self.isZombie(child):
+                children.append(child)
 
         return children
 
@@ -2842,3 +2848,23 @@ class Utilities:
 
         index = self.cellIndex(obj)
         return table.getRowAtIndex(index), table.getColumnHeader(index)
+
+    def isZombie(self, obj):
+        try:
+            index = obj.getIndexInParent()
+            state = obj.getState()
+        except:
+            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s is null or dead" % obj)
+            return True
+
+        if obj.getIndexInParent() == -1:
+            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s's index is -1" % obj)
+            return True
+        if state.contains(pyatspi.STATE_DEFUNCT):
+            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s is defunct" % obj)
+            return True
+        if state.contains(pyatspi.STATE_INVALID):
+            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s is invalid" % obj)
+            return True
+
+        return False
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index 64297a7..fe7403b 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -1177,26 +1177,6 @@ class Utilities(script_utilities.Utilities):
 
         return False
 
-    def isZombie(self, obj):
-        try:
-            index = obj.getIndexInParent()
-            state = obj.getState()
-        except:
-            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s is null or dead" % obj)
-            return True
-
-        if obj.getIndexInParent() == -1:
-            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s's index is -1" % obj)
-            return True
-        if state.contains(pyatspi.STATE_DEFUNCT):
-            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s is defunct" % obj)
-            return True
-        if state.contains(pyatspi.STATE_INVALID):
-            debug.println(debug.LEVEL_INFO, "ZOMBIE: %s is invalid" % obj)
-            return True
-
-        return False
-
     def findReplicant(self, root, obj):
         if not (root and obj):
             return None


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]