[orca] Rename inFindToolbar to inFindContainer



commit e059fbc95a55ea753a0094942b2d9591b3138b75
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Aug 1 14:51:40 2019 -0400

    Rename inFindToolbar to inFindContainer

 src/orca/script_utilities.py                           |  8 +-------
 src/orca/scripts/toolkits/Chromium/script_utilities.py | 18 ++++++++----------
 src/orca/scripts/web/script.py                         |  6 +++---
 src/orca/scripts/web/script_utilities.py               |  6 ++++--
 src/orca/speech_generator.py                           |  4 ++--
 5 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 607ebe5f0..6a81c8ccc 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -701,13 +701,7 @@ class Utilities:
 
         return True
 
-    def inFindToolbar(self, obj=None):
-        """Returns True if the given object is in the Find toolbar.
-
-        Arguments:
-        - obj: an accessible object
-        """
-
+    def inFindContainer(self, obj=None):
         if not obj:
             obj = orca_state.locusOfFocus
 
diff --git a/src/orca/scripts/toolkits/Chromium/script_utilities.py 
b/src/orca/scripts/toolkits/Chromium/script_utilities.py
index 76c30f928..f82020d80 100644
--- a/src/orca/scripts/toolkits/Chromium/script_utilities.py
+++ b/src/orca/scripts/toolkits/Chromium/script_utilities.py
@@ -48,7 +48,6 @@ class Utilities(web.Utilities):
         self._isPseudoElement = {}
         self._isListItemMarker = {}
         self._topLevelObject = {}
-        self._findDialog = None
 
     def clearCachedObjects(self):
         super().clearCachedObjects()
@@ -56,7 +55,6 @@ class Utilities(web.Utilities):
         self._isPseudoElement = {}
         self._isListItemMarker = {}
         self._topLevelObject = {}
-        self._findDialog = None
 
     def isStaticTextLeaf(self, obj):
         if not (obj and self.inDocumentContent(obj)):
@@ -271,7 +269,7 @@ class Utilities(web.Utilities):
 
         result = super().topLevelObject(obj)
         if result and result.getRole() in self._topLevelRoles():
-            if not self.isFindDialog(result):
+            if not self.isFindContainer(result):
                 return result
             else:
                 msg = "CHROMIUM: Top level object for %s is %s" % (obj, result.parent)
@@ -366,7 +364,7 @@ class Utilities(web.Utilities):
         return super().handleAsLiveRegion(event)
 
     def getFindResultsCount(self, root=None):
-        root = root or self._findDialog
+        root = root or self._findContainer
         if not root:
             return ""
 
@@ -382,11 +380,11 @@ class Utilities(web.Utilities):
 
         return ""
 
-    def isFindDialog(self, obj):
+    def isFindContainer(self, obj):
         if not obj or self.inDocumentContent(obj):
             return False
 
-        if obj == self._findDialog:
+        if obj == self._findContainer:
             return True
 
         if obj.getRole() != pyatspi.ROLE_DIALOG:
@@ -396,7 +394,7 @@ class Utilities(web.Utilities):
         if result:
             msg = "CHROMIUM: %s believed to be find-in-page dialog (%s)" % (obj, result)
             debug.println(debug.LEVEL_INFO, msg, True)
-            self._findDialog = obj
+            self._findContainer = obj
             return True
 
         # When there are no results due to the absence of a search term, the status
@@ -423,10 +421,10 @@ class Utilities(web.Utilities):
 
         msg = "CHROMIUM: %s believed to be find-in-page dialog (accessibility tree)" % obj
         debug.println(debug.LEVEL_INFO, msg, True)
-        self._findDialog = obj
+        self._findContainer = obj
         return True
 
-    def inFindToolbar(self, obj=None):
+    def inFindContainer(self, obj=None):
         if not obj:
             obj = orca_state.locusOfFocus
 
@@ -437,7 +435,7 @@ class Utilities(web.Utilities):
             return False
 
         isDialog = lambda x: x and x.getRole() == pyatspi.ROLE_DIALOG
-        result = self.isFindDialog(pyatspi.findAncestor(obj, isDialog))
+        result = self.isFindContainer(pyatspi.findAncestor(obj, isDialog))
         if result:
             msg = "CHROMIUM: %s believed to be find-in-page widget" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 7e05855d2..0de3bc35c 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1184,7 +1184,7 @@ class Script(default.Script):
             return False
 
         caretOffset = 0
-        if self.utilities.inFindToolbar(oldFocus) \
+        if self.utilities.inFindContainer(oldFocus) \
            or (self.utilities.isDocument(newFocus) and oldFocus == orca_state.activeWindow):
             contextObj, contextOffset = self.utilities.getCaretContext()
             if contextObj and not self.utilities.isZombie(contextObj):
@@ -1440,7 +1440,7 @@ class Script(default.Script):
                 self.updateBraille(event.source)
             return True
 
-        if self.utilities.inFindToolbar():
+        if self.utilities.inFindContainer():
             msg = "WEB: Event handled: Presenting find results"
             debug.println(debug.LEVEL_INFO, msg, True)
             self.presentFindResults(event.source, event.detail1)
@@ -1799,7 +1799,7 @@ class Script(default.Script):
 
             obj, offset = self.utilities.searchForCaretContext(event.source)
             if obj:
-                notify = self.utilities.inFindToolbar(orca_state.locusOfFocus) \
+                notify = self.utilities.inFindContainer(orca_state.locusOfFocus) \
                     or self.utilities.isFocusModeWidget(obj)
                 msg = "WEB: Updating focus and context to %s, %i" % (obj, offset)
                 debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index f09dcfd45..df5f08e63 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -119,6 +119,7 @@ class Utilities(script_utilities.Utilities):
         self._currentWordContents = None
         self._currentCharacterContents = None
         self._lastQueuedLiveRegionEvent = None
+        self._findContainer = None
 
         self._validChildRoles = {pyatspi.ROLE_LIST: [pyatspi.ROLE_LIST_ITEM]}
 
@@ -196,6 +197,7 @@ class Utilities(script_utilities.Utilities):
         self._cleanupContexts()
         self._priorContexts = {}
         self._lastQueuedLiveRegionEvent = None
+        self._findContainer = None
 
     def clearContentCache(self):
         self._currentObjectContents = None
@@ -637,14 +639,14 @@ class Utilities(script_utilities.Utilities):
         self._xmlRoles[hash(obj)] = rv
         return rv
 
-    def inFindToolbar(self, obj=None):
+    def inFindContainer(self, obj=None):
         if not obj:
             obj = orca_state.locusOfFocus
 
         if self.inDocumentContent(obj):
             return False
 
-        return super().inFindToolbar(obj)
+        return super().inFindContainer(obj)
 
     def isEmpty(self, obj):
         if not self.isTextBlockElement(obj):
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 3ecb68f8f..4d7bfc9aa 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1823,7 +1823,7 @@ class SpeechGenerator(generator.Generator):
         if _settingsManager.getSetting('onlySpeakDisplayedText'):
             return []
 
-        if self._script.utilities.inFindToolbar():
+        if self._script.utilities.inFindContainer():
             return []
 
         priorObj = args.get('priorObj')
@@ -1881,7 +1881,7 @@ class SpeechGenerator(generator.Generator):
         if _settingsManager.getSetting('onlySpeakDisplayedText'):
             return []
 
-        if self._script.utilities.inFindToolbar():
+        if self._script.utilities.inFindContainer():
             return []
 
         priorObj = args.get('priorObj')


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