[orca] Handle change in LO's accessibility tree for dialogs



commit f72072c3bc9321fbcae8d9f6ef8127c6c387adab
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Dec 9 13:12:23 2016 -0500

    Handle change in LO's accessibility tree for dialogs

 src/orca/scripts/apps/soffice/spellcheck.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/spellcheck.py b/src/orca/scripts/apps/soffice/spellcheck.py
index c67a34c..3b8cce0 100644
--- a/src/orca/scripts/apps/soffice/spellcheck.py
+++ b/src/orca/scripts/apps/soffice/spellcheck.py
@@ -39,14 +39,27 @@ class SpellCheck(spellcheck.SpellCheck):
     def __init__(self, script):
         super().__init__(script, hasChangeToEntry=False)
 
+    def _findChildDialog(self, root):
+        if not root:
+            return None
+
+        if root.getRole() == pyatspi.ROLE_DIALOG:
+            return root
+
+        if root.childCount:
+            return self._findChildDialog(root[0])
+
+        return None
+
     def _isCandidateWindow(self, window):
         if self._script.utilities.isDead(window):
             msg = "SOFFICE: %s is not candidate window because it's dead." % window
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
+
         if window and window.childCount and window.getRole() == pyatspi.ROLE_FRAME:
-            child = window[0]
-            if child.getRole() == pyatspi.ROLE_DIALOG:
+            child = self._findChildDialog(window[0])
+            if child and child.getRole() == pyatspi.ROLE_DIALOG:
                 isPageTabList = lambda x: x and x.getRole() == pyatspi.ROLE_PAGE_TAB_LIST
                 if not pyatspi.findDescendant(child, isPageTabList):
                     return True


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