|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from .keyboard import Keyboard
|
|
|
|
from .color import Color
|
|
|
|
from .keymap import Keymap
|
|
|
|
|
|
|
|
keyboard = Keyboard(no_keymap=False)
|
|
|
|
if not keyboard.found_keyboard():
|
|
|
|
print("No keyboard was found")
|
|
|
|
exit()
|
|
|
|
|
|
|
|
def sort_dict(dictionary):
|
|
|
|
return {k: v for k, v in sorted(dictionary.items(), key=lambda item: item[1])}
|
|
|
|
|
|
|
|
def iter_keys(keymap):
|
|
|
|
sorted_keys = sort_dict(keymap.keys)
|
|
|
|
for key in sorted_keys.keys():
|
|
|
|
keyboard.clear()
|
|
|
|
print(f'key: {key}')
|
|
|
|
keyboard.set_keys(Color(255, 255, 255), key)
|
|
|
|
keyboard.draw()
|
|
|
|
input()
|
|
|
|
|
|
|
|
keymap = keyboard.keymap
|
|
|
|
|
|
|
|
while True:
|
|
|
|
keyboard.set_keys(Color(255, 255, 255), list(keymap.keys.keys()))
|
|
|
|
keyboard.draw()
|
|
|
|
input("Press Enter to continue...")
|
|
|
|
iter_keys(keymap)
|