Requested rename

This commit is contained in:
John Morrison 2022-05-04 18:15:30 +01:00 committed by xs5871
parent 12e7a1b42c
commit bea0f6d75b
4 changed files with 11 additions and 11 deletions

View File

@ -1,11 +1,11 @@
# Keymap String KeyNames
# Stringy Keymaps
Enables referring to keys by `'NAME'` rather than `KC.NAME`.
For example:
```python
from kmk.extensions.keymap_string_keynames import Keymap_string_keynames
from kmk.extensions.stringy_keymaps import Stringy_keymaps
# Normal
# keyboard.keymap = [[ KC.A, KC.B, KC.RESET ]]
@ -16,13 +16,13 @@ from kmk.extensions.keymap_string_keynames import Keymap_string_keynames
# String names
keyboard.keymap = [[ 'A' , 'B', 'RESET' ]]
keymap_string_keynames = Keymap_string_keynames()
stringy_keymaps = Stringy_keymaps()
# Enabling debug will show each replacement or failure.
# This is recommended during the initial development of a keyboard.
# keymap_string_keynames.debug_enable = True
# stringy_keymaps.debug_enable = True
keyboard.extensions.append(keymap_string_keynames)
keyboard.extensions.append(stringy_keymaps)
```
It should be noted that these are **not** ASCII. The string is **not** what

View File

@ -16,4 +16,4 @@ extensions are
- [RGB](rgb.md): RGB lighting for underglow. Will work on most matrix RGB as will
be treated the same as underglow.
- [Status LED](extension_statusled.md): Indicates which layer you are on with an array of single leds.
- [KeyMap String KeyNames](extension_keymap_string_keynames): Enables referring to keys by 'NAME' rather than KC.NAME
- [Stringy Keymaps](extension_stringy_keymaps): Enables referring to keys by 'NAME' rather than KC.NAME

View File

@ -2,7 +2,7 @@ from kmk.extensions import Extension
from kmk.keys import KC
class Keymap_string_keynames(Extension):
class Stringy_keymaps(Extension):
#####
# User-configurable
debug_enabled = False

View File

@ -1,21 +1,21 @@
import unittest
from kmk.extensions.keymap_string_keynames import Keymap_string_keynames
from kmk.extensions.stringy_keymaps import Stringy_keymaps
from kmk.keys import KC
from tests.keyboard_test import KeyboardTest
class Test_extension_keymap_string_keynames(unittest.TestCase):
class Test_extension_stringy_keymaps(unittest.TestCase):
def test_basic_kmk_keyboard_replace_string_primary_name(self):
keyboard = KeyboardTest(
[], [['1', '2', '3', '4']], extensions={Keymap_string_keynames()}
[], [['1', '2', '3', '4']], extensions={Stringy_keymaps()}
)
keyboard.test('Simple key press', [(0, True), (0, False)], [{KC.N1}, {}])
def test_basic_kmk_keyboard_replace_string_secondary_name(self):
keyboard = KeyboardTest(
[], [['N1', 'N2', 'N3', 'N4']], extensions={Keymap_string_keynames()}
[], [['N1', 'N2', 'N3', 'N4']], extensions={Stringy_keymaps()}
)
keyboard.test('Simple key press', [(0, True), (0, False)], [{KC.N1}, {}])