fix things

This commit is contained in:
chrys 2016-07-12 17:13:59 +02:00
parent f67176771a
commit 0fb493e391
3 changed files with 7 additions and 18 deletions

View File

@ -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):

View File

@ -1,6 +1,7 @@
#!/bin/python
from configparser import ConfigParser
from core.settings import settings
import evdev
class settingsManager():
def __init__(self):

View File

@ -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