do not handle numlock multible times
This commit is contained in:
parent
16aae3d2b5
commit
6728dd5745
@ -12,7 +12,6 @@ fenrirPath = os.path.dirname(currentdir)
|
|||||||
|
|
||||||
class inputManager():
|
class inputManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.setLedState = True
|
|
||||||
self.shortcutType = 'KEY'
|
self.shortcutType = 'KEY'
|
||||||
self.executeDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
def setShortcutType(self, shortcutType = 'KEY'):
|
def setShortcutType(self, shortcutType = 'KEY'):
|
||||||
@ -63,6 +62,7 @@ class inputManager():
|
|||||||
self.grabAllDevices()
|
self.grabAllDevices()
|
||||||
self.executeDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
def handleInputEvent(self, eventData):
|
def handleInputEvent(self, eventData):
|
||||||
|
print(eventData)
|
||||||
if not eventData:
|
if not eventData:
|
||||||
return
|
return
|
||||||
self.env['input']['prevInput'] = self.env['input']['currInput'].copy()
|
self.env['input']['prevInput'] = self.env['input']['currInput'].copy()
|
||||||
@ -73,7 +73,6 @@ class inputManager():
|
|||||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||||
elif len(self.env['input']['currInput']) == 0:
|
elif len(self.env['input']['currInput']) == 0:
|
||||||
self.env['input']['shortcutRepeat'] = 1
|
self.env['input']['shortcutRepeat'] = 1
|
||||||
self.setLedState = self.handleLedStates(eventData)
|
|
||||||
self.lastInputTime = time.time()
|
self.lastInputTime = time.time()
|
||||||
elif eventData['EventState'] == 1:
|
elif eventData['EventState'] == 1:
|
||||||
if not eventData['EventName'] in self.env['input']['currInput']:
|
if not eventData['EventName'] in self.env['input']['currInput']:
|
||||||
@ -87,7 +86,7 @@ class inputManager():
|
|||||||
self.env['input']['shortcutRepeat'] += 1
|
self.env['input']['shortcutRepeat'] += 1
|
||||||
else:
|
else:
|
||||||
self.env['input']['shortcutRepeat'] = 1
|
self.env['input']['shortcutRepeat'] = 1
|
||||||
self.setLedState = self.handleLedStates(eventData)
|
self.handleLedStates(eventData)
|
||||||
self.lastInputTime = time.time()
|
self.lastInputTime = time.time()
|
||||||
elif eventData['EventState'] == 2:
|
elif eventData['EventState'] == 2:
|
||||||
self.lastInputTime = time.time()
|
self.lastInputTime = time.time()
|
||||||
@ -101,35 +100,18 @@ class inputManager():
|
|||||||
self.env['runtime']['debug'].writeDebugOut("currInput " + str(self.env['input']['currInput'] ) ,debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut("currInput " + str(self.env['input']['currInput'] ) ,debug.debugLevel.INFO)
|
||||||
if self.noKeyPressed():
|
if self.noKeyPressed():
|
||||||
self.env['input']['prevInput'] = []
|
self.env['input']['prevInput'] = []
|
||||||
self.setLedState = True
|
|
||||||
self.handleDeviceGrab()
|
self.handleDeviceGrab()
|
||||||
|
|
||||||
def handleLedStates(self, mEvent):
|
def handleLedStates(self, mEvent):
|
||||||
if not self.setLedState:
|
try:
|
||||||
return self.setLedState
|
if mEvent['EventName'] == 'KEY_NUMLOCK':
|
||||||
if mEvent['EventName'] == 'KEY_NUMLOCK':
|
self.env['runtime']['inputDriver'].toggleLedState()
|
||||||
if mEvent['EventState'] == 1 and not self.env['input']['newNumLock'] == 1:
|
elif mEvent['EventName'] == 'KEY_CAPSLOCK':
|
||||||
self.env['runtime']['inputDriver'].toggleLedState()
|
self.env['runtime']['inputDriver'].toggleLedState(1)
|
||||||
return False
|
elif mEvent['EventName'] == 'KEY_SCROLLLOCK':
|
||||||
if mEvent['EventState'] == 0 and not self.env['input']['newNumLock'] == 0:
|
self.env['runtime']['inputDriver'].toggleLedState(2)
|
||||||
self.env['runtime']['inputDriver'].toggleLedState()
|
except:
|
||||||
return False
|
pass
|
||||||
if mEvent['EventName'] == 'KEY_CAPSLOCK':
|
|
||||||
if mEvent['EventState'] == 1 and not self.env['input']['newCapsLock'] == 1:
|
|
||||||
self.env['runtime']['inputDriver'].toggleLedState(1)
|
|
||||||
return False
|
|
||||||
if mEvent['EventState'] == 0 and not self.env['input']['newCapsLock'] == 0:
|
|
||||||
self.env['runtime']['inputDriver'].toggleLedState(1)
|
|
||||||
return False
|
|
||||||
if mEvent['EventName'] == 'KEY_SCROLLLOCK':
|
|
||||||
if mEvent['EventState'] == 1 and not self.env['input']['newScrollLock'] == 1:
|
|
||||||
self.env['runtime']['inputDriver'].toggleLedState(2)
|
|
||||||
return False
|
|
||||||
if mEvent['EventState'] == 0 and not self.env['input']['newScrollLock'] == 0:
|
|
||||||
self.env['runtime']['inputDriver'].toggleLedState(2)
|
|
||||||
return False
|
|
||||||
return self.setLedState
|
|
||||||
|
|
||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user