[orca] Work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML container
- From: Joanmarie Diggs <joanied src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [orca] Work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML container
- Date: Thu, 5 Nov 2009 16:54:48 +0000 (UTC)
commit ebd9d3c248942a91520a1af4a28d8ae81061d894
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Sun Oct 4 16:28:22 2009 -0400
Work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML container.
Present the content associated with the current accessible. Note that a
given line can be made up of multiple accessibles due to formatting. I
will address that separately.
src/orca/scripts/apps/packagemanager/script.py | 55 ++++++++++++++++++++
.../apps/packagemanager/speech_generator.py | 14 +++++
2 files changed, 69 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/packagemanager/script.py b/src/orca/scripts/apps/packagemanager/script.py
index 8a18550..f64b11e 100644
--- a/src/orca/scripts/apps/packagemanager/script.py
+++ b/src/orca/scripts/apps/packagemanager/script.py
@@ -28,6 +28,7 @@ __license__ = "LGPL"
import pyatspi
import orca.default as default
+import orca.orca as orca
import orca.orca_state as orca_state
import orca.speech as speech
@@ -78,6 +79,24 @@ class Script(default.Script):
return TutorialGenerator(self)
+ def onCaretMoved(self, event):
+ """Called whenever the caret moves.
+
+ Arguments:
+ - event: the Event
+ """
+
+ # Quietly set the locusOfFocus in HTML containers so that the default
+ # script doesn't ignore this event.
+ #
+ if event.source != orca_state.locusOfFocus \
+ and self.getAncestor(event.source,
+ [pyatspi.ROLE_HTML_CONTAINER],
+ [pyatspi.ROLE_FRAME]):
+ orca.setLocusOfFocus(event, event.source, False)
+
+ default.Script.onCaretMoved(self, event)
+
def onStateChanged(self, event):
"""Called whenever an object's state changes.
@@ -166,6 +185,42 @@ class Script(default.Script):
return True
+ def isLink(self, obj):
+ """Returns True if this is a text object serving as a link.
+
+ Arguments:
+ - obj: an accessible
+ """
+
+ # Images seem to be exposed as ROLE_PANEL and implement very few of
+ # the accessibility interfaces.
+ #
+ if obj.getRole() == pyatspi.ROLE_PANEL and not obj.childCount \
+ and obj.getState().contains(pyatspi.STATE_FOCUSABLE) \
+ and self.getAncestor(obj,
+ [pyatspi.ROLE_HTML_CONTAINER],
+ [pyatspi.ROLE_FRAME]):
+ return True
+
+ try:
+ text = obj.queryText()
+ except:
+ return False
+ else:
+ return self.getLinkIndex(obj, text.caretOffset) >= 0
+
+ def isTextArea(self, obj):
+ """Returns True if obj is a GUI component that is for entering text.
+
+ Arguments:
+ - obj: an accessible
+ """
+
+ if self.isLink(obj):
+ return False
+
+ return default.Script.isTextArea(self, obj)
+
def isSearchEntry(self, obj):
"""Attempts to distinguish the Search entry from other accessibles.
diff --git a/src/orca/scripts/apps/packagemanager/speech_generator.py b/src/orca/scripts/apps/packagemanager/speech_generator.py
index aa118a3..9ffdb48 100644
--- a/src/orca/scripts/apps/packagemanager/speech_generator.py
+++ b/src/orca/scripts/apps/packagemanager/speech_generator.py
@@ -25,6 +25,8 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
__license__ = "LGPL"
+import pyatspi
+
import orca.speech_generator as speech_generator
class SpeechGenerator(speech_generator.SpeechGenerator):
@@ -35,6 +37,18 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
def __init__(self, script):
speech_generator.SpeechGenerator.__init__(self, script)
+ def generateSpeech(self, obj, **args):
+ results = []
+ oldRole = None
+ if self._script.isLink(obj):
+ oldRole = self._overrideRole(pyatspi.ROLE_LINK, args)
+ results.extend(
+ speech_generator.SpeechGenerator.generateSpeech(self, obj, **args))
+ if oldRole:
+ self._restoreRole(oldRole, args)
+
+ return results
+
def _generateColumnHeader(self, obj, **args):
"""Returns an array of strings (and possibly voice and audio
specifications) that represent the column header for an object
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]