fix dependence on optional int_coord

This commit is contained in:
xs5871 2022-08-10 10:51:36 +00:00 committed by Kyle Brown
parent 57c61ced85
commit ea94e9ba19

View File

@ -4,6 +4,7 @@ except ImportError:
pass
import kmk.handlers.stock as handlers
from kmk.keys import Key, make_key
from kmk.kmk_keyboard import KMKKeyboard
from kmk.modules import Module
@ -108,7 +109,7 @@ class Combos(Module):
else:
return self.on_release(keyboard, key, int_coord)
def on_press(self, keyboard, key: Optional[Key], int_coord):
def on_press(self, keyboard: KMKKeyboard, key: Key, int_coord: Optional[int]):
# refill potential matches from timed-out matches
if not self._matching:
self._matching = list(self._reset)
@ -157,11 +158,12 @@ class Combos(Module):
# There's no matching combo: send and reset key buffer
self.send_key_buffer(keyboard)
self._key_buffer = []
key = keyboard._find_key_in_map(int_coord)
if int_coord is not None:
key = keyboard._find_key_in_map(int_coord)
return key
def on_release(self, keyboard, key: Optional[Key], int_coord):
def on_release(self, keyboard: KMKKeyboard, key: Key, int_coord: Optional[int]):
for combo in self._active:
if key in combo.match:
# Deactivate combo if it matches current key.