[orca-devel] [PATCH] Implement updatePunctuationLevel for espeechfactory.SpeechServer.



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.
---
 src/orca/espeechfactory.py |   14 +++++++++++++-
 src/orca/speechserver.py   |    4 ++++
 2 files changed, 17 insertions(+), 1 deletions(-)

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
-- 
1.7.8.2



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