Resolve invalid keys to KC.NO instead of ValueError
This commit is contained in:
@@ -54,7 +54,7 @@ class HoldTap(Module):
|
||||
def __init__(self):
|
||||
self.key_buffer = []
|
||||
self.key_states = {}
|
||||
if not KC.get('HT'):
|
||||
if KC.get('HT') == KC.NO:
|
||||
make_argumented_key(
|
||||
validator=HoldTapKeyMeta,
|
||||
names=('HT',),
|
||||
|
@@ -42,12 +42,11 @@ class Phrase:
|
||||
self._characters: list[Character] = []
|
||||
self._index: int = 0
|
||||
for char in string:
|
||||
try:
|
||||
key_code = KC[char]
|
||||
shifted = char.isupper() or key_code.has_modifiers == {2}
|
||||
self._characters.append(Character(key_code, shifted))
|
||||
except ValueError:
|
||||
key_code = KC[char]
|
||||
if key_code == KC.NO:
|
||||
raise ValueError(f'Invalid character in dictionary: {char}')
|
||||
shifted = char.isupper() or key_code.has_modifiers == {2}
|
||||
self._characters.append(Character(key_code, shifted))
|
||||
|
||||
def next_character(self) -> None:
|
||||
'''Increment the current index for this phrase'''
|
||||
|
Reference in New Issue
Block a user