diff options
Diffstat (limited to 'lib/python/qmk')
| -rwxr-xr-x | lib/python/qmk/cli/compile.py | 2 | ||||
| -rw-r--r-- | lib/python/qmk/commands.py | 11 |
2 files changed, 4 insertions, 9 deletions
diff --git a/lib/python/qmk/cli/compile.py b/lib/python/qmk/cli/compile.py index 234ffb12c..8e2d0cdbf 100755 --- a/lib/python/qmk/cli/compile.py +++ b/lib/python/qmk/cli/compile.py | |||
| @@ -37,7 +37,7 @@ def compile(cli): | |||
| 37 | cli.log.info('Creating {fg_cyan}%s{style_reset_all} keymap in {fg_cyan}%s', user_keymap['keymap'], keymap_path) | 37 | cli.log.info('Creating {fg_cyan}%s{style_reset_all} keymap in {fg_cyan}%s', user_keymap['keymap'], keymap_path) |
| 38 | 38 | ||
| 39 | # Compile the keymap | 39 | # Compile the keymap |
| 40 | command = compile_configurator_json(cli.args.filename) | 40 | command = compile_configurator_json(user_keymap) |
| 41 | 41 | ||
| 42 | cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap']) | 42 | cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap']) |
| 43 | 43 | ||
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py index f83a89578..6067d49ae 100644 --- a/lib/python/qmk/commands.py +++ b/lib/python/qmk/commands.py | |||
| @@ -25,16 +25,14 @@ def create_make_command(keyboard, keymap, target=None): | |||
| 25 | return ['make', ':'.join((keyboard, keymap, target))] | 25 | return ['make', ':'.join((keyboard, keymap, target))] |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | def parse_configurator_json(configurator_filename): | 28 | def parse_configurator_json(configurator_file): |
| 29 | """Open and parse a configurator json export | 29 | """Open and parse a configurator json export |
| 30 | """ | 30 | """ |
| 31 | file = open(configurator_filename) | 31 | user_keymap = json.load(configurator_file) |
| 32 | user_keymap = json.load(file) | ||
| 33 | file.close() | ||
| 34 | return user_keymap | 32 | return user_keymap |
| 35 | 33 | ||
| 36 | 34 | ||
| 37 | def compile_configurator_json(configurator_filename, bootloader=None): | 35 | def compile_configurator_json(user_keymap, bootloader=None): |
| 38 | """Convert a configurator export JSON file into a C file | 36 | """Convert a configurator export JSON file into a C file |
| 39 | 37 | ||
| 40 | Args: | 38 | Args: |
| @@ -47,9 +45,6 @@ def compile_configurator_json(configurator_filename, bootloader=None): | |||
| 47 | Returns: | 45 | Returns: |
| 48 | A command to run to compile and flash the C file. | 46 | A command to run to compile and flash the C file. |
| 49 | """ | 47 | """ |
| 50 | # Parse the configurator json | ||
| 51 | user_keymap = parse_configurator_json(configurator_filename) | ||
| 52 | |||
| 53 | # Write the keymap C file | 48 | # Write the keymap C file |
| 54 | qmk.keymap.write(user_keymap['keyboard'], user_keymap['keymap'], user_keymap['layout'], user_keymap['layers']) | 49 | qmk.keymap.write(user_keymap['keyboard'], user_keymap['keymap'], user_keymap['layout'], user_keymap['layers']) |
| 55 | 50 | ||
