From 592be62188f94c583a83b794e486b4d008e84e8b Mon Sep 17 00:00:00 2001 From: Chrys Date: Wed, 3 Aug 2016 19:43:36 +0200 Subject: [PATCH] initial rebuild of onInput commands --- .../commands/onInput/65000-speak_key_echo.py | 24 +++++++++++++++ .../commands/onInput/69000-speak_word_echo.py | 30 +++++++++++++++++++ .../onInput/80000-speak_tty_change.py | 17 +++++++++++ 3 files changed, 71 insertions(+) create mode 100644 src/fenrir-package/commands/onInput/65000-speak_key_echo.py create mode 100644 src/fenrir-package/commands/onInput/69000-speak_word_echo.py create mode 100644 src/fenrir-package/commands/onInput/80000-speak_tty_change.py diff --git a/src/fenrir-package/commands/onInput/65000-speak_key_echo.py b/src/fenrir-package/commands/onInput/65000-speak_key_echo.py new file mode 100644 index 00000000..1fab1a14 --- /dev/null +++ b/src/fenrir-package/commands/onInput/65000-speak_key_echo.py @@ -0,0 +1,24 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho'): + return environment + if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']: + return environment + + if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: + return environment + + if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']: + return environment + + environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True) + + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/onInput/69000-speak_word_echo.py b/src/fenrir-package/commands/onInput/69000-speak_word_echo.py new file mode 100644 index 00000000..a95f658a --- /dev/null +++ b/src/fenrir-package/commands/onInput/69000-speak_word_echo.py @@ -0,0 +1,30 @@ +#!/bin/python +from utils import word_utils + +class command(): + def __init__(self): + pass + def run(self, environment): + + if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho') and\ + environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']: + return environment + + if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: + return environment + + if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']: + return environment + + newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']] + x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursorReview']['x'], 0, newContent) + + if environment['screenData']['newCursor']['x'] > 0 and \ + newContent[environment['screenData']['newCursor']['x'] - 1] == ' ': + environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True) + + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/onInput/80000-speak_tty_change.py b/src/fenrir-package/commands/onInput/80000-speak_tty_change.py new file mode 100644 index 00000000..91b1b7a5 --- /dev/null +++ b/src/fenrir-package/commands/onInput/80000-speak_tty_change.py @@ -0,0 +1,17 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + + if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']: + return environment + environment['runtime']['outputManager'].playSoundIcon(environment,'ChangeTTY') + environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True) + + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass