diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 6bad69aa..170c4b22 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -70,6 +70,7 @@ KEY_KPPLUS=last_incoming KEY_FENRIR,KEY_F2=toggle_braille KEY_FENRIR,KEY_F3=toggle_sound KEY_FENRIR,KEY_F4=toggle_speech +#=temp_disable_speech KEY_FENRIR,KEY_CTRL,KEY_P=toggle_punctuation_level KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check KEY_FENRIR,KEY_BACKSLASH=toggle_output diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index e6e4c6e5..da353ea7 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -70,6 +70,7 @@ KEY_FENRIR,KEY_SEMICOLON=last_incoming KEY_FENRIR,KEY_F2=toggle_braille KEY_FENRIR,KEY_F3=toggle_sound KEY_FENRIR,KEY_F4=toggle_speech +#=temp_disable_speech KEY_FENRIR,KEY_SHIFT,KEY_CTRL,KEY_P=toggle_punctuation_level KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check KEY_FENRIR,KEY_SHIFT,KEY_ENTER=toggle_output diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index a652aca5..4467ccee 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -69,7 +69,8 @@ KEY_FENRIR,KEY_KPSLASH=set_window_application KEY_KPPLUS=last_incoming KEY_FENRIR,KEY_F2=toggle_braille KEY_FENRIR,KEY_F3=toggle_sound -KEY_FENRIR,KEY_F4=toggle_speech +#=toggle_speech +KEY_FENRIR,KEY_F4=temp_disable_speech KEY_FENRIR,KEY_CTRL,KEY_P=toggle_punctuation_level KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check KEY_FENRIR,KEY_BACKSLASH=toggle_output diff --git a/src/fenrir/commands/commands/temp_disable_speech.py b/src/fenrir/commands/commands/temp_disable_speech.py new file mode 100644 index 00000000..f9bd01f0 --- /dev/null +++ b/src/fenrir/commands/commands/temp_disable_speech.py @@ -0,0 +1,26 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'disables speech until next keypress' + + def run(self): + if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): + self.env['runtime']['outputManager'].presentText("speech temporary disabled", soundIcon='SpeechOff', interrupt=True) + self.env['commandBuffer']['enableSpeechOnKeypress'] = True + self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'))) + + def setCallback(self, callback): + pass diff --git a/src/fenrir/commands/onInput/15000-enable_temp_speech.py b/src/fenrir/commands/onInput/15000-enable_temp_speech.py new file mode 100644 index 00000000..e9d3d85c --- /dev/null +++ b/src/fenrir/commands/onInput/15000-enable_temp_speech.py @@ -0,0 +1,31 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'disables speech until next keypress' + + def run(self): + if self.env['runtime']['inputManager'].noKeyPressed(): + return + if len(self.env['input']['prevInput']) >0: + return + if not self.env['commandBuffer']['enableSpeechOnKeypress']: + return + self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(self.env['commandBuffer']['enableSpeechOnKeypress'])) + self.env['commandBuffer']['enableSpeechOnKeypress'] = False + self.env['runtime']['outputManager'].presentText("speech enabled", soundIcon='SpeechOn', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrir/core/commands.py b/src/fenrir/core/commands.py index df5f1e50..c3ea2fae 100644 --- a/src/fenrir/core/commands.py +++ b/src/fenrir/core/commands.py @@ -11,6 +11,7 @@ import time # used as shared memory between commands # use this in your own commands commandBuffer = { +'enableSpeechOnKeypress': False, 'genericList':[], 'genericListSource':'', 'genericListSelection': 0,