orca r3527 - in branches/gnome-2-20: . src/orca



Author: wwalker
Date: Tue Jan 29 23:59:11 2008
New Revision: 3527
URL: http://svn.gnome.org/viewvc/orca?rev=3527&view=rev

Log:
Fix for Bug 512608 - Punctuation in keyboard review mode.


Modified:
   branches/gnome-2-20/ChangeLog
   branches/gnome-2-20/src/orca/default.py
   branches/gnome-2-20/src/orca/speech.py
   branches/gnome-2-20/src/orca/speechdispatcherfactory.py

Modified: branches/gnome-2-20/src/orca/default.py
==============================================================================
--- branches/gnome-2-20/src/orca/default.py	(original)
+++ branches/gnome-2-20/src/orca/default.py	Tue Jan 29 23:59:11 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
@@ -3983,10 +3983,10 @@
                     self.spellCurrentItem(string)
                 elif clickCount == 3:
                     self.phoneticSpellCurrentItem(string)
-                elif string.isupper():
-                    speech.speak(string, self.voices[settings.UPPERCASE_VOICE])
+                elif string.decode("UTF-8").isupper():
+                    speech.speakCharacter(string, self.voices[settings.UPPERCASE_VOICE])
                 else:
-                    speech.speak(string)
+                    speech.speakCharacter(string)
 
         self.updateBrailleReview()
 

Modified: branches/gnome-2-20/src/orca/speech.py
==============================================================================
--- branches/gnome-2-20/src/orca/speech.py	(original)
+++ branches/gnome-2-20/src/orca/speech.py	Tue Jan 29 23:59:11 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
@@ -193,8 +193,28 @@
         debug.println(debug.LEVEL_INFO, "SPEECH OUTPUT: '" + event_string +"'")
         log.info("speakKeyEvent utterance='%s'" % event_string)
 
+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: branches/gnome-2-20/src/orca/speechdispatcherfactory.py
==============================================================================
--- branches/gnome-2-20/src/orca/speechdispatcherfactory.py	(original)
+++ branches/gnome-2-20/src/orca/speechdispatcherfactory.py	Tue Jan 29 23:59:11 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>
 #
@@ -221,6 +221,8 @@
                 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 property, method in self._acss_manipulators:
             value = acss.get(property)
@@ -229,8 +231,7 @@
                 current[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):
@@ -333,20 +334,23 @@
         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, type):
         if type == orca.KeyEventType.PRINTABLE:
             # We currently only handle printable characters by Speech
             # 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, type)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]