clean up code/ dont crash if keyboard unplugs
This commit is contained in:
parent
119a36a6ca
commit
21e7f68235
@ -11,4 +11,6 @@ generalInformation = {
|
|||||||
'tutorialMode': False,
|
'tutorialMode': False,
|
||||||
'currUser':'',
|
'currUser':'',
|
||||||
'prevUser':'',
|
'prevUser':'',
|
||||||
|
'managerList':['inputManager','screenManager','commandManager','outputManager'
|
||||||
|
,'punctuationManager','cursorManager','applicationManager','debug'],
|
||||||
}
|
}
|
||||||
|
@ -97,35 +97,11 @@ class fenrir():
|
|||||||
self.shutdownRequest()
|
self.shutdownRequest()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if self.environment['runtime']['inputManager']:
|
self.environment['runtime']['outputManager'].presentText("Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
|
||||||
self.environment['runtime']['inputManager'].shutdown()
|
for currManager in self.environment['generalInformation']['managerList']:
|
||||||
del self.environment['runtime']['inputManager']
|
if self.environment['runtime'][currManager]:
|
||||||
self.environment['runtime']['outputManager'].presentText("Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
|
self.environment['runtime'][currManager].shutdown()
|
||||||
time.sleep(0.9) # wait a little for sound
|
del self.environment['runtime'][currManager]
|
||||||
|
|
||||||
if self.environment['runtime']['screenManager']:
|
|
||||||
self.environment['runtime']['screenManager'].shutdown()
|
|
||||||
del self.environment['runtime']['screenManager']
|
|
||||||
if self.environment['runtime']['commandManager']:
|
|
||||||
self.environment['runtime']['commandManager'].shutdown()
|
|
||||||
del self.environment['runtime']['commandManager']
|
|
||||||
if self.environment['runtime']['outputManager']:
|
|
||||||
self.environment['runtime']['outputManager'].shutdown()
|
|
||||||
del self.environment['runtime']['outputManager']
|
|
||||||
if self.environment['runtime']['punctuationManager']:
|
|
||||||
self.environment['runtime']['punctuationManager'].shutdown()
|
|
||||||
del self.environment['runtime']['punctuationManager']
|
|
||||||
if self.environment['runtime']['cursorManager']:
|
|
||||||
self.environment['runtime']['cursorManager'].shutdown()
|
|
||||||
del self.environment['runtime']['cursorManager']
|
|
||||||
if self.environment['runtime']['applicationManager']:
|
|
||||||
self.environment['runtime']['applicationManager'].shutdown()
|
|
||||||
del self.environment['runtime']['applicationManager']
|
|
||||||
|
|
||||||
if self.environment['runtime']['debug']:
|
|
||||||
self.environment['runtime']['debug'].shutdown()
|
|
||||||
del self.environment['runtime']['debug']
|
|
||||||
time.sleep(0.2) # wait a little before splatter it :)
|
|
||||||
self.environment = None
|
self.environment = None
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -50,7 +50,12 @@ class driver():
|
|||||||
r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay'))
|
r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay'))
|
||||||
if r != []:
|
if r != []:
|
||||||
for fd in r:
|
for fd in r:
|
||||||
event = self.iDevices[fd].read_one()
|
try:
|
||||||
|
event = self.iDevices[fd].read_one()
|
||||||
|
except:
|
||||||
|
#print('jow')
|
||||||
|
del(self.iDevices[fd])
|
||||||
|
return None
|
||||||
foreward = False
|
foreward = False
|
||||||
while(event):
|
while(event):
|
||||||
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
||||||
|
Loading…
Reference in New Issue
Block a user