Browse Source

wider keys?

zvecr 4 years ago
parent
commit
cb7d103ba8
1 changed files with 8 additions and 6 deletions
  1. 8 6
      lib/python/qmk/keyboard.py

+ 8 - 6
lib/python/qmk/keyboard.py

@@ -4,6 +4,7 @@ from array import array
 from math import ceil
 from pathlib import Path
 import os
+import shutil
 from glob import glob
 
 import qmk.path
@@ -11,6 +12,7 @@ from qmk.c_parse import parse_config_h_file
 from qmk.json_schema import json_load
 from qmk.makefile import parse_rules_mk_file
 
+KEY_WIDTH = 4 if shutil.get_terminal_size().columns < 200 else 6
 BOX_DRAWING_CHARACTERS = {
     "unicode": {
         "tl": "┌",
@@ -205,9 +207,9 @@ def render_layouts(info_json, render_ascii):
 
 def render_key_rect(textpad, x, y, w, h, label, style):
     box_chars = BOX_DRAWING_CHARACTERS[style]
-    x = ceil(x * 4)
+    x = ceil(x * KEY_WIDTH)
     y = ceil(y * 3)
-    w = ceil(w * 4)
+    w = ceil(w * KEY_WIDTH)
     h = ceil(h * 3)
 
     label_len = w - 2
@@ -234,9 +236,9 @@ def render_key_rect(textpad, x, y, w, h, label, style):
 
 def render_key_isoenter(textpad, x, y, w, h, label, style):
     box_chars = BOX_DRAWING_CHARACTERS[style]
-    x = ceil(x * 4)
+    x = ceil(x * KEY_WIDTH)
     y = ceil(y * 3)
-    w = ceil(w * 4)
+    w = ceil(w * KEY_WIDTH)
     h = ceil(h * 3)
 
     label_len = w - 1
@@ -266,9 +268,9 @@ def render_key_isoenter(textpad, x, y, w, h, label, style):
 
 def render_key_baenter(textpad, x, y, w, h, label, style):
     box_chars = BOX_DRAWING_CHARACTERS[style]
-    x = ceil(x * 4)
+    x = ceil(x * KEY_WIDTH)
     y = ceil(y * 3)
-    w = ceil(w * 4)
+    w = ceil(w * KEY_WIDTH)
     h = ceil(h * 3)
 
     label_len = w - 2