From a277c10dcd41114b9d8a8de2be36befff5b540c6 Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 6 Aug 2016 15:33:17 +0200 Subject: [PATCH] initial char delete echo --- config/settings/settings.conf | 1 + ...ak_key_echo.py => 50000-speak_key_echo.py} | 0 ..._word_echo.py => 60000-speak_word_echo.py} | 0 .../65000-speak_char_delete_echo.py | 31 +++++++++++++++++++ src/fenrir-package/core/settings.py | 1 + 5 files changed, 33 insertions(+) rename src/fenrir-package/commands/onScreenChanged/{65000-speak_key_echo.py => 50000-speak_key_echo.py} (100%) rename src/fenrir-package/commands/onScreenChanged/{69000-speak_word_echo.py => 60000-speak_word_echo.py} (100%) create mode 100644 src/fenrir-package/commands/onScreenChanged/65000-speak_char_delete_echo.py diff --git a/config/settings/settings.conf b/config/settings/settings.conf index f2a1d865..7ee045d7 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -23,6 +23,7 @@ driver=linux [keyboard] keyboardLayout=desktop charEcho=False +charDeleteEcho=True wordEcho=True interruptOnKeyPress=False diff --git a/src/fenrir-package/commands/onScreenChanged/65000-speak_key_echo.py b/src/fenrir-package/commands/onScreenChanged/50000-speak_key_echo.py similarity index 100% rename from src/fenrir-package/commands/onScreenChanged/65000-speak_key_echo.py rename to src/fenrir-package/commands/onScreenChanged/50000-speak_key_echo.py diff --git a/src/fenrir-package/commands/onScreenChanged/69000-speak_word_echo.py b/src/fenrir-package/commands/onScreenChanged/60000-speak_word_echo.py similarity index 100% rename from src/fenrir-package/commands/onScreenChanged/69000-speak_word_echo.py rename to src/fenrir-package/commands/onScreenChanged/60000-speak_word_echo.py diff --git a/src/fenrir-package/commands/onScreenChanged/65000-speak_char_delete_echo.py b/src/fenrir-package/commands/onScreenChanged/65000-speak_char_delete_echo.py new file mode 100644 index 00000000..4ae3dc45 --- /dev/null +++ b/src/fenrir-package/commands/onScreenChanged/65000-speak_char_delete_echo.py @@ -0,0 +1,31 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + + if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charDeleteEcho'): + return environment + # detect typing + if environment['screenData']['newCursor']['x'] > environment['screenData']['oldCursor']['x']: + return environment + # TTY change + if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: + return environment + # More than just a deletion happend + if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']: + return environment + # No deletion + if environment['screenData']['newNegativeDelta'] == environment['screenData']['oldNegativeDelta']: + return environment + if environment['screenData']['newNegativeDelta'] == '': + return environment + + environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newNegativeDelta'], interrupt=True) + + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/core/settings.py b/src/fenrir-package/core/settings.py index cf2c9ad4..5c3fec4e 100644 --- a/src/fenrir-package/core/settings.py +++ b/src/fenrir-package/core/settings.py @@ -33,6 +33,7 @@ settings = { 'keyboard':{ 'keyboardLayout': "desktop", 'charEcho':False, + 'charDeleteEcho':True, 'wordEcho':True, 'interruptOnKeyPress': True, }