Update inputManager.py

This commit is contained in:
chrys87 2017-02-28 11:38:15 +01:00 committed by GitHub
parent 51c2db5b85
commit 8e6d09df3d

View File

@ -15,7 +15,7 @@ class inputManager():
self.env = environment self.env = environment
self.env['runtime']['settingsManager'].loadDriver(\ self.env['runtime']['settingsManager'].loadDriver(\
self.env['runtime']['settingsManager'].getSetting('keyboard', 'driver'), 'inputDriver') self.env['runtime']['settingsManager'].getSetting('keyboard', 'driver'), 'inputDriver')
self.env['runtime']['inputManager'].updateInputDevices() self.updateInputDevices()
# init LEDs with current state # init LEDs with current state
self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getLedState() self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getLedState()
self.env['input']['oldNumLock'] = self.env['input']['newNumLock'] self.env['input']['oldNumLock'] = self.env['input']['newNumLock']
@ -25,7 +25,7 @@ class inputManager():
self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock'] self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock']
def shutdown(self): def shutdown(self):
self.env['runtime']['inputManager'].removeAllDevices() self.removeAllDevices()
self.env['runtime']['settingsManager'].shutdownDriver('inputDriver') self.env['runtime']['settingsManager'].shutdownDriver('inputDriver')
def getInputEvent(self): def getInputEvent(self):
@ -101,13 +101,16 @@ class inputManager():
return False return False
return self.setLedState return self.setLedState
def grabDevices(self): def grabAllDevices(self):
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
self.env['runtime']['inputDriver'].grabDevices() self.env['runtime']['inputDriver'].grabAllDevices()
def releaseDevices(self): def updateInputDevices(self):
self.env['runtime']['inputDriver'].updateInputDevices()
def removeAllDevices(self):
try: try:
self.env['runtime']['inputDriver'].releaseDevices() self.env['runtime']['inputDriver'].removeAllDevices()
except: except:
pass pass