Apply suggestions from code review
Co-authored-by: xs5871 <60395129+xs5871@users.noreply.github.com>
This commit is contained in:
parent
50279f88fb
commit
664a557483
@ -97,8 +97,9 @@ class TextReplacement(Module):
|
|||||||
self,
|
self,
|
||||||
dictionary: dict,
|
dictionary: dict,
|
||||||
):
|
):
|
||||||
for entry in dictionary:
|
for key,value in dictionary.items():
|
||||||
self._rules.append(Rule(Phrase(entry), Phrase(dictionary[entry])))
|
self._rules.append(Rule(Phrase(key), Phrase(value)))
|
||||||
|
|
||||||
|
|
||||||
def process_key(self, keyboard, key, is_pressed, int_coord):
|
def process_key(self, keyboard, key, is_pressed, int_coord):
|
||||||
if not self._state == State.LISTENING:
|
if not self._state == State.LISTENING:
|
||||||
@ -142,7 +143,8 @@ class TextReplacement(Module):
|
|||||||
self._state = State.DELETING
|
self._state = State.DELETING
|
||||||
# if we have a match there's no reason to continue the full key processing, so return out
|
# if we have a match there's no reason to continue the full key processing, so return out
|
||||||
return
|
return
|
||||||
return super().process_key(keyboard, key, is_pressed, int_coord)
|
return key
|
||||||
|
|
||||||
|
|
||||||
def during_bootup(self, keyboard):
|
def during_bootup(self, keyboard):
|
||||||
return
|
return
|
||||||
|
@ -16,7 +16,7 @@ class TestTextReplacement(unittest.TestCase):
|
|||||||
[
|
[
|
||||||
[KC.A, KC.B, KC.N1, KC.LSHIFT, KC.LCTRL, KC.C, KC.D],
|
[KC.A, KC.B, KC.N1, KC.LSHIFT, KC.LCTRL, KC.C, KC.D],
|
||||||
],
|
],
|
||||||
debug_enabled=True,
|
debug_enabled=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
return super().setUp()
|
return super().setUp()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user