[orca] Filter out more objects for which we do not want unrelated labels



commit cdc908d8a24ca215b8215871c51363e421b1a507
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Sep 10 19:22:16 2015 -0400

    Filter out more objects for which we do not want unrelated labels

 src/orca/script_utilities.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index bbbbd95..1121f78 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1528,9 +1528,12 @@ class Utilities:
 
         return rv
 
-    def hasPageTabList(self, root):
-        isPageTabList = lambda x: x and x.getRole() == pyatspi.ROLE_PAGE_TAB_LIST
-        return pyatspi.findDescendant(root, isPageTabList) is not None
+    def _hasNonDescendableDescendant(self, root):
+        roles = [pyatspi.ROLE_PAGE_TAB_LIST,
+                 pyatspi.ROLE_SPLIT_PANE,
+                 pyatspi.ROLE_TABLE]
+        isMatch = lambda x: x and x.getRole() in roles
+        return pyatspi.findDescendant(root, isMatch) is not None
 
     def unrelatedLabels(self, root, onlyShowing=True):
         """Returns a list containing all the unrelated (i.e., have no
@@ -1545,10 +1548,10 @@ class Utilities:
         Returns a list of unrelated labels under the given root.
         """
 
-        if self._script.spellcheck and self._script.spellcheck.isCheckWindow(root):
+        if self._hasNonDescendableDescendant(root):
             return []
 
-        if self.hasPageTabList(root):
+        if self._script.spellcheck and self._script.spellcheck.isCheckWindow(root):
             return []
 
         hasRole = lambda x: x and x.getRole() == pyatspi.ROLE_LABEL


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