more robust key label parsing

This commit is contained in:
Zach White 2021-01-07 21:11:57 -08:00
parent 0177fbd65b
commit 543e663c68

View file

@ -16,7 +16,15 @@ def kle2qmk(kle):
continue continue
if key['label_style'] in [0, 4]: if key['label_style'] in [0, 4]:
matrix, _, _, alt_layout, layout_name, _, keycode = key['name'].split('\n') key_name = key['name'].split('\n')
if len(key_name) == 7:
matrix, _, _, alt_layout, layout_name, _, keycode = key_name
elif len(key_name) == 5:
matrix, _, _, alt_layout, layout_name = key_name
cli.log.warning('Missing Keycode for key at matrix %s layout %s.', matrix, alt_layout)
else:
cli.log.error('Unknown label format: %s', repr(key['name']))
continue
else: else:
cli.log.error('Unknown label style: %s', key['label_style']) cli.log.error('Unknown label style: %s', key['label_style'])
continue continue