diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index cfe8108b..3755ead5 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -1,3 +1,4 @@ +#=toggle_tutorial_mode KEY_CTRL=shut_up KEY_FENRIR,KEY_KP9=review_bottom KEY_FENRIR,KEY_KP7=review_top diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index 76bed55b..3c4ee906 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -1,3 +1,4 @@ +#=toggle_tutorial_mode KEY_CTRL=shut_up KEY_FENRIR,KEY_SHIFT,KEY_O=review_bottom KEY_FENRIR,KEY_SHIFT,KEY_U=review_top diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index 2d22e33b..f99775bb 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -1,3 +1,4 @@ +#=toggle_tutorial_mode 1-KEY_LEFTCTRL=shut_up 1-FENRIR,1-KEY_RIGHTCTRL=shut_up 1-FENRIR,1-KEY_KPENTER=review_bottom diff --git a/src/fenrir-package/commands/commands/toggle_tutorial_mode.py b/src/fenrir-package/commands/commands/toggle_tutorial_mode.py new file mode 100644 index 00000000..b4d839b0 --- /dev/null +++ b/src/fenrir-package/commands/commands/toggle_tutorial_mode.py @@ -0,0 +1,20 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def initialize(self, environment): + return environment + def shutdown(self, environment): + return environment + def getDescription(self, environment): + environment['generalInformation']['tutorialMode'] = False + return 'You are leving the tutorial mode. Press that shortcut again to enter the tutorial mode again.' + + def run(self, environment): + text = 'you entered the tutorial mode. In that mode the commands are not executed. but you get an description what the shortcut does. to leve the tutorial mode press that shortcut again.' + environment['runtime']['outputManager'].presentText(environment, text, interrupt=True) + environment['generalInformation']['tutorialMode'] = True + return environment + def setCallback(self, callback): + pass diff --git a/src/fenrir-package/commands/onInput/10000-shut_up.py b/src/fenrir-package/commands/onInput/10000-shut_up.py new file mode 100644 index 00000000..aa29866e --- /dev/null +++ b/src/fenrir-package/commands/onInput/10000-shut_up.py @@ -0,0 +1,26 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def initialize(self, environment): + return environment + def shutdown(self, environment): + return environment + def getDescription(self, environment): + return '' + + def run(self, environment): + if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'interruptOnKeyPress'): + return environment + if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: + return environment +# if environment['screenData']['newCursor'] == environment['screenData']['oldCursor'] and\ +# environment['screenData']['newDelta'] == environment['screenData']['oldDelta']: +# return environment + if environment['input']['currShortcut'] != '': + return environment + environment['runtime']['outputManager'].interruptOutput(environment) + return environment + def setCallback(self, callback): + pass diff --git a/src/fenrir-package/core/inputManager.py b/src/fenrir-package/core/inputManager.py index 0ec0de41..082c05a6 100644 --- a/src/fenrir-package/core/inputManager.py +++ b/src/fenrir-package/core/inputManager.py @@ -28,7 +28,8 @@ class inputManager(): return timeout def grabDevices(self, environment): - environment['runtime']['inputDriver'].grabDevices(environment) + if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'grabDevices'): + environment['runtime']['inputDriver'].grabDevices(environment) def releaseDevices(self, environment): environment['runtime']['inputDriver'].releaseDevices()