diff options
author | Alex Ong <the.onga@gmail.com> | 2019-01-04 19:43:45 +1100 |
---|---|---|
committer | Alex Ong <the.onga@gmail.com> | 2019-01-04 19:43:45 +1100 |
commit | 2bb2977c133646c4e056960e72029270d77cc1eb (patch) | |
tree | 235d491f992121ac1716c5bf2fafb80983748576 /layouts/community/ortho_4x12/guidoism/generate_c.py | |
parent | a55c838961c89097ab849ed6cb1f261791e6b9b4 (diff) | |
parent | 47c91fc7f75ae0a477e55b687aa0fc30da0a283c (diff) | |
download | qmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.tar.gz |
Merge branch 'master' into debounce_refactor
# Conflicts:
# tmk_core/common/keyboard.c
Diffstat (limited to 'layouts/community/ortho_4x12/guidoism/generate_c.py')
-rw-r--r-- | layouts/community/ortho_4x12/guidoism/generate_c.py | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/layouts/community/ortho_4x12/guidoism/generate_c.py b/layouts/community/ortho_4x12/guidoism/generate_c.py deleted file mode 100644 index 7876bee68..000000000 --- a/layouts/community/ortho_4x12/guidoism/generate_c.py +++ /dev/null @@ -1,59 +0,0 @@ -import itertools -import json -from pprint import pprint as pp - -layers = dict(enumerate(['_QWERTY', '_LOWER', '_RAISE', '_MOVEMENT', '_NUMPAD'])) -key_names = {('MO(%d)' % i): layers.get(i).strip('_') for i in layers.keys()} - -unicodes = { - "<i class='fa fa-fast-forward'></i>": "next", - "<i class='fa fa-volume-down'></i>": "vol-", - "<i class='fa fa-volume-up'></i>": "vol+", - "<i class='fa fa-play'></i>": "play", -} - -d = json.load(open('layouts/community/ortho_4x12/guidoism/guidoism.json')) - -def grouper(iterable, n): - args = [iter(iterable)] * n - return itertools.zip_longest(*args, fillvalue='') - -def truthy(s): - return [a for a in s if a] - -def just(s, n): - return [a.center(n*2+1 if len(s) == 11 and i == 5 else n) for i, a in enumerate(s)] - -def replace(s): - return [key_names.get(a, a) for a in s] - -def layer(i, l): - n = max(len(s) for s in l) - rows = [', '.join(replace(truthy(row))) for row in grouper(l, 12)] - return '[%s] = %s(\n%s)' % (layers[i], d['layout'], ',\n'.join(rows)) - -print(',\n\n'.join(layer(i, l) for i, l in enumerate(d['layers']))) - -def surround(s, a, b, c): - return a + b.join(s) + c - -def pattern(cell, table): - return ['─'*cell for i in range(table)] - -keys = json.load(open('layouts/community/ortho_4x12/guidoism/keys.json')) - -def layer2(i, l): - def replace(s): - s = [keys.get(a, a) for a in s] - return [unicodes.get(a, a) for a in s] - n = max(len(s) for s in l) - return [surround(just(replace(truthy(row)), 5), '│', '│', '│') for row in grouper(l, 12)] - -for i, l in enumerate(d['layers']): - print(surround(pattern(5, 12), '┌', '┬', '┐')) - for n, row in enumerate(layer2(i, l)): - print(row) - if n < 3: - print(surround(pattern(5, 12), '├', '┼', '┤')) - else: - print(surround(pattern(5, 12), '└', '┴', '┘')) |