From f354d1cd387fe608527cfb34c65b2917d89eec10 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 9 Mar 2018 14:54:19 +0100 Subject: [PATCH] cleanups --- src/fenrir/core/fenrirManager.py | 46 ++++++++++++++------------- src/fenrir/inputDriver/evdevDriver.py | 7 ---- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/fenrir/core/fenrirManager.py b/src/fenrir/core/fenrirManager.py index 489a1415..788b00a0 100644 --- a/src/fenrir/core/fenrirManager.py +++ b/src/fenrir/core/fenrirManager.py @@ -56,32 +56,34 @@ class fenrirManager(): if event['Data']: event['Data']['EventName'] = self.environment['runtime']['inputManager'].convertEventName(event['Data']['EventName']) self.environment['runtime']['inputManager'].handleInputEvent(event['Data']) + else: + return if self.environment['runtime']['inputManager'].noKeyPressed(): self.environment['runtime']['inputManager'].clearLastDeepInput() - if True: - if self.environment['runtime']['screenManager'].isSuspendingScreen(): - self.environment['runtime']['inputManager'].writeEventBuffer() - else: - if self.environment['runtime']['helpManager'].isTutorialMode(): - self.environment['runtime']['inputManager'].clearEventBuffer() - self.detectCommand() + if self.environment['runtime']['screenManager'].isSuspendingScreen(): + self.environment['runtime']['inputManager'].writeEventBuffer() + else: + if self.environment['runtime']['helpManager'].isTutorialMode(): + self.environment['runtime']['inputManager'].clearEventBuffer() - if self.modifierInput: - self.environment['runtime']['inputManager'].clearEventBuffer() - if self.singleKeyCommand: - if self.environment['runtime']['inputManager'].noKeyPressed(): - self.environment['runtime']['inputManager'].clearEventBuffer() - else: - self.environment['runtime']['inputManager'].writeEventBuffer() - if self.environment['runtime']['inputManager'].noKeyPressed(): - self.modifierInput = False - self.singleKeyCommand = False - if self.environment['input']['keyForeward'] > 0: - self.environment['input']['keyForeward'] -=1 - self.environment['runtime']['screenManager'].update('onInput') - self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') - #print('handleInput:',time.time() - startTime) + self.detectCommand() + + if self.modifierInput: + self.environment['runtime']['inputManager'].clearEventBuffer() + if self.singleKeyCommand: + if self.environment['runtime']['inputManager'].noKeyPressed(): + self.environment['runtime']['inputManager'].clearEventBuffer() + else: + self.environment['runtime']['inputManager'].writeEventBuffer() + if self.environment['runtime']['inputManager'].noKeyPressed(): + self.modifierInput = False + self.singleKeyCommand = False + if self.environment['input']['keyForeward'] > 0: + self.environment['input']['keyForeward'] -=1 + self.environment['runtime']['screenManager'].update('onInput') + self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') + #print('handleInput:',time.time() - startTime) def handleExecuteCommand(self, event): if event['Data'] == '': return diff --git a/src/fenrir/inputDriver/evdevDriver.py b/src/fenrir/inputDriver/evdevDriver.py index c75301ba..300dabc9 100644 --- a/src/fenrir/inputDriver/evdevDriver.py +++ b/src/fenrir/inputDriver/evdevDriver.py @@ -90,28 +90,21 @@ class driver(inputDriver): except: self.removeDevice(fd) while(event): - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT1:' + str(event),debug.debugLevel.INFO) self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event]) if event.type == evdev.events.EV_KEY: - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT2:' + str(event),debug.debugLevel.INFO) if event.code != 0: - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT3:' + str(event),debug.debugLevel.INFO) currMapEvent = self.mapEvent(event) if not currMapEvent: foreward = True - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT4:' + str(currMapEvent),debug.debugLevel.INFO) if not isinstance(currMapEvent['EventName'], str): foreward = True - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT5:' + str(currMapEvent),debug.debugLevel.INFO) if not foreward or eventFired: if currMapEvent['EventState'] in [0,1,2]: eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()}) eventFired = True - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT6:' + str(currMapEvent),debug.debugLevel.INFO) else: if not event.type in [0,4]: foreward = True - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT7:' + str(currMapEvent),debug.debugLevel.INFO) event = self.iDevices[fd].read_one() if foreward and not eventFired: