From 42124fddc6fca70eece9e34556b54181d9b866c3 Mon Sep 17 00:00:00 2001 From: Tyler Porter Date: Wed, 21 Feb 2024 13:30:03 -0500 Subject: [PATCH 1/2] Use fully-qualified asset path for logo --- main.py | 6 +++--- version.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index d0e9b99e..aed14378 100755 --- a/main.py +++ b/main.py @@ -70,12 +70,12 @@ def main(matrix, config_base): debug.log("Using rgbmatrix version %s", __version__) # Draw startup screen - logo = "assets/mlb-w" + str(matrix.width) + "h" + str(matrix.height) + ".png" + logo_path = os.path.abspath("./assets/mlb-w" + str(matrix.width) + "h" + str(matrix.height) + ".png") # MLB image disabled when using renderer, for now. # see: https://github.com/ty-porter/RGBMatrixEmulator/issues/9#issuecomment-922869679 - if os.path.exists(logo) and driver.is_hardware() and PIL_LOADED: - logo = Image.open(logo) + if os.path.exists(logo_path) and driver.is_hardware() and PIL_LOADED: + logo = Image.open(logo_path) matrix.SetImage(logo.convert("RGB")) logo.close() diff --git a/version.py b/version.py index 0fbb7e62..16717fca 100644 --- a/version.py +++ b/version.py @@ -1,5 +1,5 @@ SCRIPT_NAME = "MLB LED Scoreboard" -SCRIPT_VERSION = "7.0.0" +SCRIPT_VERSION = "7.0.1" if __name__ == "__main__": From 9b39f8e5c94a67893179e05bb6db83f1450223d8 Mon Sep 17 00:00:00 2001 From: Tyler Porter Date: Wed, 21 Feb 2024 16:11:06 -0500 Subject: [PATCH 2/2] Use imported Image instead of referencing PIL --- data/weather.py | 4 ++-- renderers/offday.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/weather.py b/data/weather.py index 50e228f1..e6dd6476 100644 --- a/data/weather.py +++ b/data/weather.py @@ -1,4 +1,4 @@ -import time +import os, time import pyowm @@ -102,7 +102,7 @@ def wind_string(self): return "{} {}".format(self.wind_speed_string(), self.wind_dir_string()) def icon_filename(self): - return "assets/weather/{}.png".format(self.icon_name) + return os.path.abspath("./assets/weather/{}.png".format(self.icon_name)) def __should_update(self): endtime = time.time() diff --git a/renderers/offday.py b/renderers/offday.py index 2bafab9a..94a4a042 100644 --- a/renderers/offday.py +++ b/renderers/offday.py @@ -70,7 +70,7 @@ def __render_weather_icon(canvas, layout, colors, weather_icon): if resize: weather_icon = weather_icon.resize( - (weather_icon.width * resize, weather_icon.height * resize), PIL.Image.NEAREST + (weather_icon.width * resize, weather_icon.height * resize), Image.NEAREST ) for x in range(weather_icon.width): for y in range(weather_icon.height):