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')
def run(self):
self.env['general']['running'] = False
self.env['eventManager'].stopMainEventLoop()
def setCallback(self, callback):
pass

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ class driver():
time.sleep(0.008) # dont flood CPU
return 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 != []:
for fd in r:
try: