Compare commits

...

7 Commits

Author SHA1 Message Date
Joel Challis
7a7a5c517a Merge 90233d31376ed3696879d5767c8c3367a15b5c94 into d5a042498770050a3d2f002540413ba14dfaf8d1 2024-12-31 22:36:16 -08:00
QMK Bot
d5a0424987 [CI] Regenerate Files (#24772)
Regenerate Files
2025-01-01 02:22:28 +00:00
QMK Bot
1e6eb5e35c Merge remote-tracking branch 'origin/master' into develop 2025-01-01 02:09:51 +00:00
QMK Bot
57f89e5388 [CI] Regenerate Files (#24770)
Regenerate Files
2025-01-01 13:02:16 +11:00
QMK Bot
4d182ec117 Merge remote-tracking branch 'origin/master' into develop 2025-01-01 01:59:15 +00:00
Joel Challis
53680fa6da Fix g_led_config parse warning (#24769) 2025-01-01 01:58:41 +00:00
zvecr
90233d3137 Update via2json layout macro searching 2024-11-25 20:40:22 +00:00
77 changed files with 89 additions and 97 deletions

View File

@ -9,19 +9,15 @@ import qmk.keyboard
import qmk.path
from qmk.info import info_json
from qmk.json_encoders import KeymapJSONEncoder
from qmk.commands import parse_configurator_json, dump_lines
from qmk.keymap import generate_json, list_keymaps, locate_keymap, parse_keymap_c
from qmk.commands import dump_lines
from qmk.keymap import generate_json
def _find_via_layout_macro(keyboard):
keymap_layout = None
if 'via' in list_keymaps(keyboard):
keymap_path = locate_keymap(keyboard, 'via')
if keymap_path.suffix == '.json':
keymap_layout = parse_configurator_json(keymap_path)['layout']
else:
keymap_layout = parse_keymap_c(keymap_path)['layers'][0]['layout']
return keymap_layout
def _find_via_layout_macro(keyboard_data):
"""Assume layout macro when only 1 is available
"""
layouts = list(keyboard_data['layouts'].keys())
return layouts[0] if len(layouts) == 1 else None
def _convert_macros(via_macros):
@ -130,20 +126,16 @@ def via2json(cli):
This command uses the `qmk.keymap` module to generate a keymap.json from a VIA backup json. The generated keymap is written to stdout, or to a file if -o is provided.
"""
# Find appropriate layout macro
keymap_layout = cli.args.layout if cli.args.layout else _find_via_layout_macro(cli.args.keyboard)
if not keymap_layout:
cli.log.error(f"Couldn't find LAYOUT macro for keyboard {cli.args.keyboard}. Please specify it with the '-l' argument.")
return False
# Load the VIA backup json
with cli.args.filename.open('r') as fd:
via_backup = json.load(fd)
# Generate keyboard metadata
keyboard_data = info_json(cli.args.keyboard)
if not keyboard_data:
cli.log.error(f'LAYOUT macro {keymap_layout} is not a valid one for keyboard {cli.args.keyboard}!')
# Find appropriate layout macro
keymap_layout = cli.args.layout if cli.args.layout else _find_via_layout_macro(keyboard_data)
if not keymap_layout:
cli.log.error(f"Couldn't find LAYOUT macro for keyboard {cli.args.keyboard}. Please specify it with the '-l' argument.")
return False
# Get keycode array

View File

@ -789,8 +789,8 @@ def _extract_led_config(info_data, keyboard):
info_data[feature]['layout'] = ret
except Exception as e:
_log_warning(info_data, f'led_config: {file.name}: {e}')
else:
_log_warning(info_data, 'led_config: matrix size required to parse g_led_config')
else:
_log_warning(info_data, 'led_config: matrix size required to parse g_led_config')
if info_data[feature].get('layout', None) and not info_data[feature].get('led_count', None):
info_data[feature]['led_count'] = len(info_data[feature]['layout'])

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

View File

@ -1,4 +1,4 @@
// Copyright 2024 QMK
// Copyright 2025 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************

Some files were not shown because too many files have changed in this diff Show More