threading test

This commit is contained in:
chrys
2016-07-10 23:02:17 +02:00
parent 28a3da7e52
commit fa3a15f5bc
5 changed files with 49 additions and 35 deletions

View File

@ -27,11 +27,11 @@ class commandManager():
def executeCommand(self, environment, currCommand, section = 'commands'):
if self.isCommandDefined(environment):
#try:
environ = environment['commands'][section][currCommand].run(environment)
if environ != None:
environment = environ
#except:
try:
environ = environment['commands'][section][currCommand].run(environment)
if environ != None:
environment = environ
except:
pass
environment['commandInfo']['currCommand'] = ''
return environment

View File

@ -1,10 +1,10 @@
#!/bin/python
#from commands import curr_line
#from commands import shut_up
import time
commandInfo = {
'currCommand': '',
'commandCueue':[]
'commandCueue':[],
'lastCommandTime': time.time()
}
commands = {

View File

@ -11,15 +11,19 @@ class inputManager():
#for dev in self.devices.values(): print(dev)
def getKeyPressed(self, environment):
r, w, x = select(self.devices, [], [])
r, w, x = select(self.devices, [], [],0)
currShortcut = environment['input']['currShortcut']
for fd in r:
for event in self.devices[fd].read():
if event.type == evdev.ecodes.EV_KEY:
if event.value != 0:
currShortcut[str(event.code)] = event.value
else:
del(currShortcut[str(event.code)])
if r != []:
for fd in r:
for event in self.devices[fd].read():
if event.type == evdev.ecodes.EV_KEY:
if event.value != 0:
currShortcut[str(event.code)] = event.value
else:
try:
del(currShortcut[str(event.code)])
except:
pass
environment['input']['currShortcut'] = currShortcut
environment['input']['currShortcutString'] = self.getShortcutString(environment)
return environment