GNOME Bugzilla – Bug 667462
Implementation of updatePunctuationLevel for espeechfactory.SpeechServer.
Last modified: 2012-08-14 20:43:11 UTC
Created attachment 204802 [details] [review] It is a patch The method updatePunctuationLevel has been introduced for speechdispatcherfactory.SpeechServer but was being used as a part of general SpeechServer interface. This has broken espeechfactory.SpeechServer. To fix this problem the patch adds empty updatePunctuationLevel method to speechserver.SpeechServer and provides implementation for espeechfactory.SpeechServer.
Comment on attachment 204802 [details] [review] It is a patch diff --git a/src/orca/espeechfactory.py b/src/orca/espeechfactory.py index 0f53d92..2376518 100644 --- a/src/orca/espeechfactory.py +++ b/src/orca/espeechfactory.py @@ -204,7 +204,9 @@ class SpeechServer(speechserver.SpeechServer): self._settings = {} if initial: self._settings.update(initial) - self.configure(self._settings) + self._settings['punctuations'] = self._punc_map.get( + settings.verbalizePunctuationStyle, 'all') + self.configure(self._settings) def configure(self, engineSettings): """Configure engine with settings.""" @@ -404,6 +406,16 @@ class SpeechServer(speechserver.SpeechServer): self._output.write("tts_set_punctuations %s\n" % mode) self._output.flush() + _punc_map = { + settings.PUNCTUATION_STYLE_ALL: 'all', + settings.PUNCTUATION_STYLE_SOME: 'some', + settings.PUNCTUATION_STYLE_NONE: 'none', + } + + def updatePunctuationLevel(self): + """Punctuation level changed, inform this speechServer.""" + self.punctuations(self._punc_map.get(settings.verbalizePunctuationStyle, 'all')) + def rate(self, r): """Set speech rate.""" self._settings['rate'] = r diff --git a/src/orca/speechserver.py b/src/orca/speechserver.py index 2c7ed76..82972f5 100644 --- a/src/orca/speechserver.py +++ b/src/orca/speechserver.py @@ -281,6 +281,10 @@ class SpeechServer(object): """ pass + def updatePunctuationLevel(self): + """Punctuation level changed, inform this speechServer.""" + pass + def stop(self): """Stops ongoing speech and flushes the queue.""" pass
Created attachment 204804 [details] [review] Second attempt on adding a patch.
Comment on attachment 204804 [details] [review] Second attempt on adding a patch. Thanks! Committed to master. http://git.gnome.org/browse/orca/commit/?id=fb40f7c52ca845eb2b3f1915007af7cc07214220
Seems like we're getting tracebacks from this fix: Traceback (most recent call last):
+ Trace 229404
[''])
class SpeechServer(speechserver.SpeechServer):
settings.PUNCTUATION_STYLE_ALL: 'all',
I have just reversed the changes from this patch which were made in espeechfactory.py. NOTE that I have left the empty method added to speechserver.py. So hopefully that will cause Orca to not be broken for anyone. http://git.gnome.org/browse/orca/commit/?id=ebf1232affbd29685855258f2b06e0f609883f23
Sorry for breakage. I've created a new variant of patch, and this time I've tested it by loading espeechfactory into Python REPL. It loads and speaks without errors in my system.
Created attachment 204834 [details] [review] Corrected patch (third attempt)
See https://mail.gnome.org/archives/orca-list/2012-March/msg00297.html.