[orca] Fix for bug 640500 - Orca presents too much info for some links; not enough info for others in WebKi



commit b181c774e940d2fb390be26fd430b8a121392a94
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Jan 24 20:41:14 2011 -0500

    Fix for bug 640500 - Orca presents too much info for some links; not enough info for others in WebKitGtk

 .../toolkits/WebKitGtk/braille_generator.py        |   19 +++++++++++++
 src/orca/scripts/toolkits/WebKitGtk/script.py      |   28 ++++++++++++++++++++
 .../scripts/toolkits/WebKitGtk/speech_generator.py |   19 +++++++++++++
 3 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py b/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py
index de980c7..a5bd3cc 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py
@@ -65,3 +65,22 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
                 self, obj, **args))
 
         return result
+
+    def _generateAncestors(self, obj, **args):
+        """Returns an array of strings (and possibly voice and audio
+        specifications) that represent the text of the ancestors for
+        the object.  This is typically used to present the context for
+        an object (e.g., the names of the window, the panels, etc.,
+        that the object is contained in).  If the 'priorObj' attribute
+        of the args dictionary is set, only the differences in
+        ancestry between the 'priorObj' and the current obj will be
+        computed.  The 'priorObj' is typically set by Orca to be the
+        previous object with focus.
+        """
+
+        role = args.get('role', obj.getRole())
+        if role == pyatspi.ROLE_LINK:
+            return []
+
+        return braille_generator.BrailleGenerator._generateAncestors(
+            self, obj, **args)
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 1489c04..6caadd3 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -106,9 +106,34 @@ class Script(default.Script):
         - event: the Event
         """
 
+        lastKey, mods = self.utilities.lastKeyAndModifiers()
+        if lastKey in ['Tab', 'ISO_Left_Tab']:
+            return
+
         orca.setLocusOfFocus(event, event.source, False)
         default.Script.onCaretMoved(self, event)
 
+    def onFocus(self, event):
+        """Called whenever an object gets focus.
+
+        Arguments:
+        - event: the Event
+        """
+
+        obj = event.source
+        role = obj.getRole()
+        if role == pyatspi.ROLE_LIST_ITEM and obj.childCount:
+            return
+
+        textRoles = [pyatspi.ROLE_HEADING,
+                     pyatspi.ROLE_PANEL,
+                     pyatspi.ROLE_PARAGRAPH,
+                     pyatspi.ROLE_SECTION]
+        if role in textRoles:
+            return
+
+        default.Script.onFocus(self, event)
+
     def onTextSelectionChanged(self, event):
         """Called when an object's text selection changes.
 
@@ -165,6 +190,9 @@ class Script(default.Script):
 
         if event.type.startswith('object:state-changed:focused') \
            and event.detail1:
+            if event.source.getRole() == pyatspi.ROLE_LINK:
+                return False
+
             lastKey, mods = self.utilities.lastKeyAndModifiers()
             if lastKey in self.CARET_NAVIGATION_KEYS:
                 return True
diff --git a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
index d7aa8d9..bb6c464 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
@@ -95,3 +95,22 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
                 result.extend(acss)
 
         return result
+
+    def _generateAncestors(self, obj, **args):
+        """Returns an array of strings (and possibly voice and audio
+        specifications) that represent the text of the ancestors for
+        the object.  This is typically used to present the context for
+        an object (e.g., the names of the window, the panels, etc.,
+        that the object is contained in).  If the 'priorObj' attribute
+        of the args dictionary is set, only the differences in
+        ancestry between the 'priorObj' and the current obj will be
+        computed.  The 'priorObj' is typically set by Orca to be the
+        previous object with focus.
+        """
+
+        role = args.get('role', obj.getRole())
+        if role == pyatspi.ROLE_LINK:
+            return []
+
+        return speech_generator.SpeechGenerator._generateAncestors(
+            self, obj, **args)



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