move validators and metas to their respective modules

This commit is contained in:
xs5871
2022-07-21 15:50:30 +00:00
committed by Kyle Brown
parent e0ca1124fb
commit 5a85c6cfb3
7 changed files with 58 additions and 64 deletions

View File

@@ -1,35 +1,9 @@
from kmk.types import KeySeqSleepMeta, LayerKeyMeta, ModTapKeyMeta, UnicodeModeKeyMeta
from kmk.types import KeySeqSleepMeta, UnicodeModeKeyMeta
def key_seq_sleep_validator(ms):
return KeySeqSleepMeta(ms)
def layer_key_validator(layer, kc=None):
'''
Validates the syntax (but not semantics) of a layer key call. We won't
have access to the keymap here, so we can't verify much of anything useful
here (like whether the target layer actually exists). The spirit of this
existing is mostly that Python will catch extraneous args/kwargs and error
out.
'''
return LayerKeyMeta(layer, kc)
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,
)
def unicode_mode_key_validator(mode):
return UnicodeModeKeyMeta(mode)