From 6c02b9dc4ad8a93966b14f49644561bf14e0c30a Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Wed, 23 Jul 2025 13:53:30 -0500 Subject: [PATCH] justify day date font in odds ticker manager --- config/config.json | 4 ++-- src/odds_ticker_manager.py | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/config/config.json b/config/config.json index 23d38e6b..67a42746 100644 --- a/config/config.json +++ b/config/config.json @@ -70,7 +70,7 @@ "ncaam_basketball_recent": 30, "ncaam_basketball_upcoming": 30, "music": 30, - "of_the_day": 60 + "of_the_day": 40 }, "use_short_date_format": true }, @@ -332,7 +332,7 @@ }, "of_the_day": { "enabled": true, - "display_rotate_interval": 30, + "display_rotate_interval": 20, "update_interval": 3600, "subtitle_rotate_interval": 10, "category_order": ["word_of_the_day", "slovenian_word_of_the_day"], diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index 91451690..43e32465 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -762,7 +762,7 @@ class OddsTickerManager: draw.text((current_x, odds_y_home), home_odds_text, font=odds_font, fill=odds_color) current_x += odds_width + h_padding - # Datetime (stacked, 3 rows) + # Datetime (stacked, 3 rows) - Center justified datetime_font_height = datetime_font.size if hasattr(datetime_font, 'size') else 6 # Calculate available height for the three text lines @@ -775,9 +775,18 @@ class OddsTickerManager: date_y = day_y + datetime_font_height + 2 time_y = date_y + datetime_font_height + 2 - draw.text((current_x, day_y), day_text, font=datetime_font, fill=(255, 255, 255)) - draw.text((current_x, date_y), date_text, font=datetime_font, fill=(255, 255, 255)) - draw.text((current_x, time_y), time_text, font=datetime_font, fill=(255, 255, 255)) + # Center justify each line of text within the datetime column + day_text_width = int(temp_draw.textlength(day_text, font=datetime_font)) + date_text_width = int(temp_draw.textlength(date_text, font=datetime_font)) + time_text_width = int(temp_draw.textlength(time_text, font=datetime_font)) + + day_x = current_x + (datetime_col_width - day_text_width) // 2 + date_x = current_x + (datetime_col_width - date_text_width) // 2 + time_x = current_x + (datetime_col_width - time_text_width) // 2 + + draw.text((day_x, day_y), day_text, font=datetime_font, fill=(255, 255, 255)) + draw.text((date_x, date_y), date_text, font=datetime_font, fill=(255, 255, 255)) + draw.text((time_x, time_y), time_text, font=datetime_font, fill=(255, 255, 255)) current_x += datetime_col_width + h_padding # Add padding after datetime if broadcast_logo: