Skip to content

Commit

Permalink
Small tweaks to keymap generation (qmk#24240)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and acidMyke committed Nov 3, 2024
1 parent 945c1fc commit c2b093c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions lib/python/qmk/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
__MACRO_OUTPUT_GOES_HERE__
"""


Expand All @@ -51,7 +50,7 @@ def _generate_keymap_table(keymap_json):
lines[-1] = lines[-1] + ','
layer = map(_strip_any, layer)
layer_keys = ', '.join(layer)
lines.append('\t[%s] = %s(%s)' % (layer_num, keymap_json['layout'], layer_keys))
lines.append(' [%s] = %s(%s)' % (layer_num, keymap_json['layout'], layer_keys))
return lines


Expand All @@ -61,7 +60,7 @@ def _generate_encodermap_table(keymap_json):
if layer_num != 0:
lines[-1] = lines[-1] + ','
encoder_keycode_txt = ', '.join([f'ENCODER_CCW_CW({_strip_any(e["ccw"])}, {_strip_any(e["cw"])})' for e in layer])
lines.append('\t[%s] = {%s}' % (layer_num, encoder_keycode_txt))
lines.append(' [%s] = {%s}' % (layer_num, encoder_keycode_txt))
return lines


Expand Down
6 changes: 2 additions & 4 deletions lib/python/qmk/tests/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_json2c():
* edit it directly.
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
\t[0] = LAYOUT_ortho_1x1(KC_A)
[0] = LAYOUT_ortho_1x1(KC_A)
};
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
Expand All @@ -168,7 +168,6 @@ def test_json2c():
"""


Expand All @@ -195,7 +194,7 @@ def test_json2c_stdin():
* edit it directly.
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
\t[0] = LAYOUT_ortho_1x1(KC_A)
[0] = LAYOUT_ortho_1x1(KC_A)
};
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
Expand All @@ -207,7 +206,6 @@ def test_json2c_stdin():
"""


Expand Down
3 changes: 1 addition & 2 deletions lib/python/qmk/tests/test_qmk_keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_generate_c_pytest_basic():
* edit it directly.
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
\t[0] = LAYOUT(KC_A)
[0] = LAYOUT(KC_A)
};
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
Expand All @@ -41,7 +41,6 @@ def test_generate_c_pytest_basic():
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
"""


Expand Down

0 comments on commit c2b093c

Please sign in to comment.