orca r3693 - in trunk: . src/orca test/keystrokes/gtk-demo
- From: richb svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r3693 - in trunk: . src/orca test/keystrokes/gtk-demo
- Date: Wed, 5 Mar 2008 19:39:40 +0000 (GMT)
Author: richb
Date: Wed Mar 5 19:39:40 2008
New Revision: 3693
URL: http://svn.gnome.org/viewvc/orca?rev=3693&view=rev
Log:
* src/orca/where_am_I.py:
test/keystrokes/gtk-demo/role_label.py:
Fix for bug #519545 - gtk-demo/role_label.py regression test #2
produces the wrong results.
Modified:
trunk/ChangeLog
trunk/src/orca/where_am_I.py
trunk/test/keystrokes/gtk-demo/role_label.py
Modified: trunk/src/orca/where_am_I.py
==============================================================================
--- trunk/src/orca/where_am_I.py (original)
+++ trunk/src/orca/where_am_I.py Wed Mar 5 19:39:40 2008
@@ -142,6 +142,9 @@
elif role == pyatspi.ROLE_SPLIT_PANE:
self._speakSplitPane(obj, basicOnly)
+ elif role == pyatspi.ROLE_LABEL:
+ self._speakLabel(obj, basicOnly)
+
else:
self._speakGenericObject(obj, basicOnly)
@@ -273,22 +276,7 @@
name = self._getObjName(obj)
utterances.append(name)
- try:
- textObj = obj.queryText()
- except:
- pass
- else:
- noOfSelections = textObj.getNSelections()
- if noOfSelections == 1:
- [string, startOffset, endOffset] = \
- textObj.getTextAtOffset(0, pyatspi.TEXT_BOUNDARY_LINE_START)
- if startOffset == 0 and endOffset == len(string):
- # Translators: when the user selects (highlights) text in
- # a document, Orca lets them know this.
- #
- # ONLY TRANSLATE THE PART AFTER THE PIPE CHARACTER |
- #
- utterances.append(Q_("text|selected"))
+ utterances.extend(self._getSpeechForAllTextSelection(obj))
text = self._getObjAccelerator(obj)
utterances.append(text)
@@ -861,6 +849,51 @@
speech.speakUtterances(utterances)
+ def _speakLabel(self, obj, basicOnly):
+ """Speak label information:
+ 1. Name/Label
+ 2. selected (if True).
+ 3. Role
+ """
+
+ utterances = []
+ text = self.getObjLabelAndName(obj)
+ utterances.append(text)
+
+ utterances.extend(self._getSpeechForAllTextSelection(obj))
+
+ text = rolenames.getSpeechForRoleName(obj)
+ utterances.append(text)
+ speech.speakUtterances(utterances)
+
+ def _getSpeechForAllTextSelection(self, obj):
+ """Check if this object has text associated with it and it's
+ completely selected.
+
+ Arguments:
+ - obj: the object being presented
+ """
+
+ utterance = []
+ try:
+ textObj = obj.queryText()
+ except:
+ pass
+ else:
+ noOfSelections = textObj.getNSelections()
+ if noOfSelections == 1:
+ [string, startOffset, endOffset] = \
+ textObj.getTextAtOffset(0, pyatspi.TEXT_BOUNDARY_LINE_START)
+ if startOffset == 0 and endOffset == len(string):
+ # Translators: when the user selects (highlights) text in
+ # a document, Orca lets them know this.
+ #
+ # ONLY TRANSLATE THE PART AFTER THE PIPE CHARACTER |
+ #
+ utterance = [Q_("text|selected")]
+
+ return utterance
+
def __extractSize(self, uri):
"""Get the http header for a given uri and try to extract the size
(Content-length).
Modified: trunk/test/keystrokes/gtk-demo/role_label.py
==============================================================================
--- trunk/test/keystrokes/gtk-demo/role_label.py (original)
+++ trunk/test/keystrokes/gtk-demo/role_label.py Wed Mar 5 19:39:40 2008
@@ -61,12 +61,11 @@
sequence.append(PauseAction(3000))
sequence.append(utils.AssertPresentationAction(
"This message box label Where Am I",
- ["BUG? - text is selected but not presented as such in speech or braille",
- "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following",
- "number of times: Label'",
+ ["BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following $l'",
" VISIBLE: 'This message box has been popped', cursor=1",
"SPEECH OUTPUT: 'This message box has been popped up the following",
"number of times:'",
+ "SPEECH OUTPUT: 'selected'",
"SPEECH OUTPUT: 'label'"]))
########################################################################
@@ -78,18 +77,17 @@
sequence.append(PauseAction(3000))
sequence.append(utils.AssertPresentationAction(
"This message box label Extended Where Am I",
- ["BUG? - text is selected but not presented as such in speech or braille",
- "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following",
- "number of times: Label'",
+ ["BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following $l'",
" VISIBLE: 'This message box has been popped', cursor=1",
- "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following",
- "number of times: Label'",
+ "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following $l'",
" VISIBLE: 'This message box has been popped', cursor=1",
"SPEECH OUTPUT: 'This message box has been popped up the following",
"number of times:'",
+ "SPEECH OUTPUT: 'selected'",
"SPEECH OUTPUT: 'label'",
"SPEECH OUTPUT: 'This message box has been popped up the following",
"number of times:'",
+ "SPEECH OUTPUT: 'selected'",
"SPEECH OUTPUT: 'label'"]))
########################################################################
@@ -135,13 +133,11 @@
sequence.append(PauseAction(3000))
sequence.append(utils.AssertPresentationAction(
"This message box label caret selection Where Am I",
- ["BUG? - text selection not presented in speech or braille",
- "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following",
- "number of times: Label'",
- "BUG? - the cursor is wrong in the following braille output",
- " VISIBLE: 'This message box has been popped', cursor=1",
+ ["BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following $l'",
+ " VISIBLE: 'This message box has been popped', cursor=2",
"SPEECH OUTPUT: 'This message box has been popped up the following",
"number of times:'",
+ "SPEECH OUTPUT: 'selected'",
"SPEECH OUTPUT: 'label'"]))
########################################################################
@@ -153,20 +149,17 @@
sequence.append(PauseAction(3000))
sequence.append(utils.AssertPresentationAction(
"This message box label caret selection Extended Where Am I",
- ["BUG? - text selection not presented in speech or braille",
- "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following",
- "number of times: Label'",
- "BUG? - the cursor is wrong in the following braille output",
- " VISIBLE: 'This message box has been popped', cursor=1",
- "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following",
- "number of times: Label'",
- "BUG? - the cursor is wrong in the following braille output",
- " VISIBLE: 'This message box has been popped', cursor=1",
+ ["BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following $l'",
+ " VISIBLE: 'This message box has been popped', cursor=2",
+ "BRAILLE LINE: 'gtk-demo Application Information Alert This message box has been popped up the following $l'",
+ " VISIBLE: 'This message box has been popped', cursor=2",
"SPEECH OUTPUT: 'This message box has been popped up the following",
"number of times:'",
+ "SPEECH OUTPUT: 'selected'",
"SPEECH OUTPUT: 'label'",
"SPEECH OUTPUT: 'This message box has been popped up the following",
"number of times:'",
+ "SPEECH OUTPUT: 'selected'",
"SPEECH OUTPUT: 'label'"]))
########################################################################
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]