[orca] Eliminate some chattiness with popup button elements



commit e53907c194fe437e0db6758d80dd91389a0f7f9b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Aug 28 13:57:29 2019 -0400

    Eliminate some chattiness with popup button elements

 src/orca/script_utilities.py             | 14 ++++++++++++++
 src/orca/scripts/web/script_utilities.py |  2 +-
 src/orca/speech_generator.py             |  2 ++
 3 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 033023908..26ebc5004 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -3729,6 +3729,20 @@ class Utilities:
 
         return None
 
+    def isButtonWithPopup(self, obj):
+        if not obj:
+            return False
+
+        try:
+            role = obj.getRole()
+            state = obj.getState()
+        except:
+            msg = "ERROR: Exception getting role and state for %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
+        return role == pyatspi.ROLE_PUSH_BUTTON and state.contains(pyatspi.STATE_HAS_POPUP)
+
     def isMenuButton(self, obj):
         if not obj:
             return False
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9f72926c6..d1705ab96 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1864,7 +1864,7 @@ class Utilities(script_utilities.Utilities):
            and self.isLayoutOnly(self.getTable(obj)):
             return False
 
-        if role == pyatspi.ROLE_PUSH_BUTTON and state.contains(pyatspi.STATE_HAS_POPUP):
+        if self.isButtonWithPopup(obj):
             return True
 
         focusModeRoles = [pyatspi.ROLE_EMBEDDED,
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 6a7b6ae21..7937d789f 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1792,6 +1792,8 @@ class SpeechGenerator(generator.Generator):
                 pass
             elif self._script.utilities.isLayoutOnly(parent):
                 pass
+            elif self._script.utilities.isButtonWithPopup(parent):
+                pass
             elif parent != commonAncestor or presentCommonAncestor:
                 ancestors.append(parent)
                 ancestorRoles.append(parentRole)


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