add command for temp disable speech
This commit is contained in:
26
src/fenrir/commands/commands/temp_disable_speech.py
Normal file
26
src/fenrir/commands/commands/temp_disable_speech.py
Normal file
@ -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
|
31
src/fenrir/commands/onInput/15000-enable_temp_speech.py
Normal file
31
src/fenrir/commands/onInput/15000-enable_temp_speech.py
Normal file
@ -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
|
@ -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,
|
||||
|
Reference in New Issue
Block a user