diff --git a/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py b/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py new file mode 100644 index 00000000..d3b6cd3b --- /dev/null +++ b/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py @@ -0,0 +1,33 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + # if the filter is set + #if self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').strip() != '': + # filterList = self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').split(',') + # for currInput in self.env['input']['currInput']: + # if not currInput in filterList: + # return + self.env['runtime']['outputManager'].interruptOutput() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py b/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py new file mode 100644 index 00000000..c000e241 --- /dev/null +++ b/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py @@ -0,0 +1,27 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.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 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/fenrirscreenreader/commands/onInput/__init__.py b/src/fenrirscreenreader/commands/onByteInput/__init__.py similarity index 100% rename from src/fenrirscreenreader/commands/onInput/__init__.py rename to src/fenrirscreenreader/commands/onByteInput/__init__.py diff --git a/src/fenrirscreenreader/commands/onInput/10000-shut_up.py b/src/fenrirscreenreader/commands/onKeyInput/10000-shut_up.py similarity index 100% rename from src/fenrirscreenreader/commands/onInput/10000-shut_up.py rename to src/fenrirscreenreader/commands/onKeyInput/10000-shut_up.py diff --git a/src/fenrirscreenreader/commands/onInput/15000-enable_temp_speech.py b/src/fenrirscreenreader/commands/onKeyInput/15000-enable_temp_speech.py similarity index 100% rename from src/fenrirscreenreader/commands/onInput/15000-enable_temp_speech.py rename to src/fenrirscreenreader/commands/onKeyInput/15000-enable_temp_speech.py diff --git a/src/fenrirscreenreader/commands/onInput/80000-capslock.py b/src/fenrirscreenreader/commands/onKeyInput/80000-capslock.py similarity index 100% rename from src/fenrirscreenreader/commands/onInput/80000-capslock.py rename to src/fenrirscreenreader/commands/onKeyInput/80000-capslock.py diff --git a/src/fenrirscreenreader/commands/onInput/80300-scrolllock.py b/src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.py similarity index 100% rename from src/fenrirscreenreader/commands/onInput/80300-scrolllock.py rename to src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.py diff --git a/src/fenrirscreenreader/commands/onInput/80500-numlock.py b/src/fenrirscreenreader/commands/onKeyInput/80500-numlock.py similarity index 100% rename from src/fenrirscreenreader/commands/onInput/80500-numlock.py rename to src/fenrirscreenreader/commands/onKeyInput/80500-numlock.py diff --git a/src/fenrirscreenreader/commands/onKeyInput/__init__.py b/src/fenrirscreenreader/commands/onKeyInput/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/fenrirscreenreader/core/fenrirManager.py b/src/fenrirscreenreader/core/fenrirManager.py index b5c6f1e4..40c87dcb 100644 --- a/src/fenrirscreenreader/core/fenrirManager.py +++ b/src/fenrirscreenreader/core/fenrirManager.py @@ -83,14 +83,14 @@ class fenrirManager(): self.singleKeyCommand = False if self.environment['input']['keyForeward'] > 0: self.environment['input']['keyForeward'] -=1 - self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') + self.environment['runtime']['commandManager'].executeDefaultTrigger('onKeyInput') #print('handleInput:',time.time() - startTime) def handleByteInput(self, event): if not event['Data']: return if event['Data'] == b'': return - + self.environment['runtime']['commandManager'].executeDefaultTrigger('onByteInput') isCommand = False if self.controlMode and not self.switchCtrlModeOnce == 1 or\ not self.controlMode and self.switchCtrlModeOnce == 1: diff --git a/src/fenrirscreenreader/core/generalData.py b/src/fenrirscreenreader/core/generalData.py index 26e6ac79..c4b41633 100644 --- a/src/fenrirscreenreader/core/generalData.py +++ b/src/fenrirscreenreader/core/generalData.py @@ -13,6 +13,6 @@ generalData = { 'prevUser':'', 'managerList':['processManager', 'punctuationManager', 'byteManager', 'cursorManager', 'applicationManager', 'commandManager' , 'screenManager', 'inputManager','outputManager', 'helpManager', 'memoryManager', 'eventManager', 'debug'], -'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice' +'commandFolderList':['commands','onKeyInput', 'onByteInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice' ,'onApplicationChange','onSwitchApplicationProfile','help',], }