diff --git a/src/fenrir-package/core/commandManager.py b/src/fenrir-package/core/commandManager.py index 220850c0..dc440a7c 100644 --- a/src/fenrir-package/core/commandManager.py +++ b/src/fenrir-package/core/commandManager.py @@ -2,6 +2,7 @@ import importlib.util import glob import os +import time class commandManager(): def __init__(self): @@ -34,6 +35,7 @@ class commandManager(): except: pass environment['commandInfo']['currCommand'] = '' + environment['commandInfo']['lastCommandTime'] = time.time() return environment def executeNextCommand(self, environment): diff --git a/src/fenrir-package/core/settingsManager.py b/src/fenrir-package/core/settingsManager.py index 4e66c4a1..63f76082 100644 --- a/src/fenrir-package/core/settingsManager.py +++ b/src/fenrir-package/core/settingsManager.py @@ -1,6 +1,7 @@ #!/bin/python from configparser import ConfigParser from core.settings import settings +import evdev class settingsManager(): def __init__(self): diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index cac74bbf..9aa76e9e 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -40,46 +40,32 @@ class fenrir(): self.environment['runtime']['screenDriver'] = lx.screenManager() def proceed(self): - self.threadUpdateScreen = Thread(target=self.updateScreen, args=()) + #self.threadUpdateScreen = Thread(target=self.updateScreen, args=()) self.threadHandleInput = Thread(target=self.handleInput, args=()) - self.threadCommands = Thread(target=self.handleCommands, args=()) - self.threadUpdateScreen.start() + #self.threadCommands = Thread(target=self.handleCommands, args=()) + #self.threadUpdateScreen.start() self.threadHandleInput.start() #self.threadCommands.start() while(self.environment['generalInformation']['running']): - #starttime = time.time() - time.sleep(1) - #self.updateScreen() - #self.handleInput() - #self.handleCommands() - #print(time.time() -starttime) + self.updateScreen() self.shutdown() def handleInput(self): while(self.environment['generalInformation']['running']): self.environment = self.environment['runtime']['inputManager'].getKeyPressed(self.environment) self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment) - #print(self.environment['screenData']['delta']) if self.environment['input']['currShortcutString'] != '': self.handleCommands() - print('läuft') - #if self.environment['input']['currShortcutString'] == '': - # self.environment['commandInfo']['currCommand'] = '' def updateScreen(self): - while(self.environment['generalInformation']['running']): self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment) time.sleep(0.5) def handleCommands(self): - #while(self.environment['generalInformation']['running']): self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment) - #self.environment['input']['currShortcut'] = {} - print( self.environment['commandInfo']['currCommand'] ) if (self.environment['commandInfo']['currCommand'] != '') and \ (time.time() - self.environment['commandInfo']['lastCommandTime'] >= 0.4): self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands') - #time.sleep(0.5) def shutdown(self): self.environment['generalInformation']['running'] = False