[orca] Do not braille roles for (un)ordered list items and non-focusable panels in Gecko



commit d75ef84d7cb090736260c6aab869c5a7b1fdaad4
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jan 16 07:27:09 2014 -0500

    Do not braille roles for (un)ordered list items and non-focusable panels in Gecko

 .../scripts/toolkits/Gecko/braille_generator.py    |   24 +++++++++++++------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/braille_generator.py 
b/src/orca/scripts/toolkits/Gecko/braille_generator.py
index ae545b3..9109bd4 100644
--- a/src/orca/scripts/toolkits/Gecko/braille_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/braille_generator.py
@@ -64,15 +64,23 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
         return imageLink
 
     def _generateRoleName(self, obj, **args):
-        """Prevents some roles from being spoken."""
-        result = []
+        """Prevents some roles from being displayed."""
+
+        doNotDisplay = [pyatspi.ROLE_FORM,
+                        pyatspi.ROLE_SECTION,
+                        pyatspi.ROLE_UNKNOWN]
+
+        if not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
+            doNotDisplay.extend([pyatspi.ROLE_LIST,
+                                 pyatspi.ROLE_LIST_ITEM,
+                                 pyatspi.ROLE_PANEL])
+
         role = args.get('role', obj.getRole())
-        if not obj.getRole() in [pyatspi.ROLE_SECTION,
-                                 pyatspi.ROLE_FORM,
-                                 pyatspi.ROLE_UNKNOWN]:
-            result.extend(braille_generator.BrailleGenerator._generateRoleName(
-                self, obj, **args))
-        return result
+        if role in doNotDisplay:
+            return []
+
+        return braille_generator.BrailleGenerator._generateRoleName(
+            self, obj, **args)
 
     def _generateName(self, obj, **args):
         result = []


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