@@ 349,16 349,18 @@ def get_all_positions_in_layout(layout):
return positions
-def get_all_keys_in_layout(layout):
+def get_all_keys_in_layout(layout, max_layer=0):
"""Get all keys which are in the layout. Sorted the same way as the positions from get_all_positions_in_layout().
>>> get_all_keys_in_layout(TEST_LAYOUT)
+ ['^', '⇥', 'u', '\\n', ' ', '⇙']
+ >>> get_all_keys_in_layout(TEST_LAYOUT, max_layer=5)
['^', 'ˇ', '↻', '⇥', 'u', 'U', '\\\\', '⇱', '⊂', '\\n', ' ', '⇙']
"""
keys = []
for line in layout[:5]:
for key in line:
- for letter in key:
+ for letter in key[:max_layer+1]:
if letter:
keys.append(letter)
return keys