From 0410c33a08bc3991664ad1095ff7ef62a1f45ae8 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 17 Jul 2016 14:25:59 +0200 Subject: [PATCH] keyboard echo --- config/settings/settings.cfg | 6 ++++- .../onScreenChanged/70000-speak_incomming.py | 6 +++++ src/fenrir-package/core/settings.py | 5 ++++ src/fenrir-package/core/settingsManager.py | 25 ++++++++++++++----- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/config/settings/settings.cfg b/config/settings/settings.cfg index 2b9cc227..41758c90 100644 --- a/config/settings/settings.cfg +++ b/config/settings/settings.cfg @@ -21,8 +21,12 @@ layout=en ['screen] driver=linux -[general] +[keyboard] keyboardLayout=desktop +charEcho=False +wordEcho=True + +[general] debugLevel=0 punctuationLevel=1 diff --git a/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py b/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py index 2cc8bc6f..b1c5be95 100644 --- a/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py +++ b/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py @@ -4,6 +4,12 @@ class command(): def __init__(self): pass def run(self, environment): + print(environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho') ) + if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho') and\ + len(environment['screenData']['newDelta']) <= 2 and \ + environment['screenData']['newCursor'] != environment['screenData']['oldCursor']: + print('dri') + return environment if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \ environment['screenData']['newTTY'] == environment['screenData']['oldTTY']: return environment diff --git a/src/fenrir-package/core/settings.py b/src/fenrir-package/core/settings.py index 5f9dc820..7499f803 100644 --- a/src/fenrir-package/core/settings.py +++ b/src/fenrir-package/core/settings.py @@ -29,5 +29,10 @@ settings = { 'keyboardLayout': "desktop", 'debugLevel': debug.debugLevel.DEACTIVE, 'punctuationLevel': 1 +}, +'keyboard':{ + 'keyboardLayout': "desktop", + 'charEcho':False, + 'wordEcho':True, } } diff --git a/src/fenrir-package/core/settingsManager.py b/src/fenrir-package/core/settingsManager.py index 2a145991..e7464a00 100644 --- a/src/fenrir-package/core/settingsManager.py +++ b/src/fenrir-package/core/settingsManager.py @@ -81,14 +81,27 @@ class settingsManager(): return value def getSettingAsInt(self, environment, section, setting): - return int(self.getSetting( environment, section, setting)) - + value = '' + try: + value = environment['settings'].getint(section, setting) + except: + value = self.settings[section][setting] + return value + def getSettingAsFloat(self, environment, section, setting): - return float(self.getSetting( environment, section, setting)) - + value = '' + try: + value = environment['settings'].getfloat(section, setting) + except: + value = self.settings[section][setting] + return value def getSettingAsBool(self, environment, section, setting): - return bool(self.getSetting(environment, section, setting)) - + value = '' + try: + value = environment['settings'].getboolean(section, setting) + except: + value = self.settings[section][setting] + return value def loadSpeechDriver(self, environment, driverName): if environment['runtime']['speechDriver'] != None: environment['runtime']['speechDriver'].shutdown()