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