[orca] Attempt to reconnect to speech-dispatcher when setting capitalization style
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Attempt to reconnect to speech-dispatcher when setting capitalization style
- Date: Wed, 3 Jun 2020 21:16:01 +0000 (UTC)
commit f799e36b663f76ab528c2ad101bccebce13dbfb8
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jun 3 17:13:10 2020 -0400
Attempt to reconnect to speech-dispatcher when setting capitalization style
Also remove guard related to SSIPCommunicationError. Looks like that's
been around since at least 2010.
src/orca/speechdispatcherfactory.py | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 58c6410bf..53e1888c0 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -187,7 +187,16 @@ class SpeechServer(speechserver.SpeechServer):
style = 'spell'
else:
style = 'none'
- self._client.set_cap_let_recogn(style)
+
+ try:
+ self._client.set_cap_let_recogn(style)
+ except speechd.SSIPCommunicationError:
+ msg = "SPEECH DISPATCHER: Connection lost. Trying to reconnect."
+ debug.println(debug.LEVEL_INFO, msg, True)
+ self.reset()
+ self._client.set_cap_let_recogn(style)
+ except:
+ pass
def updatePunctuationLevel(self):
""" Punctuation level changed, inform this speechServer. """
@@ -195,19 +204,15 @@ class SpeechServer(speechserver.SpeechServer):
self._client.set_punctuation(mode)
def _send_command(self, command, *args, **kwargs):
- if hasattr(speechd, 'SSIPCommunicationError'):
- try:
- return command(*args, **kwargs)
- except speechd.SSIPCommunicationError:
- msg = "SPEECH DISPATCHER: Connection lost. Trying to reconnect."
- debug.println(debug.LEVEL_INFO, msg, True)
- self.reset()
- return command(*args, **kwargs)
- except:
- pass
- else:
- # It is not possible tho catch the error with older SD versions.
+ try:
return command(*args, **kwargs)
+ except speechd.SSIPCommunicationError:
+ msg = "SPEECH DISPATCHER: Connection lost. Trying to reconnect."
+ debug.println(debug.LEVEL_INFO, msg, True)
+ self.reset()
+ return command(*args, **kwargs)
+ except:
+ pass
def _set_rate(self, acss_rate):
rate = int(2 * max(0, min(99, acss_rate)) - 98)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]