better margins / gaps
This commit is contained in:
parent
281c3b1fe1
commit
17fde29ef6
1 changed files with 6 additions and 2 deletions
|
|
@ -20,7 +20,11 @@ from glyphs import price_to_fraction, upload_fractions
|
||||||
# so 512 printable dots / 24 = 21 chars fit across the 80mm paper width.
|
# so 512 printable dots / 24 = 21 chars fit across the 80mm paper width.
|
||||||
LINE_WIDTH = 21
|
LINE_WIDTH = 21
|
||||||
NUM_COLUMNS = 4
|
NUM_COLUMNS = 4
|
||||||
COL_WIDTH = LINE_WIDTH // NUM_COLUMNS # 5
|
COL_WIDTH = 4
|
||||||
|
EDGE = 1 # 1-char margin on each edge
|
||||||
|
GAP = 1 # 1-char gap between columns
|
||||||
|
# Layout: edge(1) + col(4) + gap(1) + col(4) + gap(1) + col(4) + gap(1) + col(4) + edge(1) = 21
|
||||||
|
COL_STARTS = [EDGE + i * (COL_WIDTH + GAP) for i in range(NUM_COLUMNS)]
|
||||||
|
|
||||||
|
|
||||||
def format_price(lots, price):
|
def format_price(lots, price):
|
||||||
|
|
@ -76,7 +80,7 @@ def print_all(p, trades):
|
||||||
for row_idx in range(max_len):
|
for row_idx in range(max_len):
|
||||||
row = [" "] * LINE_WIDTH
|
row = [" "] * LINE_WIDTH
|
||||||
for col_idx in range(NUM_COLUMNS):
|
for col_idx in range(NUM_COLUMNS):
|
||||||
col_start = col_idx * COL_WIDTH
|
col_start = COL_STARTS[col_idx]
|
||||||
if row_idx < len(col_chars[col_idx]):
|
if row_idx < len(col_chars[col_idx]):
|
||||||
entry = col_chars[col_idx][row_idx]
|
entry = col_chars[col_idx][row_idx]
|
||||||
if entry[0] == "top":
|
if entry[0] == "top":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue