[orca] Add 'force' parameter to orca.py:setLocusOfFocus
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca] Add 'force' parameter to orca.py:setLocusOfFocus
- Date: Mon, 1 Jun 2009 09:51:01 -0400 (EDT)
commit fef753b475ae97dc536fd226acc5c59ff7047ee7
Author: Willie Walker <william walker sun com>
Date: Mon Jun 1 09:48:43 2009 -0400
Add 'force' parameter to orca.py:setLocusOfFocus
This is to allow us to better support bug #571812 without having
to bypass setLocusOfFocus.
---
ChangeLog | 16 ++++++++++++++++
src/orca/default.py | 3 ++-
src/orca/orca.py | 6 ++++--
src/orca/scripts/apps/Thunderbird/script.py | 11 +++++------
src/orca/scripts/apps/acroread.py | 18 ++++++++++++------
src/orca/scripts/apps/evolution/script.py | 2 +-
src/orca/scripts/apps/gedit/script.py | 3 ++-
src/orca/scripts/apps/soffice/script.py | 11 +++++++----
src/orca/scripts/apps/yelp.py | 6 ++++--
src/orca/scripts/toolkits/Gecko/script.py | 14 ++++++++++----
src/orca/structural_navigation.py | 2 +-
11 files changed, 64 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 119147f..1da5422 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2009-06-01 Willie Walker <william walker sun com>
+ * src/orca/default.py:
+ src/orca/orca.py:
+ src/orca/scripts/apps/Thunderbird/script.py:
+ src/orca/scripts/apps/acroread.py:
+ src/orca/scripts/apps/evolution/script.py:
+ src/orca/scripts/apps/gedit/script.py:
+ src/orca/scripts/apps/soffice/script.py:
+ src/orca/scripts/apps/yelp.py:
+ src/orca/scripts/toolkits/Gecko/script.py:
+ src/orca/structural_navigation.py:
+ Add 'force' parameter to setLocusOfFocus to allow us to
+ force a locus of focus change even if it might be the
+ same object. This is to help better support bug #571812.
+
+2009-06-01 Willie Walker <william walker sun com>
+
* src/orca/speech_generator.py:
Don't speak new column headers when reading a row
diff --git a/src/orca/default.py b/src/orca/default.py
index 69002e4..a1c4e3e 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -2015,7 +2015,8 @@ class Script(script.Script):
text.setCaretOffset(context.currentOffset)
elif progressType == speechserver.SayAllContext.COMPLETED:
#print "COMPLETED", context.utterance, context.currentOffset
- orca.setLocusOfFocus(None, context.obj, False)
+ orca.setLocusOfFocus(
+ None, context.obj, notifyPresentationManager=False)
text.setCaretOffset(context.currentOffset)
# If there is a selection, clear it. See bug #489504 for more details.
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 8d8cd93..c781dea 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -175,7 +175,7 @@ def getScriptForApp(app):
# #
########################################################################
-def setLocusOfFocus(event, obj, notifyPresentationManager=True):
+def setLocusOfFocus(event, obj, notifyPresentationManager=True, force=False):
"""Sets the locus of focus (i.e., the object with visual focus) and
notifies the current presentation manager of the change.
@@ -183,9 +183,11 @@ def setLocusOfFocus(event, obj, notifyPresentationManager=True):
- event: if not None, the Event that caused this to happen
- obj: the Accessible with the new locus of focus.
- notifyPresentationManager: if True, propagate this event
+ - force: if True, don't worry if this is the same object as the
+ current locusOfFocus
"""
- if obj == orca_state.locusOfFocus:
+ if not force and obj == orca_state.locusOfFocus:
return
# If this event is not for the currently active script, then just return.
diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index dc76e4c..2b4d2a4 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -184,7 +184,8 @@ class Script(Gecko.Script):
event.source.getState().contains(pyatspi.STATE_EDITABLE)
if updatePosition:
- orca.setLocusOfFocus(event, event.source, False)
+ orca.setLocusOfFocus(
+ event, event.source, notifyPresentationManager=False)
self.setCaretContext(event.source, event.detail1)
# The Gecko script, should it be about to pass along this
@@ -243,12 +244,10 @@ class Script(Gecko.Script):
# object we're setting the locusOfFocus to is the
# same as the current locusOfFocus is returning
# True when it's not actually True. Therefore,
- # we'll set the current locusOfFocus to None as
- # a precaution.
+ # we'll force the propagation as a precaution.
#
- if event.type.startswith("focus:"):
- orca_state.locusOfFocus = None
- orca.setLocusOfFocus(event, acc)
+ force = event.type.startswith("focus:")
+ orca.setLocusOfFocus(event, acc, force=force)
consume = True
break
diff --git a/src/orca/scripts/apps/acroread.py b/src/orca/scripts/apps/acroread.py
index 94ae5b5..992ce10 100644
--- a/src/orca/scripts/apps/acroread.py
+++ b/src/orca/scripts/apps/acroread.py
@@ -429,10 +429,12 @@ class Script(default.Script):
if newLocusOfFocus.getRole() == pyatspi.ROLE_TEXT:
newText = self.getTextLineAtCaret(newLocusOfFocus)
if newText == self.preFindLine:
- orca.setLocusOfFocus(event, oldLocusOfFocus, False)
+ orca.setLocusOfFocus(
+ event, oldLocusOfFocus, notifyPresentationManager=False)
return
if newLocusOfFocus.getRole() == pyatspi.ROLE_DRAWING_AREA:
- orca.setLocusOfFocus(event, oldLocusOfFocus, False)
+ orca.setLocusOfFocus(
+ event, oldLocusOfFocus, notifyPresentationManager=False)
return
utterances = \
@@ -441,7 +443,8 @@ class Script(default.Script):
brailleRegions = \
self.brailleGenerator.getBrailleRegions(newLocusOfFocus)
braille.displayRegions(brailleRegions)
- orca.setLocusOfFocus(event, newLocusOfFocus, False)
+ orca.setLocusOfFocus(
+ event, newLocusOfFocus, notifyPresentationManager=False)
return
# Eliminate unnecessary chattiness in the Search panel.
@@ -456,7 +459,8 @@ class Script(default.Script):
#
if newLocusOfFocus.getRole() in [self.ROLE_DOCUMENT,
pyatspi.ROLE_DRAWING_AREA]:
- orca.setLocusOfFocus(event, newLocusOfFocus, False)
+ orca.setLocusOfFocus(
+ event, newLocusOfFocus, notifyPresentationManager=False)
return
elif newLocusOfFocus.getRole() == self.ROLE_LINK:
@@ -473,7 +477,8 @@ class Script(default.Script):
brailleRegions = \
self.brailleGenerator.getBrailleRegions(newLocusOfFocus)
braille.displayRegions(brailleRegions)
- orca.setLocusOfFocus(event, newLocusOfFocus, False)
+ orca.setLocusOfFocus(
+ event, newLocusOfFocus, notifyPresentationManager=False)
return
default.Script.locusOfFocusChanged(self, event,
@@ -554,7 +559,8 @@ class Script(default.Script):
brailleRegions = \
self.brailleGenerator.getBrailleRegions(event.source)
braille.displayRegions(brailleRegions)
- orca.setLocusOfFocus(event, event.source, False)
+ orca.setLocusOfFocus(
+ event, event.source, notifyPresentationManager=False)
return
elif event.source.getRole() == pyatspi.ROLE_TEXT:
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 040f34f..df46d4f 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -501,7 +501,7 @@ class Script(default.Script):
#print "COMPLETED", context.utterance, context.currentOffset
obj = context.obj[len(context.obj)-1]
obj.queryText().setCaretOffset(context.currentOffset)
- orca.setLocusOfFocus(None, obj, False)
+ orca.setLocusOfFocus(None, obj, notifyPresentationManager=False)
# If there is a selection, clear it. See bug #489504 for more details.
# This is not straight forward with Evolution. all the text is in
diff --git a/src/orca/scripts/apps/gedit/script.py b/src/orca/scripts/apps/gedit/script.py
index 6483bad..1c3c659 100644
--- a/src/orca/scripts/apps/gedit/script.py
+++ b/src/orca/scripts/apps/gedit/script.py
@@ -100,7 +100,8 @@ class Script(default.Script):
#print "COMPLETED", context.utterance, context.currentOffset
obj = context.obj[len(context.obj)-1]
obj.queryText().setCaretOffset(context.currentOffset)
- orca.setLocusOfFocus(None, obj, False)
+ orca.setLocusOfFocus(
+ None, obj, notifyPresentationManager=False)
def textLines(self, obj):
"""Creates a generator that can be used to iterate over each line
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 99688e2..8947888 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -1733,7 +1733,7 @@ class Script(default.Script):
if self.isDesiredFocusedItem(event.source, rolesList):
debug.println(self.debugLevel, "StarOffice.onFocus - " \
+ "Calc: Name combo box.")
- orca.setLocusOfFocus(event, event.source, True)
+ orca.setLocusOfFocus(event, event.source)
return
# OOo Writer gets rather enthusiastic with focus: events for lists.
@@ -1795,7 +1795,8 @@ class Script(default.Script):
if handleEvent:
if presentEvent:
speech.stop()
- orca.setLocusOfFocus(event, event.any_data, presentEvent)
+ orca.setLocusOfFocus(
+ event, event.any_data, notifyPresentationManager=presentEvent)
# We'll tuck away the activeDescendant information for future
# reference since the AT-SPI gives us little help in finding
@@ -1895,7 +1896,8 @@ class Script(default.Script):
pyatspi.ROLE_ROOT_PANE,
pyatspi.ROLE_FRAME]
if self.isDesiredFocusedItem(event.source, rolesList):
- orca.setLocusOfFocus(event, event.source, False)
+ orca.setLocusOfFocus(
+ event, event.source, notifyPresentationManager=False)
if event.source != self.currentParagraph:
self.updateBraille(event.source)
return
@@ -1907,7 +1909,8 @@ class Script(default.Script):
#
elif event.source.parent and \
event.source.parent.getRole() == pyatspi.ROLE_COMBO_BOX:
- orca.setLocusOfFocus(None, event.source.parent, False)
+ orca.setLocusOfFocus(
+ None, event.source.parent, notifyPresentationManager=False)
return
# If we are in the sbase Table Wizard, try to reduce the numerous
diff --git a/src/orca/scripts/apps/yelp.py b/src/orca/scripts/apps/yelp.py
index 0b3979a..d5ef25a 100644
--- a/src/orca/scripts/apps/yelp.py
+++ b/src/orca/scripts/apps/yelp.py
@@ -143,7 +143,8 @@ class Script(Gecko.Script):
# presentation managers if this event is not for an empty anchor.
#
notify = self.isSameObject(event.source, obj)
- orca.setLocusOfFocus(event, obj, notify)
+ orca.setLocusOfFocus(
+ event, obj, notifyPresentationManager=notify)
self.setCaretPosition(obj, characterOffset)
return Gecko.Script.onCaretMoved(self, event)
@@ -182,7 +183,8 @@ class Script(Gecko.Script):
# We need to set the locusOfFocus to the document frame in
# order to reliably get the caret context.
#
- orca.setLocusOfFocus(event, event.source, False)
+ orca.setLocusOfFocus(
+ event, event.source, notifyPresentationManager=False)
[obj, characterOffset] = self.getCaretContext()
# Often the first object is an anchor with no text. Try to
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index dab5aef..c4ecb49 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1466,7 +1466,10 @@ class Script(default.Script):
else:
[obj, characterOffset] = [event.source, event.detail1]
self.setCaretContext(obj, characterOffset)
- orca.setLocusOfFocus(event, obj, notifyPresentationManagers)
+ orca.setLocusOfFocus(
+ event,
+ obj,
+ notifyPresentationManager=notifyPresentationManagers)
if notifyPresentationManagers:
# No point in double-brailling the locusOfFocus.
#
@@ -1680,7 +1683,8 @@ class Script(default.Script):
self.setCaretContext(obj, characterOffset)
if not self.isSameObject(event.source, obj):
if not self.isSameObject(obj, orca_state.locusOfFocus):
- orca.setLocusOfFocus(event, obj, False)
+ orca.setLocusOfFocus(
+ event, obj, notifyPresentationManager=False)
# If an alert got focus, let's do the best we can to
# try to automatically speak its contents while also
# making sure the locus of focus and caret context
@@ -1968,7 +1972,8 @@ class Script(default.Script):
if (obj.getRole() == pyatspi.ROLE_CHECK_BOX) \
and obj.getState().contains(pyatspi.STATE_FOCUSED):
- orca.setLocusOfFocus(event, obj, False)
+ orca.setLocusOfFocus(
+ event, obj, notifyPresentationManager=False)
default.Script.visualAppearanceChanged(self, event, obj)
@@ -5565,7 +5570,8 @@ class Script(default.Script):
# Reset focus if need be.
#
if obj != orca_state.locusOfFocus:
- orca.setLocusOfFocus(None, obj, False)
+ orca.setLocusOfFocus(
+ None, obj, notifyPresentationManager=False)
# We'd like the object to have focus if it can take focus.
# Otherwise, we bubble up until we find a parent that can
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index aa7c0cd..a175d25 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -1743,7 +1743,7 @@ class StructuralNavigation:
except:
debug.printException(debug.LEVEL_SEVERE)
- orca.setLocusOfFocus(None, obj, False)
+ orca.setLocusOfFocus(None, obj, notifyPresentationManager=False)
def _presentLine(self, obj, offset):
"""Presents the first line of the object to the user.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]