diff --git a/src/fenrir-package/core/inputManager.py b/src/fenrir-package/core/inputManager.py index ddcbb42b..e8596434 100644 --- a/src/fenrir-package/core/inputManager.py +++ b/src/fenrir-package/core/inputManager.py @@ -11,7 +11,7 @@ class inputManager(): #for dev in self.devices.values(): print(dev) def getKeyPressed(self, environment): - r, w, x = select(self.devices, [], [],0) + r, w, x = select(self.devices, [], []) currShortcut = environment['input']['currShortcut'] if r != []: for fd in r: diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index fd151206..cac74bbf 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -43,27 +43,33 @@ class fenrir(): 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.threadHandleInput.start() + self.threadUpdateScreen.start() + self.threadHandleInput.start() #self.threadCommands.start() while(self.environment['generalInformation']['running']): #starttime = time.time() - #time.sleep(0.2) - self.updateScreen() - self.handleInput() - self.handleCommands() + time.sleep(1) + #self.updateScreen() + #self.handleInput() + #self.handleCommands() #print(time.time() -starttime) self.shutdown() def handleInput(self): - #while(self.environment['generalInformation']['running']): - self.environment = self.environment['runtime']['inputManager'].getKeyPressed(self.environment) - #if self.environment['input']['currShortcutString'] == '': - # self.environment['commandInfo']['currCommand'] = '' + 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) + 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']): diff --git a/src/fenrir-package/screen/linux.py b/src/fenrir-package/screen/linux.py index 9a09e839..c3358bd1 100644 --- a/src/fenrir-package/screen/linux.py +++ b/src/fenrir-package/screen/linux.py @@ -54,7 +54,7 @@ class screenManager(): (len(environment['screenData']['newContentText']) > 0): diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'].split()), " ".join(environment['screenData']['newContentText'].split())) environment['screenData']['delta'] = ''.join(x[2:] for x in diff if x.startswith('+ ')) - if ((len(environment['screenData']['delta']) < 3)): + if ((len(environment['screenData']['delta']) == 1)): environment['runtime']['speechDriver'].cancel() environment['runtime']['speechDriver'].speak(environment['screenData']['delta']) # set new "old" values