[orca] Ensure we enable/disable speech based on app-specific settings



commit eb96a3512f1f564763aa492cc492f4da27683ba9
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri May 7 11:56:18 2021 +0200

    Ensure we enable/disable speech based on app-specific settings

 src/orca/scripts/default.py |  1 +
 src/orca/speech.py          | 10 ++++++++++
 2 files changed, 11 insertions(+)
---
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 867a65cbe..7156565bf 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -869,6 +869,7 @@ class Script(script.Script):
         _settingsManager.loadAppSettings(self)
         braille.checkBrailleSetting()
         braille.setupKeyRanges(self.brailleBindings.keys())
+        speech.checkSpeechSetting()
         speech.updatePunctuationLevel()
         speech.updateCapitalizationStyle()
 
diff --git a/src/orca/speech.py b/src/orca/speech.py
index f8cfb2395..2491491f0 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -124,6 +124,15 @@ def init():
 
     debug.println(debug.LEVEL_INFO, 'SPEECH: Initialized', True)
 
+def checkSpeechSetting():
+    msg = "SPEECH: Checking speech setting."
+    debug.println(debug.LEVEL_INFO, msg, True)
+
+    if not settings.enableSpeech:
+        shutdown()
+    else:
+        init()
+
 def __resolveACSS(acss=None):
     if isinstance(acss, ACSS):
         family = acss.get(acss.FAMILY)
@@ -340,6 +349,7 @@ def decreaseSpeechVolume(script=None, inputEvent=None):
     return True
 
 def shutdown():
+    debug.println(debug.LEVEL_INFO, 'SPEECH: Shutting down', True)
     global _speechserver
     if _speechserver:
         _speechserver.shutdownActiveServers()


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