From 6200091d8b4540de9e4d80ea1279be387c41ebc0 Mon Sep 17 00:00:00 2001 From: pawptart Date: Fri, 14 Jul 2023 20:38:05 -0400 Subject: [PATCH 1/2] Fix for games in warmup status --- data/config/layout.py | 14 +++++++++----- renderers/games/teams.py | 2 +- version.py | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data/config/layout.py b/data/config/layout.py index 89a8134f..99cc75ad 100644 --- a/data/config/layout.py +++ b/data/config/layout.py @@ -1,6 +1,7 @@ from driver import graphics import os.path +import debug FONTNAME_DEFAULT = "4x6" FONTNAME_KEY = "font_name" @@ -36,14 +37,17 @@ def font(self, keypath): def coords(self, keypath): try: - d = self.__find_at_keypath(keypath) + coord_dict = self.__find_at_keypath(keypath) except KeyError as e: raise e - if self.state in AVAILABLE_OPTIONAL_KEYS: - if self.state in d: - return d[self.state] - return d + if not isinstance(coord_dict, dict) or not self.state in AVAILABLE_OPTIONAL_KEYS: + return coord_dict + + if self.state in coord_dict: + return coord_dict[self.state] + + return coord_dict def set_state(self, new_state=None): if new_state in AVAILABLE_OPTIONAL_KEYS: diff --git a/renderers/games/teams.py b/renderers/games/teams.py index 5bc59b76..5d7bb78f 100644 --- a/renderers/games/teams.py +++ b/renderers/games/teams.py @@ -116,7 +116,7 @@ def __render_team_text(canvas, layout, colors, team, homeaway, full_team_names, def __render_record_text(canvas, layout, colors, team, homeaway, default_colors): if "losses" not in team.record or "wins" not in team.record: return - if not layout.coords("teams.record.enabled"): + if not layout.coords("teams.record").get("enabled", False): return text_color = colors.get("text", default_colors["text"]) diff --git a/version.py b/version.py index 82b432be..6bb344b1 100644 --- a/version.py +++ b/version.py @@ -1,5 +1,5 @@ SCRIPT_NAME = "MLB LED Scoreboard" -SCRIPT_VERSION = "6.4.0" +SCRIPT_VERSION = "6.4.1" if __name__ == "__main__": From 7ef8414ca642b65bf1468a98f9c514b982fd02c5 Mon Sep 17 00:00:00 2001 From: pawptart Date: Fri, 14 Jul 2023 20:39:16 -0400 Subject: [PATCH 2/2] remove unnecessary import --- data/config/layout.py | 1 - 1 file changed, 1 deletion(-) diff --git a/data/config/layout.py b/data/config/layout.py index 99cc75ad..88fdef50 100644 --- a/data/config/layout.py +++ b/data/config/layout.py @@ -1,7 +1,6 @@ from driver import graphics import os.path -import debug FONTNAME_DEFAULT = "4x6" FONTNAME_KEY = "font_name"