reformatted for black

This commit is contained in:
Rene Giovanni Borella 2022-02-08 08:37:41 +01:00 committed by Kyle Brown
parent 3c4e74d50e
commit f02ff1463a

View File

@ -9,6 +9,7 @@ import traceback
from kmk.modules import Module from kmk.modules import Module
class Encoder: class Encoder:
VELOCITY_MODE = False # not really for detents VELOCITY_MODE = False # not really for detents
@ -92,6 +93,7 @@ class Encoder:
def vel_report(self): def vel_report(self):
return self._velocity return self._velocity
class EncoderHandler(Module): class EncoderHandler(Module):
def __init__(self): def __init__(self):
self.encoders = [] self.encoders = []
@ -109,8 +111,12 @@ class EncoderHandler(Module):
for idx, definition in enumerate(self.i2c): for idx, definition in enumerate(self.i2c):
new_encoder = Encoder(*definition) new_encoder = Encoder(*definition)
# In our case, we need to define keybord and encoder_id for callbacks # In our case, we need to define keybord and encoder_id for callbacks
new_encoder.on_move_do = lambda x, bound_idx = idx: self.on_move_do(keyboard, bound_idx, x) new_encoder.on_move_do = lambda x, bound_idx=idx: self.on_move_do(
new_encoder.on_button_do = lambda x, bound_idx = idx: self.on_button_do(keyboard, bound_idx, x) keyboard, bound_idx, x
)
new_encoder.on_button_do = lambda x, bound_idx=idx: self.on_button_do(
keyboard, bound_idx, x
)
self.encoders.append(new_encoder) self.encoders.append(new_encoder)
return return