orca r3526 - in trunk: . src/orca
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r3526 - in trunk: . src/orca
- Date: Tue, 29 Jan 2008 23:36:44 +0000 (GMT)
Author: wwalker
Date: Tue Jan 29 23:36:44 2008
New Revision: 3526
URL: http://svn.gnome.org/viewvc/orca?rev=3526&view=rev
Log:
Fix for Bug 512608 - Punctuation in keyboard review mode.
Modified:
trunk/ChangeLog
trunk/src/orca/default.py
trunk/src/orca/speech.py
trunk/src/orca/speechdispatcherfactory.py
Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py (original)
+++ trunk/src/orca/default.py Tue Jan 29 23:36:44 2008
@@ -1,6 +1,6 @@
# Orca
#
-# Copyright 2004-2007 Sun Microsystems Inc.
+# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -4266,11 +4266,11 @@
self.spellCurrentItem(charString)
elif clickCount == 3:
self.phoneticSpellCurrentItem(charString)
- elif charString.isupper():
- speech.speak(charString,
- self.voices[settings.UPPERCASE_VOICE])
+ elif charString.decode("UTF-8").isupper():
+ speech.speakCharacter(charString,
+ self.voices[settings.UPPERCASE_VOICE])
else:
- speech.speak(charString)
+ speech.speakCharacter(charString)
self.updateBrailleReview()
Modified: trunk/src/orca/speech.py
==============================================================================
--- trunk/src/orca/speech.py (original)
+++ trunk/src/orca/speech.py Tue Jan 29 23:36:44 2008
@@ -1,6 +1,6 @@
# Orca
#
-# Copyright 2004-2007 Sun Microsystems Inc.
+# Copyright 2004-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -195,8 +195,28 @@
debug.println(debug.LEVEL_INFO, logLine)
log.info(logLine)
+def speakCharacter(character, acss=None):
+ """Speaks a single character immediately.
+
+ Arguments:
+ - character: text to be spoken
+ - acss: acss.ACSS instance; if None,
+ the default voice settings will be used.
+ Otherwise, the acss settings will be
+ used to augment/override the default
+ voice settings.
+ """
+ if settings.silenceSpeech:
+ return
+
+ debug.println(debug.LEVEL_INFO, "SPEECH OUTPUT: '" + character + "'")
+ log.info("speak character='%s'" % character)
+
+ if _speechserver:
+ _speechserver.speakCharacter(character, acss=acss)
+
def isSpeaking():
- """"Returns True if the system is currently speaking."""
+ """Returns True if the system is currently speaking."""
if _speechserver:
return _speechserver.isSpeaking()
else:
Modified: trunk/src/orca/speechdispatcherfactory.py
==============================================================================
--- trunk/src/orca/speechdispatcherfactory.py (original)
+++ trunk/src/orca/speechdispatcherfactory.py Tue Jan 29 23:36:44 2008
@@ -1,4 +1,4 @@
-# Copyright 2006, 2007 Brailcom, o.p.s.
+# Copyright 2006, 2007, 2008 Brailcom, o.p.s.
#
# Author: Tomas Cerha <cerha brailcom org>
#
@@ -54,10 +54,8 @@
else:
_speechd_available = True
try:
- # Done this way to prevent a pychecker warning.
- callbackKey = "CallbackType"
- setattr(speechd, callbackKey, getattr(speechd, callbackKey))
- except ImportError:
+ getattr(speechd, "CallbackType")
+ except AttributeError:
_speechd_version_ok = False
else:
_speechd_version_ok = True
@@ -129,9 +127,10 @@
# *** Instance methods ***
def __init__(self, serverId):
- speechserver.SpeechServer.__init__(self)
-
+ super(SpeechServer, self).__init__()
self._id = serverId
+ self._client = None
+ self._current_voice_properties = {}
self._acss_manipulators = (
(ACSS.RATE, self._set_rate),
(ACSS.AVERAGE_PITCH, self._set_pitch),
@@ -160,12 +159,6 @@
speechd.CallbackType.END: speechserver.SayAllContext.COMPLETED,
#speechd.CallbackType.INDEX_MARK:speechserver.SayAllContext.PROGRESS,
}
-
- # Initialize variables to None to make pylint happy.
- #
- self._current_voice_properties = None
- self._client = None
-
# Translators: This string will appear in the list of
# available voices for the current speech engine. %s will be
# replaced by the name of the current speech engine, such as
@@ -237,16 +230,17 @@
self._send_command(set_synthesis_voice, name)
def _apply_acss(self, acss):
+ if acss is None:
+ acss = settings.voices[settings.DEFAULT_VOICE]
current = self._current_voice_properties
- for thisProperty, method in self._acss_manipulators:
- value = acss.get(thisProperty)
- if value is not None and current.get(thisProperty) != value:
+ for acss_property, method in self._acss_manipulators:
+ value = acss.get(acss_property)
+ if value is not None and current.get(acss_property) != value:
method(value)
- current[thisProperty] = value
+ current[acss_property] = value
def _speak(self, text, acss, **kwargs):
- if acss is not None:
- self._apply_acss(acss)
+ self._apply_acss(acss)
self._send_command(self._client.speak, text, **kwargs)
def _say_all(self, iterator, orca_callback):
@@ -350,7 +344,11 @@
gobject.idle_add(self._say_all, utteranceIterator, progressCallback)
def speakCharacter(self, character, acss=None):
- self._send_command(self._client.char, character)
+ self._apply_acss(acss)
+ if character == '\n':
+ self._send_command(self._client.sound_icon, 'end-of-line')
+ else:
+ self._send_command(self._client.char, character)
def speakKeyEvent(self, event_string, eventType):
if eventType == orca.KeyEventType.PRINTABLE:
@@ -358,12 +356,11 @@
# Dispatcher's KEY command. For other keys, such as Ctrl, Shift
# etc. we prefer Orca's verbalization.
if event_string.decode("UTF-8").isupper():
- voice = settings.voices[settings.UPPERCASE_VOICE]
+ acss = settings.voices[settings.UPPERCASE_VOICE]
else:
- voice = settings.voices[settings.DEFAULT_VOICE]
+ acss = None
key = self.KEY_NAMES.get(event_string, event_string)
- if voice is not None:
- self._apply_acss(voice)
+ self._apply_acss(acss)
self._send_command(self._client.key, key)
else:
return super(SpeechServer, self).speakKeyEvent(event_string,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]