From 076066ce0b7d534895b9892ba4350010b20ad220 Mon Sep 17 00:00:00 2001 From: Gultak <2469830+Gultak@users.noreply.github.com> Date: Sun, 27 Aug 2023 16:46:16 +0100 Subject: [PATCH] Make the font file configurable. --- config.py | 4 ++++ config.yaml | 3 +++ main.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index be39bc7..77eb4d2 100644 --- a/config.py +++ b/config.py @@ -27,6 +27,10 @@ class Config: def update_interval_seconds(self) -> int: return self.config.get("update-interval-seconds") + @property + def font_file(self) -> str: + return self.config.get("font-file") + @property def stop_codes(self) -> list[str]: return [str(s["stop_id"]) for s in self.config.get("stops")] diff --git a/config.yaml b/config.yaml index 26b9927..d62f9fe 100644 --- a/config.yaml +++ b/config.yaml @@ -12,6 +12,9 @@ gtfs-r-api_key: "API KEY GOES HERE" # It must be strictly larger than 60 because the GTFS-R API will throttle us otherwise update-interval-seconds: 62 +# The font to use for the display. +font-file: "jd_lcd_rounded.ttf" + stops: [ { # Route 15A diff --git a/main.py b/main.py index 3a6df1a..94dd537 100755 --- a/main.py +++ b/main.py @@ -125,7 +125,7 @@ def main(): window = init_screen() pygame.font.init() - font = pygame.font.Font(TEXT_FONT, TEXT_SIZE) + font = pygame.font.Font(config.font_file or TEXT_FONT, TEXT_SIZE) # Init screen clear_screen()