[orca] Attempt to work around bad index in parent for switcher object



commit bebfd327679d07ae913e26204330dd60b18f6c0d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Mar 7 11:06:13 2019 +0100

    Attempt to work around bad index in parent for switcher object

 src/orca/scripts/switcher/script_utilities.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/src/orca/scripts/switcher/script_utilities.py b/src/orca/scripts/switcher/script_utilities.py
index c0d26fdf9..fdf783cbf 100644
--- a/src/orca/scripts/switcher/script_utilities.py
+++ b/src/orca/scripts/switcher/script_utilities.py
@@ -26,6 +26,7 @@ __license__   = "LGPL"
 
 import pyatspi
 
+from orca import debug
 from orca import script_utilities
 
 
@@ -57,3 +58,26 @@ class Utilities(script_utilities.Utilities):
             return container.name
 
         return ""
+
+    def isZombie(self, obj):
+        if not super().isZombie(obj):
+            return False
+
+        try:
+            index = obj.getIndexInParent()
+        except:
+            msg = "SWITCHER: Exception getting index in parent for %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
+        if index >= 0:
+            return True
+
+        if self.isShowingAndVisible(obj):
+            msg = "SWITCHER: Ignoring bad index of %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
+        msg = "SWITCHER: %s has bad index and isn't showing and visible" % obj
+        debug.println(debug.LEVEL_INFO, msg, True)
+        return True


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