How to use the qmk.converter.kle2qmk function in qmk

To help you get started, we’ve selected a few qmk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qmk / qmk_firmware / lib / python / qmk / cli / kle2json.py View on Github external
# FIXME: This should be better
        return cli.log.error('Could not parse KLE raw data.')
    keyboard = OrderedDict(
        keyboard_name=kle.name,
        url='',
        maintainer='qmk',
        width=kle.columns,
        height=kle.rows,
        layouts={'LAYOUT': {
            'layout': 'LAYOUT_JSON_HERE'
        }},
    )
    # Initialize keyboard with json encoded from ordered dict
    keyboard = json.dumps(keyboard, indent=4, separators=(', ', ': '), sort_keys=False, cls=CustomJSONEncoder)
    # Initialize layout with kle2qmk from converter module
    layout = json.dumps(kle2qmk(kle), separators=(', ', ':'), cls=CustomJSONEncoder)
    # Replace layout in keyboard json
    keyboard = keyboard.replace('"LAYOUT_JSON_HERE"', layout)
    # Write our info.json
    file = open(str(out_path) + "/info.json", "w")
    file.write(keyboard)
    file.close()
    cli.log.info('Wrote out {fg_cyan}%s/info.json', str(out_path))