From 3a242e03544394964210da3445e87c4482e6a14b Mon Sep 17 00:00:00 2001 From: Peter Roberts Date: Sat, 1 Sep 2018 23:10:51 +0100 Subject: [PATCH] Fix name badge alignment --- .gitignore | 1 + home_ham/main.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6b38773..7613256 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store __pycache__ wifi*.json +config.json diff --git a/home_ham/main.py b/home_ham/main.py index ae54646..8ecfa17 100644 --- a/home_ham/main.py +++ b/home_ham/main.py @@ -34,7 +34,6 @@ status_height = 20 callsign_height = 50 info_height = 30 logo_path = "shared/emf_ham.png" -logo_height = 180 logo_width = 200 # Maximum length of name before downscaling @@ -72,12 +71,17 @@ if len(name_setting) <= max_name: else: ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD) # Draw name -ugfx.Label(0, 200 ,ugfx.width(), name_height, name_setting, justification=ugfx.Label.CENTER) +ugfx.Label(0, 220 ,ugfx.width(), name_height, name_setting, justification=ugfx.Label.CENTER) # Title -ugfx.Label(0, 260, ugfx.width(), callsign_height, callsign_setting, justification=ugfx.Label.CENTER) +if len(callsign_setting) <= max_name: + ugfx.set_default_font(ugfx.FONT_NAME) +else: + ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD) +# Draw callsign +ugfx.Label(0, 270, ugfx.width(), callsign_height, callsign_setting, justification=ugfx.Label.CENTER) ugfx.set_default_font(ugfx.FONT_SMALL) # Draw for wearer to see