[orca] Don't present rolename for desktop



commit c89a16599c43679a3e2699c13c987f65e13d3956
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Jun 6 12:17:37 2018 +0200

    Don't present rolename for desktop
    
    Note: This requires the desktop to explicitly indicate it is the
    desktop via the is-desktop object attribute.

 src/orca/script_utilities.py | 20 ++++++++++++++++++++
 src/orca/speech_generator.py |  3 +++
 2 files changed, 23 insertions(+)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index d0fbd3947..7c81716d6 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -686,6 +686,26 @@ class Utilities:
     def isAnchor(self, obj):
         return False
 
+    def isDesktop(self, obj):
+        try:
+            role = obj.getRole()
+        except:
+            msg = 'ERROR: Exception getting role of %s' % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
+        if role != pyatspi.ROLE_FRAME:
+            return False
+
+        try:
+            attrs = dict([attr.split(':', 1) for attr in obj.getAttributes()])
+        except:
+            msg = 'ERROR: Exception getting attributes of %s' % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
+        return attrs.get('is-desktop') == 'true'
+
     def isComboBoxWithToggleDescendant(self, obj):
         return False
 
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 4737c1fd7..a308bb0a9 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -357,6 +357,9 @@ class SpeechGenerator(generator.Generator):
         if self._script.utilities.isStatusBarNotification(obj):
             return []
 
+        if self._script.utilities.isDesktop(obj):
+            return []
+
         result = []
         acss = self.voice(SYSTEM)
         role = args.get('role', obj.getRole())


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