fix things
This commit is contained in:
parent
f67176771a
commit
0fb493e391
@ -2,6 +2,7 @@
|
|||||||
import importlib.util
|
import importlib.util
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
class commandManager():
|
class commandManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -34,6 +35,7 @@ class commandManager():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
environment['commandInfo']['currCommand'] = ''
|
environment['commandInfo']['currCommand'] = ''
|
||||||
|
environment['commandInfo']['lastCommandTime'] = time.time()
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
def executeNextCommand(self, environment):
|
def executeNextCommand(self, environment):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/python
|
#!/bin/python
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from core.settings import settings
|
from core.settings import settings
|
||||||
|
import evdev
|
||||||
|
|
||||||
class settingsManager():
|
class settingsManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -40,46 +40,32 @@ class fenrir():
|
|||||||
self.environment['runtime']['screenDriver'] = lx.screenManager()
|
self.environment['runtime']['screenDriver'] = lx.screenManager()
|
||||||
|
|
||||||
def proceed(self):
|
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.threadHandleInput = Thread(target=self.handleInput, args=())
|
||||||
self.threadCommands = Thread(target=self.handleCommands, args=())
|
#self.threadCommands = Thread(target=self.handleCommands, args=())
|
||||||
self.threadUpdateScreen.start()
|
#self.threadUpdateScreen.start()
|
||||||
self.threadHandleInput.start()
|
self.threadHandleInput.start()
|
||||||
#self.threadCommands.start()
|
#self.threadCommands.start()
|
||||||
while(self.environment['generalInformation']['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
#starttime = time.time()
|
self.updateScreen()
|
||||||
time.sleep(1)
|
|
||||||
#self.updateScreen()
|
|
||||||
#self.handleInput()
|
|
||||||
#self.handleCommands()
|
|
||||||
#print(time.time() -starttime)
|
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def handleInput(self):
|
def handleInput(self):
|
||||||
while(self.environment['generalInformation']['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
self.environment = self.environment['runtime']['inputManager'].getKeyPressed(self.environment)
|
self.environment = self.environment['runtime']['inputManager'].getKeyPressed(self.environment)
|
||||||
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment)
|
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment)
|
||||||
#print(self.environment['screenData']['delta'])
|
|
||||||
if self.environment['input']['currShortcutString'] != '':
|
if self.environment['input']['currShortcutString'] != '':
|
||||||
self.handleCommands()
|
self.handleCommands()
|
||||||
print('läuft')
|
|
||||||
#if self.environment['input']['currShortcutString'] == '':
|
|
||||||
# self.environment['commandInfo']['currCommand'] = ''
|
|
||||||
|
|
||||||
def updateScreen(self):
|
def updateScreen(self):
|
||||||
while(self.environment['generalInformation']['running']):
|
|
||||||
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment)
|
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
def handleCommands(self):
|
def handleCommands(self):
|
||||||
#while(self.environment['generalInformation']['running']):
|
|
||||||
self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment)
|
self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment)
|
||||||
#self.environment['input']['currShortcut'] = {}
|
|
||||||
print( self.environment['commandInfo']['currCommand'] )
|
|
||||||
if (self.environment['commandInfo']['currCommand'] != '') and \
|
if (self.environment['commandInfo']['currCommand'] != '') and \
|
||||||
(time.time() - self.environment['commandInfo']['lastCommandTime'] >= 0.4):
|
(time.time() - self.environment['commandInfo']['lastCommandTime'] >= 0.4):
|
||||||
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
||||||
#time.sleep(0.5)
|
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.environment['generalInformation']['running'] = False
|
self.environment['generalInformation']['running'] = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user