orca r4287 - in trunk: . src/orca/scripts/apps src/orca/scripts/toolkits/Gecko
- From: joanied svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4287 - in trunk: . src/orca/scripts/apps src/orca/scripts/toolkits/Gecko
- Date: Tue, 14 Oct 2008 17:36:53 +0000 (UTC)
Author: joanied
Date: Tue Oct 14 17:36:52 2008
New Revision: 4287
URL: http://svn.gnome.org/viewvc/orca?rev=4287&view=rev
Log:
* src/orca/scripts/toolkits/Gecko/script.py:
src/orca/scripts/apps/yelp.py:
Fix for bug #553877 - Need to implement FF find functionality for
Yelp.
Modified:
trunk/ChangeLog
trunk/src/orca/scripts/apps/yelp.py
trunk/src/orca/scripts/toolkits/Gecko/script.py
Modified: trunk/src/orca/scripts/apps/yelp.py
==============================================================================
--- trunk/src/orca/scripts/apps/yelp.py (original)
+++ trunk/src/orca/scripts/apps/yelp.py Tue Oct 14 17:36:52 2008
@@ -51,6 +51,29 @@
#
self._currentFrameName = ""
+ # When the user presses Escape to leave the Find tool bar, we do not
+ # seem to get any events for the document frame reclaiming focus. If
+ # we try to get the caret context, getDocumentFrame() returns None.
+ # Store a copy of the context so that we can return it.
+ #
+ self._lastFindContext = [None, -1]
+
+ def inFindToolbar(self, obj=None):
+ """Returns True if the given object is in the Find toolbar.
+
+ Arguments:
+ - obj: an accessible object
+ """
+
+ if not obj:
+ obj = orca_state.locusOfFocus
+
+ if obj and obj.getRole() == pyatspi.ROLE_TEXT \
+ and obj.parent.getRole() == pyatspi.ROLE_FILLER:
+ return True
+
+ return False
+
def getDocumentFrame(self):
"""Returns the document frame that holds the content being shown."""
@@ -73,6 +96,9 @@
#
return None
else:
+ if self.inFindToolbar():
+ obj = self._lastFindContext[0]
+
# We might be in some content. In this case, look up.
#
return self.getAncestor(obj,
@@ -87,6 +113,9 @@
- event: the Event
"""
+ if self.inFindToolbar() and not self.inFindToolbar(event.source):
+ self._lastFindContext = [event.source, event.detail1]
+
# Unlike the unpredictable wild, wild web, odds are good that a
# caret-moved event from document content in Yelp is valid. But
# depending upon the locusOfFocus at the time this event is issued
@@ -94,7 +123,7 @@
# Rather than risk breaking access to web content, we'll just set
# the locusOfFocus here before sending this event on.
#
- if self.inDocumentContent(event.source):
+ elif self.inDocumentContent(event.source):
obj = event.source
characterOffset = event.detail1
@@ -135,6 +164,17 @@
- event: the Event
"""
+ # When the Find toolbar gives up focus because the user closed
+ # it, Yelp's normal behavior is often to give focus to something
+ # not especially useful to a user who is blind, like the Back
+ # button. For now, let's stop that from happening.
+ #
+ if event.type.startswith("object:state-changed:showing") \
+ and not event.detail1 and self.inFindToolbar(event.source):
+ [obj, characterOffset] = self._lastFindContext
+ self._lastFindContext = [None, -1]
+ self.setCaretPosition(obj, characterOffset)
+
if event.type.startswith("object:state-changed:busy") \
and event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME \
and not event.detail1:
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 Tue Oct 14 17:36:52 2008
@@ -1334,8 +1334,7 @@
# If we're in the Find toolbar, we also want to present
# the results.
#
- parent = orca_state.locusOfFocus.parent
- if parent and parent.getRole() == pyatspi.ROLE_TOOL_BAR:
+ if self.inFindToolbar():
self.presentFindResults(event.source, event.detail1)
else:
self.setCaretContext(event.source, event.detail1)
@@ -1878,9 +1877,7 @@
# If we've just landed in the Find toolbar, reset
# self.madeFindAnnouncement.
#
- if newLocusOfFocus and \
- newLocusOfFocus.getRole() == pyatspi.ROLE_ENTRY and \
- newLocusOfFocus.parent.getRole() == pyatspi.ROLE_TOOL_BAR:
+ if newLocusOfFocus and self.inFindToolbar(newLocusOfFocus):
self.madeFindAnnouncement = False
# We'll ignore focus changes when the document frame is busy.
@@ -2491,6 +2488,22 @@
return None
+ def inFindToolbar(self, obj=None):
+ """Returns True if the given object is in the Find toolbar.
+
+ Arguments:
+ - obj: an accessible object
+ """
+
+ if not obj:
+ obj = orca_state.locusOfFocus
+
+ if obj and obj.getRole() == pyatspi.ROLE_ENTRY \
+ and obj.parent.getRole() == pyatspi.ROLE_TOOL_BAR:
+ return True
+
+ return False
+
def inDocumentContent(self, obj=None):
"""Returns True if the given object (defaults to the current
locus of focus is in the document content).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]