[orca/gnome-2-28] More work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML cont



commit 83f4e8468e28b9c0ca812815b3e956c6ead2573b
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Nov 15 13:22:07 2009 -0500

    More work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML container
    
    This solves some really annoying "chattiness" that occurs when arrowing into
    or out of a link.

 src/orca/scripts/apps/packagemanager/script.py |   34 ++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/packagemanager/script.py b/src/orca/scripts/apps/packagemanager/script.py
index 46cd354..24be5c0 100644
--- a/src/orca/scripts/apps/packagemanager/script.py
+++ b/src/orca/scripts/apps/packagemanager/script.py
@@ -29,6 +29,7 @@ import pyatspi
 
 import orca.braille as braille
 import orca.default as default
+import orca.input_event as input_event
 import orca.orca as orca
 import orca.orca_state as orca_state
 import orca.settings as settings
@@ -82,6 +83,28 @@ class Script(default.Script):
 
         return TutorialGenerator(self)
 
+    def locusOfFocusChanged(self, event, oldLocusOfFocus, newLocusOfFocus):
+        """Called when the visual object with focus changes.
+
+        Arguments:
+        - event: if not None, the Event that caused the change
+        - oldLocusOfFocus: Accessible that is the old locus of focus
+        - newLocusOfFocus: Accessible that is the new locus of focus
+        """
+
+        # Prevent chattiness when arrowing out of or into a link.
+        #
+        if isinstance(orca_state.lastInputEvent, input_event.KeyboardEvent) \
+           and orca_state.lastNonModifierKeyEvent.event_string in \
+               ["Left", "Right", "Up", "Down"] \
+           and event and event.type.startswith("focus:") \
+           and (self.isLink(oldLocusOfFocus) or self.isLink(newLocusOfFocus)):
+            orca.setLocusOfFocus(event, newLocusOfFocus, False)
+            return
+
+        default.Script.locusOfFocusChanged(
+            self, event, oldLocusOfFocus, newLocusOfFocus)
+
     def onCaretMoved(self, event):
         """Called whenever the caret moves.
 
@@ -89,6 +112,14 @@ class Script(default.Script):
         - event: the Event
         """
 
+        # When arrowing into a link, we get a focus: event followed by two
+        # identical caret-moved events.
+        #
+        lastPos = self.pointOfReference.get("lastCursorPosition")
+        if lastPos and lastPos[0] == event.source \
+           and lastPos[1] == event.detail1:
+            return
+
         # Quietly set the locusOfFocus in HTML containers so that the default
         # script doesn't ignore this event.
         #
@@ -412,6 +443,9 @@ class Script(default.Script):
         - obj: an accessible
         """
 
+        if not obj:
+            return False
+
         # Images seem to be exposed as ROLE_PANEL and implement very few of
         # the accessibility interfaces.
         #



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