[orca] Fix for bgo#616691 - Orca is too "chatty" in certain Java widgets due to extraneous events
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bgo#616691 - Orca is too "chatty" in certain Java widgets due to extraneous events
- Date: Sat, 24 Apr 2010 03:22:08 +0000 (UTC)
commit 5c68e65a667def286bba5be791797b721f9601f3
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Fri Apr 23 23:19:27 2010 -0400
Fix for bgo#616691 - Orca is too "chatty" in certain Java widgets due to extraneous events
.../scripts/toolkits/J2SE-access-bridge/script.py | 13 +++++++++++
.../J2SE-access-bridge/speech_generator.py | 23 ++++++++++++++++++++
test/keystrokes/java/role_accel_label.py | 10 ++------
test/keystrokes/java/role_check_menu_item.py | 7 +-----
test/keystrokes/java/role_combo_box.py | 8 +------
test/keystrokes/java/role_menu.py | 4 +-
test/keystrokes/java/role_page_tab.py | 8 +-----
test/keystrokes/java/role_push_button.py | 2 +-
8 files changed, 46 insertions(+), 29 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
index f648737..3c2cccb 100644
--- a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
+++ b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
@@ -199,6 +199,19 @@ class Script(default.Script):
role = event.source.getRole()
+ # Ignore bogus/senseless focus claims because they just cause us to
+ # be more chatty as a result of the event and then later as a result
+ # of the changed locusOfFocus.
+ #
+ if role == pyatspi.ROLE_ROOT_PANE:
+ return
+
+ if role == pyatspi.ROLE_PAGE_TAB_LIST and orca_state.locusOfFocus \
+ and orca_state.locusOfFocus.getRole() == pyatspi.ROLE_PAGE_TAB \
+ and orca_state.locusOfFocus.getState().\
+ contains(pyatspi.STATE_FOCUSED):
+ return
+
if role == pyatspi.ROLE_MENU:
# Override default.py's onFocus decision to ignore focus
# events on MENU items with selected children. This is
diff --git a/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py b/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py
index 79ca79f..e999dbc 100644
--- a/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py
+++ b/src/orca/scripts/toolkits/J2SE-access-bridge/speech_generator.py
@@ -57,6 +57,29 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
del args['requireText']
return result
+ def _generateNewAncestors(self, obj, **args):
+ """Returns an array of strings (and possibly voice and audio
+ specifications) that represent the text of the ancestors for
+ the object. This is typically used to present the context for
+ an object (e.g., the names of the window, the panels, etc.,
+ that the object is contained in). If the 'priorObj' attribute
+ of the args dictionary is set, only the differences in
+ ancestry between the 'priorObj' and the current obj will be
+ computed. Otherwise, no ancestry will be computed. The
+ 'priorObj' is typically set by Orca to be the previous object
+ with focus.
+ """
+ result = []
+ if args.get('role', obj.getRole()) == pyatspi.ROLE_MENU:
+ # We're way too chatty here -- at least with the Swing2
+ # demo. Users entering a menu want to know they've gone
+ # into a menu; not a huge ancestry.
+ #
+ return result
+ result.extend(speech_generator.SpeechGenerator.\
+ _generateNewAncestors(self, obj, **args))
+ return result
+
def _generateNumberOfChildren(self, obj, **args):
"""Returns an array of strings (and possibly voice and audio
specifications) that represents the number of children the
diff --git a/test/keystrokes/java/role_accel_label.py b/test/keystrokes/java/role_accel_label.py
index 1731937..72f6d70 100644
--- a/test/keystrokes/java/role_accel_label.py
+++ b/test/keystrokes/java/role_accel_label.py
@@ -25,10 +25,7 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'File Menu', cursor=1",
"BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane File Menu'",
" VISIBLE: 'File Menu', cursor=1",
- "BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane'",
- " VISIBLE: 'RootPane', cursor=1",
- "SPEECH OUTPUT: 'SwingSet2 frame Swing demo menu bar menu bar File menu'",
- "SPEECH OUTPUT: 'root pane'"]))
+ "SPEECH OUTPUT: 'File menu'"]))
########################################################################
# Down Arrow to the About menu item
@@ -39,10 +36,9 @@ sequence.append(KeyComboAction("Down"))
sequence.append(WaitForFocus("About", acc_role=pyatspi.ROLE_MENU_ITEM))
sequence.append(utils.AssertPresentationAction(
"2. Arrow Down",
- ["BUG? - Too chatty.",
- "BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane Swing demo menu bar MenuBar About'",
+ ["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane Swing demo menu bar MenuBar About'",
" VISIBLE: 'About', cursor=1",
- "SPEECH OUTPUT: 'Swing demo menu bar menu bar File menu About'"]))
+ "SPEECH OUTPUT: 'About'"]))
########################################################################
# Do a basic "Where Am I" via KP_Enter.
diff --git a/test/keystrokes/java/role_check_menu_item.py b/test/keystrokes/java/role_check_menu_item.py
index f3af40c..e5be3c4 100644
--- a/test/keystrokes/java/role_check_menu_item.py
+++ b/test/keystrokes/java/role_check_menu_item.py
@@ -16,11 +16,6 @@ sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
sequence.append(PauseAction(5000))
-# Hack to deal with a timing issue which seems to interfere with our
-# setting the locusOfFocus reliably.
-sequence.append(KeyComboAction("Tab"))
-sequence.append(WaitForFocus("", acc_role=pyatspi.ROLE_TOGGLE_BUTTON))
-
sequence.append(KeyComboAction("F10"))
sequence.append(WaitForFocus("File", acc_role=pyatspi.ROLE_MENU))
sequence.append(KeyComboAction("Right"))
@@ -91,7 +86,7 @@ sequence.append(utils.AssertPresentationAction(
"Enable Drag Support checked menu item",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane Swing demo menu bar MenuBar <x> Enable Drag Support CheckBox'",
" VISIBLE: '<x> Enable Drag Support CheckBox', cursor=1",
- "SPEECH OUTPUT: 'Swing demo menu bar menu bar Options menu Enable Drag Support check box checked'"]))
+ "SPEECH OUTPUT: 'Enable Drag Support check box checked'"]))
########################################################################
# Do a basic "Where Am I" via KP_Enter.
diff --git a/test/keystrokes/java/role_combo_box.py b/test/keystrokes/java/role_combo_box.py
index 8146fb5..729bc9b 100644
--- a/test/keystrokes/java/role_combo_box.py
+++ b/test/keystrokes/java/role_combo_box.py
@@ -70,7 +70,7 @@ sequence.append(utils.AssertPresentationAction(
"1. focusing over first combo box",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Howard, Jeff Combo'",
" VISIBLE: 'Presets: Philip, Howard, Jeff Co', cursor=10",
- "SPEECH OUTPUT: 'ComboBox Demo page Presets: Philip, Howard, Jeff combo box'"]))
+ "SPEECH OUTPUT: 'Presets: Philip, Howard, Jeff combo box'"]))
########################################################################
# Do a basic "Where Am I" via KP_Enter.
@@ -99,7 +99,6 @@ sequence.append(utils.AssertPresentationAction(
#
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
-sequence.append(WaitForFocus("Jeff, Larry, Philip", acc_role=pyatspi.ROLE_LABEL))
sequence.append(utils.AssertPresentationAction(
"4. Arrow Down",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Jeff, Larry, Philip Combo'",
@@ -111,7 +110,6 @@ sequence.append(utils.AssertPresentationAction(
#
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
-sequence.append(WaitForFocus("Howard, Scott, Hans", acc_role=pyatspi.ROLE_LABEL))
sequence.append(utils.AssertPresentationAction(
"5. Arrow Down",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Howard, Scott, Hans Combo'",
@@ -139,7 +137,6 @@ sequence.append(utils.AssertPresentationAction(
#
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
-sequence.append(WaitForFocus("Philip, Jeff, Hans", acc_role=pyatspi.ROLE_LABEL))
sequence.append(utils.AssertPresentationAction(
"7. Arrow Down",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Jeff, Hans Combo'",
@@ -184,7 +181,6 @@ sequence.append(utils.AssertPresentationAction(
#
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
-sequence.append(WaitForFocus("Howard, Scott, Hans", acc_role=pyatspi.ROLE_LABEL))
sequence.append(utils.AssertPresentationAction(
"11. Arrow Up",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Howard, Scott, Hans Combo'",
@@ -196,7 +192,6 @@ sequence.append(utils.AssertPresentationAction(
#
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
-sequence.append(WaitForFocus("Jeff, Larry, Philip", acc_role=pyatspi.ROLE_LABEL))
sequence.append(utils.AssertPresentationAction(
"12. Arrow Up",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Jeff, Larry, Philip Combo'",
@@ -208,7 +203,6 @@ sequence.append(utils.AssertPresentationAction(
#
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
-sequence.append(WaitForFocus("Philip, Howard, Jeff", acc_role=pyatspi.ROLE_LABEL))
sequence.append(utils.AssertPresentationAction(
"13. Arrow Up",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane ComboBox Demo TabList ComboBox Demo Page Presets: Philip, Howard, Jeff Combo'",
diff --git a/test/keystrokes/java/role_menu.py b/test/keystrokes/java/role_menu.py
index 0b9e35d..0ac651f 100644
--- a/test/keystrokes/java/role_menu.py
+++ b/test/keystrokes/java/role_menu.py
@@ -35,7 +35,7 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'File Menu', cursor=1",
"BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane PopupMenu About'",
" VISIBLE: 'About', cursor=1",
- "SPEECH OUTPUT: 'Swing demo menu bar menu bar File menu'",
+ "SPEECH OUTPUT: 'File menu'",
"SPEECH OUTPUT: 'About'"]))
########################################################################
@@ -64,7 +64,7 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'Look & Feel Menu', cursor=1",
"BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane Look & Feel Menu'",
" VISIBLE: 'Look & Feel Menu', cursor=1",
- "SPEECH OUTPUT: 'Swing demo menu bar menu bar Look & Feel menu'"]))
+ "SPEECH OUTPUT: 'Look & Feel menu'"]))
########################################################################
# Basic Where Am I
diff --git a/test/keystrokes/java/role_page_tab.py b/test/keystrokes/java/role_page_tab.py
index 11fca85..eac0687 100644
--- a/test/keystrokes/java/role_page_tab.py
+++ b/test/keystrokes/java/role_page_tab.py
@@ -73,13 +73,9 @@ sequence.append(KeyComboAction("Tab"))
sequence.append(WaitForFocus("Laine", acc_role=pyatspi.ROLE_PAGE_TAB))
sequence.append(utils.AssertPresentationAction(
"1. Move to Laine tab",
- ["BUG? - Seems extra chatty",
- "BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane TabbedPane Demo TabList TabbedPane Demo Page Laine Page'",
+ ["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane TabbedPane Demo TabList TabbedPane Demo Page Laine Page'",
" VISIBLE: 'Laine Page', cursor=1",
- "BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane TabbedPane Demo TabList TabbedPane Demo Page Laine TabList'",
- " VISIBLE: 'Laine TabList', cursor=1",
- "SPEECH OUTPUT: 'Laine tab list Laine page'",
- "SPEECH OUTPUT: 'Laine tab list'"]))
+ "SPEECH OUTPUT: 'Laine tab list Laine page'"]))
########################################################################
# Expected output when "Ewan" tab gets focus.
diff --git a/test/keystrokes/java/role_push_button.py b/test/keystrokes/java/role_push_button.py
index 396a176..ab13f54 100644
--- a/test/keystrokes/java/role_push_button.py
+++ b/test/keystrokes/java/role_push_button.py
@@ -70,7 +70,7 @@ sequence.append(utils.AssertPresentationAction(
"1. Move to One button",
["BRAILLE LINE: 'SwingSet2 Application SwingSet2 Frame RootPane LayeredPane Button Demo TabList Button Demo Page Buttons TabList Buttons Page Text Buttons Panel One Button'",
" VISIBLE: 'One Button', cursor=1",
- "SPEECH OUTPUT: 'Buttons page Text Buttons panel One button'"]))
+ "SPEECH OUTPUT: 'Text Buttons panel One button'"]))
########################################################################
# Do a basic "Where Am I" via KP_Enter.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]