fix things
This commit is contained in:
parent
d17135da01
commit
f67176771a
@ -11,7 +11,7 @@ class inputManager():
|
|||||||
#for dev in self.devices.values(): print(dev)
|
#for dev in self.devices.values(): print(dev)
|
||||||
|
|
||||||
def getKeyPressed(self, environment):
|
def getKeyPressed(self, environment):
|
||||||
r, w, x = select(self.devices, [], [],0)
|
r, w, x = select(self.devices, [], [])
|
||||||
currShortcut = environment['input']['currShortcut']
|
currShortcut = environment['input']['currShortcut']
|
||||||
if r != []:
|
if r != []:
|
||||||
for fd in r:
|
for fd in r:
|
||||||
|
@ -43,27 +43,33 @@ class fenrir():
|
|||||||
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()
|
#starttime = time.time()
|
||||||
#time.sleep(0.2)
|
time.sleep(1)
|
||||||
self.updateScreen()
|
#self.updateScreen()
|
||||||
self.handleInput()
|
#self.handleInput()
|
||||||
self.handleCommands()
|
#self.handleCommands()
|
||||||
#print(time.time() -starttime)
|
#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)
|
||||||
|
#print(self.environment['screenData']['delta'])
|
||||||
|
if self.environment['input']['currShortcutString'] != '':
|
||||||
|
self.handleCommands()
|
||||||
|
print('läuft')
|
||||||
#if self.environment['input']['currShortcutString'] == '':
|
#if self.environment['input']['currShortcutString'] == '':
|
||||||
# self.environment['commandInfo']['currCommand'] = ''
|
# self.environment['commandInfo']['currCommand'] = ''
|
||||||
|
|
||||||
def updateScreen(self):
|
def updateScreen(self):
|
||||||
#while(self.environment['generalInformation']['running']):
|
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)
|
||||||
|
|
||||||
def handleCommands(self):
|
def handleCommands(self):
|
||||||
#while(self.environment['generalInformation']['running']):
|
#while(self.environment['generalInformation']['running']):
|
||||||
|
@ -54,7 +54,7 @@ class screenManager():
|
|||||||
(len(environment['screenData']['newContentText']) > 0):
|
(len(environment['screenData']['newContentText']) > 0):
|
||||||
diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'].split()), " ".join(environment['screenData']['newContentText'].split()))
|
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('+ '))
|
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'].cancel()
|
||||||
environment['runtime']['speechDriver'].speak(environment['screenData']['delta'])
|
environment['runtime']['speechDriver'].speak(environment['screenData']['delta'])
|
||||||
# set new "old" values
|
# set new "old" values
|
||||||
|
Loading…
Reference in New Issue
Block a user