[orca] Fix for bgo#58564 - Difference with mnemonic speech pitch
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca] Fix for bgo#58564 - Difference with mnemonic speech pitch
- Date: Sun, 14 Jun 2009 08:34:30 -0400 (EDT)
commit b9999468b97cf96982f39669236f9f35967e8643
Author: Willie Walker <william walker sun com>
Date: Sun Jun 14 08:31:01 2009 -0400
Fix for bgo#58564 - Difference with mnemonic speech pitch
The problem was that a trailing "." resulted in different prosody when
speaking mnemonics. So, this adds a lineBreak generator to indicate
that the current utterance being built up should be spoken right away
and without a trailing ".".
src/orca/formatting.py | 2 +-
src/orca/speech.py | 8 +++++++-
src/orca/speech_generator.py | 11 +++++++++++
test/keystrokes/gtk-demo/role_accel_label.py | 3 ++-
test/keystrokes/gtk-demo/role_check_box.py | 6 ++++--
test/keystrokes/gtk-demo/role_check_menu_item.py | 3 ++-
test/keystrokes/gtk-demo/role_combo_box2.py | 6 ++++--
test/keystrokes/gtk-demo/role_menu.py | 12 ++++++++----
test/keystrokes/gtk-demo/role_push_button.py | 3 ++-
test/keystrokes/gtk-demo/role_radio_button.py | 6 ++++--
test/keystrokes/gtk-demo/role_radio_menu_item.py | 6 ++++--
test/keystrokes/gtk-demo/role_spin_button.py | 6 ++++--
12 files changed, 53 insertions(+), 19 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 9025de5..95eb798 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -32,7 +32,7 @@ import pyatspi
# pylint: disable-msg=C0301
TUTORIAL = '(tutorial and (pause + tutorial) or [])'
-MNEMONIC = '(mnemonic and (pause + mnemonic) or [])'
+MNEMONIC = '(mnemonic and (pause + mnemonic + lineBreak) or [])'
formatting = {
'speech': {
diff --git a/src/orca/speech.py b/src/orca/speech.py
index 8c000d2..00f8131 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -189,7 +189,13 @@ def speak(content, acss=None, interrupt=True):
subString = element
elif isinstance(element, speech_generator.Pause):
if subString:
- _speak(subString + ".", acss, interrupt)
+ if subString[-1] != ".":
+ subString += "."
+ _speak(subString, acss, interrupt)
+ subString = None
+ elif isinstance(element, speech_generator.LineBreak):
+ if subString:
+ _speak(subString, acss, interrupt)
subString = None
else:
if subString:
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index d792304..4d6b65f 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -60,6 +60,14 @@ class Pause:
PAUSE = [Pause()]
+class LineBreak:
+ """A dummy class to indicate we want to break an utterance into
+ separate calls to speak."""
+ def __init__(self):
+ pass
+
+LINE_BREAK = [LineBreak()]
+
# [[[WDW - general note -- for all the _generate* methods, it would be great if
# we could return an empty array if we can determine the method does not
# apply to the object. This would allow us to reduce the number of strings
@@ -2145,6 +2153,9 @@ class SpeechGenerator:
def _generatePause(self, obj, **args):
return PAUSE
+ def _generateLineBreak(self, obj, **args):
+ return LINE_BREAK
+
def voice(self, key=None):
"""Returns an array containing a voice. The key is a value
to be used to look up the voice in the settings.py:voices
diff --git a/test/keystrokes/gtk-demo/role_accel_label.py b/test/keystrokes/gtk-demo/role_accel_label.py
index a5a22b9..9df4354 100644
--- a/test/keystrokes/gtk-demo/role_accel_label.py
+++ b/test/keystrokes/gtk-demo/role_accel_label.py
@@ -50,7 +50,8 @@ sequence.append(utils.AssertPresentationAction(
"New menu item Where Am I",
["BRAILLE LINE: 'gtk-demo Application UI Manager Frame MenuBar New(Control n)'",
" VISIBLE: 'New(Control n)', cursor=1",
- "SPEECH OUTPUT: 'File menu New Control n item 1 of 5 n'"]))
+ "SPEECH OUTPUT: 'File menu New Control n item 1 of 5.",
+ "SPEECH OUTPUT: 'n'"]))
########################################################################
# Now, continue on down the menu.
diff --git a/test/keystrokes/gtk-demo/role_check_box.py b/test/keystrokes/gtk-demo/role_check_box.py
index 0d18bc5..c828bb4 100644
--- a/test/keystrokes/gtk-demo/role_check_box.py
+++ b/test/keystrokes/gtk-demo/role_check_box.py
@@ -47,7 +47,8 @@ sequence.append(utils.AssertPresentationAction(
"Left resize check box unchecked Where Am I",
["BRAILLE LINE: 'gtk-demo Application Panes Frame Horizontal Panel < > Resize CheckBox'",
" VISIBLE: '< > Resize CheckBox', cursor=1",
- "SPEECH OUTPUT: 'Resize check box not checked Alt r'"]))
+ "SPEECH OUTPUT: 'Resize check box not checked.",
+ "SPEECH OUTPUT: 'Alt r'"]))
########################################################################
# Now, change its state.
@@ -75,7 +76,8 @@ sequence.append(utils.AssertPresentationAction(
"Left resize check box checked Where Am I",
["BRAILLE LINE: 'gtk-demo Application Panes Frame Horizontal Panel <x> Resize CheckBox'",
" VISIBLE: '<x> Resize CheckBox', cursor=1",
- "SPEECH OUTPUT: 'Resize check box checked Alt r'"]))
+ "SPEECH OUTPUT: 'Resize check box checked.",
+ "SPEECH OUTPUT: 'Alt r'"]))
########################################################################
# Change the state back and move on to a few more check boxes. The
diff --git a/test/keystrokes/gtk-demo/role_check_menu_item.py b/test/keystrokes/gtk-demo/role_check_menu_item.py
index 0e18f0c..637f80f 100644
--- a/test/keystrokes/gtk-demo/role_check_menu_item.py
+++ b/test/keystrokes/gtk-demo/role_check_menu_item.py
@@ -52,7 +52,8 @@ sequence.append(utils.AssertPresentationAction(
"Bold check item Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame MenuBar <x> Bold CheckItem(Control b)'",
" VISIBLE: '<x> Bold CheckItem(Control b)', cursor=1",
- "SPEECH OUTPUT: 'Preferences menu Bold check item checked Control b item 3 of 3 b'"]))
+ "SPEECH OUTPUT: 'Preferences menu Bold check item checked Control b item 3 of 3.",
+ "SPEECH OUTPUT: 'b'"]))
########################################################################
# Dismiss the menu and close the Application Window demo window
diff --git a/test/keystrokes/gtk-demo/role_combo_box2.py b/test/keystrokes/gtk-demo/role_combo_box2.py
index 64a17fc..2e09b96 100644
--- a/test/keystrokes/gtk-demo/role_combo_box2.py
+++ b/test/keystrokes/gtk-demo/role_combo_box2.py
@@ -52,7 +52,8 @@ sequence.append(utils.AssertPresentationAction(
"All sheets combo box item Where Am I",
["BRAILLE LINE: 'gtk-demo Application Print Dialog TabList Page Setup Page Layout Filler Only print: All sheets Combo'",
" VISIBLE: 'All sheets Combo', cursor=1",
- "SPEECH OUTPUT: 'Only print: combo box All sheets item 1 of 3 Alt o'"]))
+ "SPEECH OUTPUT: 'Only print: combo box All sheets item 1 of 3.",
+ "SPEECH OUTPUT: 'Alt o'"]))
########################################################################
# Down arrow to select the "Even sheets" item in the combo box.
@@ -80,7 +81,8 @@ sequence.append(utils.AssertPresentationAction(
"Even sheets combo box item Where Am I",
["BRAILLE LINE: 'gtk-demo Application Print Dialog TabList Page Setup Page Layout Filler Only print: Even sheets Combo'",
" VISIBLE: 'Even sheets Combo', cursor=1",
- "SPEECH OUTPUT: 'Only print: combo box Even sheets item 2 of 3 Alt o'"]))
+ "SPEECH OUTPUT: 'Only print: combo box Even sheets item 2 of 3.",
+ "SPEECH OUTPUT: 'Alt o'"]))
########################################################################
# Put things back the way they were and close the demo.
diff --git a/test/keystrokes/gtk-demo/role_menu.py b/test/keystrokes/gtk-demo/role_menu.py
index c2fb37d..cdf357f 100644
--- a/test/keystrokes/gtk-demo/role_menu.py
+++ b/test/keystrokes/gtk-demo/role_menu.py
@@ -48,7 +48,8 @@ sequence.append(utils.AssertPresentationAction(
"File menu Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame File Menu'",
" VISIBLE: 'File Menu', cursor=1",
- "SPEECH OUTPUT: 'menu bar File menu item 1 of 3 f'"]))
+ "SPEECH OUTPUT: 'menu bar File menu item 1 of 3.",
+ "SPEECH OUTPUT: 'f'"]))
########################################################################
# Right arrow to the "Preferences" menu.
@@ -73,7 +74,8 @@ sequence.append(utils.AssertPresentationAction(
"Preferences menu Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame Preferences Menu'",
" VISIBLE: 'Preferences Menu', cursor=1",
- "SPEECH OUTPUT: 'menu bar Preferences menu item 2 of 3 p'"]))
+ "SPEECH OUTPUT: 'menu bar Preferences menu item 2 of 3.",
+ "SPEECH OUTPUT: 'p'"]))
########################################################################
# Go down to the "Color" menu.
@@ -98,7 +100,8 @@ sequence.append(utils.AssertPresentationAction(
"Color menu Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame MenuBar Color Menu'",
" VISIBLE: 'Color Menu', cursor=1",
- "SPEECH OUTPUT: 'Preferences menu Color menu item 1 of 3 c'"]))
+ "SPEECH OUTPUT: 'Preferences menu Color menu item 1 of 3.",
+ "SPEECH OUTPUT: 'c'"]))
########################################################################
# Go down to the "Shape" menu.
@@ -123,7 +126,8 @@ sequence.append(utils.AssertPresentationAction(
"Shape menu Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame MenuBar Shape Menu'",
" VISIBLE: 'Shape Menu', cursor=1",
- "SPEECH OUTPUT: 'Preferences menu Shape menu item 2 of 3 s'"]))
+ "SPEECH OUTPUT: 'Preferences menu Shape menu item 2 of 3.",
+ "SPEECH OUTPUT: 's'"]))
########################################################################
# Dismiss the menu and close the Application Window demo window
diff --git a/test/keystrokes/gtk-demo/role_push_button.py b/test/keystrokes/gtk-demo/role_push_button.py
index 6b45b14..57eab9c 100644
--- a/test/keystrokes/gtk-demo/role_push_button.py
+++ b/test/keystrokes/gtk-demo/role_push_button.py
@@ -53,7 +53,8 @@ sequence.append(utils.AssertPresentationAction(
"OK button Where Am I",
["BRAILLE LINE: 'gtk-demo Application Button Boxes Frame Horizontal Button Boxes Panel Spread Panel OK Button'",
" VISIBLE: 'OK Button', cursor=1",
- "SPEECH OUTPUT: 'OK button Alt o'"]))
+ "SPEECH OUTPUT: 'OK button.",
+ "SPEECH OUTPUT: 'Alt o'"]))
########################################################################
# Tab to the Cancel button.
diff --git a/test/keystrokes/gtk-demo/role_radio_button.py b/test/keystrokes/gtk-demo/role_radio_button.py
index ce94f42..2b5d929 100644
--- a/test/keystrokes/gtk-demo/role_radio_button.py
+++ b/test/keystrokes/gtk-demo/role_radio_button.py
@@ -47,7 +47,8 @@ sequence.append(utils.AssertPresentationAction(
"All Pages radio button Where Am I",
["BRAILLE LINE: 'gtk-demo Application Print Dialog TabList General Page Range Filler &=y All Pages RadioButton'",
" VISIBLE: '&=y All Pages RadioButton', cursor=1",
- "SPEECH OUTPUT: 'Range All Pages radio button selected item 1 of 3 Alt a'"]))
+ "SPEECH OUTPUT: 'Range All Pages radio button selected item 1 of 3.",
+ "SPEECH OUTPUT: 'Alt a'"]))
########################################################################
# Down arrow to the "Pages:" radio button.
@@ -80,7 +81,8 @@ sequence.append(utils.AssertPresentationAction(
"Range radio button Where Am I",
["BRAILLE LINE: 'gtk-demo Application Print Dialog TabList General Page Range Filler &=y Pages: RadioButton'",
" VISIBLE: '&=y Pages: RadioButton', cursor=1",
- "SPEECH OUTPUT: 'Range Pages: radio button selected item 3 of 3 Alt e'"]))
+ "SPEECH OUTPUT: 'Range Pages: radio button selected item 3 of 3.",
+ "SPEECH OUTPUT: 'Alt e'"]))
########################################################################
# Put everything back and close the demo.
diff --git a/test/keystrokes/gtk-demo/role_radio_menu_item.py b/test/keystrokes/gtk-demo/role_radio_menu_item.py
index 319c811..629a97e 100644
--- a/test/keystrokes/gtk-demo/role_radio_menu_item.py
+++ b/test/keystrokes/gtk-demo/role_radio_menu_item.py
@@ -56,7 +56,8 @@ sequence.append(utils.AssertPresentationAction(
"Red button Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame MenuBar Preferences Menu <x> Red CheckItem(Control r)'",
" VISIBLE: '<x> Red CheckItem(Control r)', cursor=1",
- "SPEECH OUTPUT: 'Preferences menu Color menu Red check item checked Control r item 1 of 3 r'"]))
+ "SPEECH OUTPUT: 'Preferences menu Color menu Red check item checked Control r item 1 of 3.",
+ "SPEECH OUTPUT: 'r'"]))
########################################################################
# Down arrow to the "Green" menu item.
@@ -87,7 +88,8 @@ sequence.append(utils.AssertPresentationAction(
"Green button Where Am I",
["BRAILLE LINE: 'gtk-demo Application Application Window Frame MenuBar Preferences Menu < > Green CheckItem(Control g)'",
" VISIBLE: '< > Green CheckItem(Control g)', cursor=1",
- "SPEECH OUTPUT: 'Preferences menu Color menu Green check item not checked Control g item 2 of 3 g'"]))
+ "SPEECH OUTPUT: 'Preferences menu Color menu Green check item not checked Control g item 2 of 3.",
+ "SPEECH OUTPUT: 'g'"]))
########################################################################
# Dismiss the menu and close the Application Window demo window
diff --git a/test/keystrokes/gtk-demo/role_spin_button.py b/test/keystrokes/gtk-demo/role_spin_button.py
index b368b7f..6245e04 100644
--- a/test/keystrokes/gtk-demo/role_spin_button.py
+++ b/test/keystrokes/gtk-demo/role_spin_button.py
@@ -62,7 +62,8 @@ sequence.append(utils.AssertPresentationAction(
"Hue spin button Where Am I",
["BRAILLE LINE: 'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
" VISIBLE: 'Hue: 240 $l', cursor=9",
- "SPEECH OUTPUT: 'Hue: spin button 240 selected Alt h'"]))
+ "SPEECH OUTPUT: 'Hue: spin button 240 selected.",
+ "SPEECH OUTPUT: 'Alt h'"]))
########################################################################
# Change the value by arrowing down.
@@ -132,7 +133,8 @@ sequence.append(utils.AssertPresentationAction(
"Hue spin button caret navigation",
["BRAILLE LINE: 'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
" VISIBLE: 'Hue: 240 $l', cursor=7",
- "SPEECH OUTPUT: 'Hue: spin button 240 Alt h'"]))
+ "SPEECH OUTPUT: 'Hue: spin button 240.",
+ "SPEECH OUTPUT: 'Alt h'"]))
########################################################################
# Close the Color Chooser dialog
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]