fix things

This commit is contained in:
root 2016-07-12 16:51:26 +02:00
parent d17135da01
commit f67176771a
3 changed files with 20 additions and 14 deletions

View File

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

View File

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

View File

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