orca r4507 - in trunk: . src/orca src/orca/scripts/toolkits/Gecko



Author: wwalker
Date: Sun Feb  8 19:37:37 2009
New Revision: 4507
URL: http://svn.gnome.org/viewvc/orca?rev=4507&view=rev

Log:
Fix for bug #555540 - Add support for additional landmark roles


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/toolkits/Gecko/script.py
   trunk/src/orca/scripts/toolkits/Gecko/script_settings.py
   trunk/src/orca/settings.py
   trunk/src/orca/structural_navigation.py

Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py	Sun Feb  8 19:37:37 2009
@@ -2903,7 +2903,9 @@
         attrs = self._getAttrDictionary(orca_state.locusOfFocus)
         try:
             # ARIA landmark widgets
-            if attrs['xml-roles'] in script_settings.ARIA_LANDMARKS:
+            import sets
+            if sets.Set(attrs['xml-roles'].split()).intersection(\
+               sets.Set(settings.ariaLandmarks)):
                 return True
             # ARIA live region
             elif 'container-live' in attrs:
@@ -2978,19 +2980,19 @@
                 if 'xml-roles' in attrs:
                     # This eliminates all ARIA widgets that are not
                     # considered live
-                    if attrs['xml-roles'] != 'alert' \
-                               and attrs['xml-roles'] != 'tooltip':
+                    attrList = attrs['xml-roles'].split()
+                    if not 'alert' in attrList \
+                       and not 'tooltip' in attrList:
                         return False
                     # Only present tooltips when user wants them presented
-                    elif attrs['xml-roles'] == 'tooltip' \
-                                   and not settings.presentToolTips:
+                    elif 'tooltip' in attrList and not settings.presentToolTips:
                         return False
             else:
                 # Some alerts have been seen without the :system postfix.
                 # We will take care of them separately.
                 attrs = self._getAttrDictionary(event.any_data)
                 if 'xml-roles' in attrs \
-                                      and attrs['xml-roles'] == 'alert':
+                   and 'alert' in attrs['xml-roles'].split():
                     return True
                 else:
                     return False

Modified: trunk/src/orca/scripts/toolkits/Gecko/script_settings.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script_settings.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script_settings.py	Sun Feb  8 19:37:37 2009
@@ -68,6 +68,3 @@
 # that may be too verbose so it's configurable.
 #
 onlySpeakChangedLinesDuringFind = False
-
-ARIA_LANDMARKS = ["banner", "contentinfo", "definition", "main", "navigation",
-                  "note", "search", "secondary", "seealso"]

Modified: trunk/src/orca/settings.py
==============================================================================
--- trunk/src/orca/settings.py	(original)
+++ trunk/src/orca/settings.py	Sun Feb  8 19:37:37 2009
@@ -720,6 +720,30 @@
 #
 repeatCharacterLimit = 4
 
+# Tags associated with ARIA landmarks.
+#
+ariaLandmarks = [
+    "application",
+    "article",
+    "banner",
+    "complementary",
+    "contentinfo",
+    "definition",
+    "directory",
+    "document",
+    "grid",
+    "log",
+    "main",
+    "menubar",
+    "navigation",
+    "note",
+    "region",
+    "search",
+    "secondary",
+    "seealso",
+    "status",
+]
+
 # Script developer feature.  If False, just the default script
 # will be used.  Helps determine difference between custom
 # scripts and the default script behavior.

Modified: trunk/src/orca/structural_navigation.py
==============================================================================
--- trunk/src/orca/structural_navigation.py	(original)
+++ trunk/src/orca/structural_navigation.py	Sun Feb  8 19:37:37 2009
@@ -471,12 +471,6 @@
                   pyatspi.ROLE_SPIN_BUTTON,
                   pyatspi.ROLE_TEXT]
 
-    # Tags associated with ARIA landmarks.
-    #
-    ARIA_LANDMARKS = ["banner", "contentinfo", "definition", "main",
-                      "navigation", "note", "search", "secondary",
-                      "seealso"]
-
     # Roles which are recognized as being potential "large objects"
     # or "chunks." Note that this refers to AT-SPI roles.
     #
@@ -2665,8 +2659,18 @@
           the criteria (e.g. the level of a heading).
         """
 
+        # NOTE: there is a limitation in the AT-SPI Collections interface
+        # when it comes to an attribute whose value can be a list.  For
+        # example, the xml-roles attribute can be a space-separate list
+        # of roles.  We'd like to make a match if the xml-roles attribute
+        # has one (or any) of the roles we care about.  Instead, we're
+        # restricted to an exact match.  So, the below will only work in 
+        # the cases where the xml-roles attribute value consists solely of a
+        # single role.  In practice, this seems to be the case that we run
+        # into for the landmark roles.
+        #
         attrs = []
-        for landmark in self.ARIA_LANDMARKS:
+        for landmark in settings.ariaLandmarks:
             attrs.append('xml-roles:' + landmark)
 
         return MatchCriteria(collection, objAttrs=attrs)
@@ -2686,7 +2690,9 @@
 
         attrs = dict([attr.split(':', 1) for attr in obj.getAttributes()])
         try:
-            if attrs['xml-roles'] in self.ARIA_LANDMARKS:
+            import sets
+            if sets.Set(attrs['xml-roles']).intersection(\
+                sets.Set(settings.ariaLandmarks)):
                 return True
             else:
                 return False



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