replace modtap validator with parent holdtap validator
This commit is contained in:
parent
2af4bc9e67
commit
91565b02ba
@ -2,31 +2,11 @@ from kmk.keys import make_argumented_key
|
|||||||
from kmk.modules.holdtap import HoldTap, HoldTapKeyMeta
|
from kmk.modules.holdtap import HoldTap, HoldTapKeyMeta
|
||||||
|
|
||||||
|
|
||||||
def mod_tap_validator(
|
|
||||||
kc, mods=None, prefer_hold=True, tap_interrupted=False, tap_time=None
|
|
||||||
):
|
|
||||||
'''
|
|
||||||
Validates that mod tap keys are correctly used
|
|
||||||
'''
|
|
||||||
return ModTapKeyMeta(
|
|
||||||
kc=kc,
|
|
||||||
mods=mods,
|
|
||||||
prefer_hold=prefer_hold,
|
|
||||||
tap_interrupted=tap_interrupted,
|
|
||||||
tap_time=tap_time,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ModTapKeyMeta(HoldTapKeyMeta):
|
|
||||||
def __init__(self, kc=None, mods=None, **kwargs):
|
|
||||||
super().__init__(tap=kc, hold=mods, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class ModTap(HoldTap):
|
class ModTap(HoldTap):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
make_argumented_key(
|
make_argumented_key(
|
||||||
validator=mod_tap_validator,
|
validator=HoldTapKeyMeta,
|
||||||
names=('MT',),
|
names=('MT',),
|
||||||
on_press=self.ht_pressed,
|
on_press=self.ht_pressed,
|
||||||
on_release=self.ht_released,
|
on_release=self.ht_released,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user