From dc6a635e1fe2146bc94758527f467664faf56c4b Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 1 Oct 2016 02:54:56 +0200 Subject: [PATCH] respect grap keyboard setting --- config/settings/settings.conf | 12 ++++++------ src/fenrir-package/core/inputManager.py | 10 +++++++--- src/fenrir-package/fenrir.py | 1 - src/fenrir-package/inputDriver/evdev.py | 7 +++++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 677dd232..a850ba33 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -58,7 +58,7 @@ voice= language=english-us # Read new text as it happens? -autoReadIncoming=True +autoReadIncomming=True [braille] #braille is not implemented yet @@ -70,7 +70,7 @@ driver=linux encoding=cp850 screenUpdateDelay=0.4 suspendingScreen= -autodetectSuspendingScreen=True +autodetectSuspendingScreen=False [keyboard] driver=evdev @@ -79,13 +79,13 @@ device=all grabDevices=True ignoreShortcuts=False # the current shortcut layout located in /etc/fenrir/keyboard -keyboardLayout=desktop +keyboardLayout=test # echo chars while typing. -charEcho=False +charEcho=True # echo deleted chars charDeleteEcho=True # echo word after pressing space -wordEcho=False +wordEcho=True # interrupt speech on any keypress interruptOnKeyPress=False # timeout for double tap in sec @@ -96,7 +96,7 @@ debugLevel=0 punctuationLevel=Some numberOfClipboards=10 # define the current fenrir key -fenrirKeys=KEY_KP0,KEY_META +fenrirKeys=KEY_KP0 timeFormat=%H:%M:%P dateFormat=%A, %B %d, %Y autoSpellCheck=True diff --git a/src/fenrir-package/core/inputManager.py b/src/fenrir-package/core/inputManager.py index 1ff79250..f5309cea 100644 --- a/src/fenrir-package/core/inputManager.py +++ b/src/fenrir-package/core/inputManager.py @@ -70,7 +70,10 @@ class inputManager(): self.env['runtime']['inputDriver'].grabDevices() def releaseDevices(self): - self.env['runtime']['inputDriver'].releaseDevices() + try: + self.env['runtime']['inputDriver'].releaseDevices() + except: + pass def convertEventName(self, eventName): if not eventName: @@ -110,8 +113,9 @@ class inputManager(): def writeEventBuffer(self): try: - self.env['runtime']['inputDriver'].writeEventBuffer() - time.sleep(0.0005) + if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): + self.env['runtime']['inputDriver'].writeEventBuffer() + time.sleep(0.005) self.clearEventBuffer() except Exception as e: print(e) diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index 863776aa..d83fd5c9 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -41,7 +41,6 @@ class fenrir(): self.prepareCommand() if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen(): self.environment['runtime']['inputManager'].writeEventBuffer() - time.sleep(0.005) if self.environment['runtime']['inputManager'].noKeyPressed(): if self.wasCommand: self.wasCommand = False diff --git a/src/fenrir-package/inputDriver/evdev.py b/src/fenrir-package/inputDriver/evdev.py index 6817e37a..9258b86b 100644 --- a/src/fenrir-package/inputDriver/evdev.py +++ b/src/fenrir-package/inputDriver/evdev.py @@ -25,6 +25,10 @@ class driver(): def shutdown(self): pass def getInputEvent(self): + if not self.iDevices: + return None + if self.iDevices == {}: + return None event = None r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay')) if r != []: @@ -42,14 +46,13 @@ class driver(): def writeEventBuffer(self): for iDevice, uDevice, event in self.env['input']['eventBuffer']: self.writeUInput(uDevice, event) - uDevice.syn() def clearEventBuffer(self): del self.env['input']['eventBuffer'][:] def writeUInput(self, uDevice, event): uDevice.write_event(event) - + uDevice.syn() def getInputDevices(self): # 3 pos absolute # 2 pos relative