make fenrir quitable with eventloop, remove delay in evdevDriver

This commit is contained in:
Chrys 2017-06-21 14:22:22 +02:00
parent 461e9bb5b3
commit c8dd57e4b4
5 changed files with 7 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class command():
return _('exits Fenrir') return _('exits Fenrir')
def run(self): def run(self):
self.env['general']['running'] = False self.env['eventManager'].stopMainEventLoop()
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -42,6 +42,7 @@ class eventManager():
self.cleanEventQueue() self.cleanEventQueue()
def timerProcess(self): def timerProcess(self):
time.sleep(0.005) time.sleep(0.005)
#self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay')
return time.time() return time.time()
def terminateAllProcesses(self): def terminateAllProcesses(self):
for proc in self._eventProcesses: for proc in self._eventProcesses:
@ -118,7 +119,7 @@ class eventManager():
except Exception as e: except Exception as e:
print(e) print(e)
def simpleEventWorkerThread(self, event, function): def simpleEventWorkerThread(self, event, function, runOnce = False):
if not isinstance(event, fenrirEventType): if not isinstance(event, fenrirEventType):
return return
if not callable(function): if not callable(function):
@ -130,6 +131,8 @@ class eventManager():
except Exception as e: except Exception as e:
print(e) print(e)
self.putToEventQueue(event, Data) self.putToEventQueue(event, Data)
if runOnce:
break
''' '''
def p(): def p():
time.sleep(0.02) time.sleep(0.02)

View File

@ -109,7 +109,7 @@ class fenrirManager():
self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands') self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands')
def shutdownRequest(self): def shutdownRequest(self):
self.environment['general']['running'] = False self.environment['eventManager'].stopMainEventLoop()
def captureSignal(self, siginit, frame): def captureSignal(self, siginit, frame):
self.shutdownRequest() self.shutdownRequest()

View File

@ -7,7 +7,6 @@
from core import debug from core import debug
generalData = { generalData = {
'running': True,
'args': None, 'args': None,
'tutorialMode': False, 'tutorialMode': False,
'currUser':'', 'currUser':'',

View File

@ -42,7 +42,7 @@ class driver():
time.sleep(0.008) # dont flood CPU time.sleep(0.008) # dont flood CPU
return None return None
event = None event = None
r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay')) r, w, x = select(self.iDevices, [], [], 0)
if r != []: if r != []:
for fd in r: for fd in r:
try: try: