diff options
author | QMK Bot <hello@qmk.fm> | 2022-03-08 20:46:24 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-03-08 20:46:24 +0000 |
commit | 49bc3b530bb89629f4bb20bf4b7c097d3dd94b89 (patch) | |
tree | d123d9ea8f260df33b9ff28c95b6c59e3dc6daed /lib | |
parent | fba382040557f4c18dfb1faa81489331d95314f6 (diff) | |
parent | b593cfccbde7b4fa7feb0e756eb601f7717bed98 (diff) | |
download | qmk_firmware-49bc3b530bb89629f4bb20bf4b7c097d3dd94b89.tar.gz qmk_firmware-49bc3b530bb89629f4bb20bf4b7c097d3dd94b89.zip |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/qmk/keyboard.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/lib/python/qmk/keyboard.py b/lib/python/qmk/keyboard.py index 0530c4acc5..7cd0a1d5a7 100644 --- a/lib/python/qmk/keyboard.py +++ b/lib/python/qmk/keyboard.py @@ -178,6 +178,8 @@ def render_layout(layout_data, render_ascii, key_labels=None): if x >= 0.25 and w == 1.25 and h == 2: render_key_isoenter(textpad, x, y, w, h, label, style) + elif w == 2.25 and h == 2: + render_key_baenter(textpad, x, y, w, h, label, style) else: render_key_rect(textpad, x, y, w, h, label, style) @@ -259,4 +261,36 @@ def render_key_isoenter(textpad, x, y, w, h, label, style): textpad[y + 2][x - 1:x + w] = crn_line textpad[y + 3][x:x + w] = mid_line textpad[y + 4][x:x + w] = mid_line - textpad[y + h - 1][x:x + w] = bot_line + textpad[y + 5][x:x + w] = bot_line + + +def render_key_baenter(textpad, x, y, w, h, label, style): + box_chars = BOX_DRAWING_CHARACTERS[style] + x = ceil(x * 4) + y = ceil(y * 3) + w = ceil(w * 4) + h = ceil(h * 3) + + label_len = w - 2 + label_leftover = label_len - len(label) + + if len(label) > label_len: + label = label[:label_len] + + label_blank = ' ' * (label_len-3) # noqa: yapf insists there be no whitespace around - and * + label_border_top = box_chars['h'] * (label_len-3) # noqa + label_border_bottom = box_chars['h'] * label_len + label_middle = label + ' '*label_leftover # noqa + + top_line = array('u', box_chars['tl'] + label_border_top + box_chars['tr']) + mid_line = array('u', box_chars['v'] + label_blank + box_chars['v']) + crn_line = array('u', box_chars['tl'] + box_chars['h'] + box_chars['h'] + box_chars['br'] + label_blank + box_chars['v']) + lab_line = array('u', box_chars['v'] + label_middle + box_chars['v']) + bot_line = array('u', box_chars['bl'] + label_border_bottom + box_chars['br']) + + textpad[y][x + 3:x + w] = top_line + textpad[y + 1][x + 3:x + w] = mid_line + textpad[y + 2][x + 3:x + w] = mid_line + textpad[y + 3][x:x + w] = crn_line + textpad[y + 4][x:x + w] = lab_line + textpad[y + 5][x:x + w] = bot_line |