mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
on demand displays
This commit is contained in:
@@ -318,25 +318,40 @@ class BaseMiLBManager:
|
||||
date_font = ImageFont.load_default()
|
||||
time_font = ImageFont.load_default()
|
||||
|
||||
# Draw date in center
|
||||
date_width = draw.textlength(game_date_str, font=date_font)
|
||||
# Draw date in center (use DisplayManager helpers for compatibility)
|
||||
try:
|
||||
date_width = self.display_manager.get_text_width(game_date_str, date_font)
|
||||
except Exception:
|
||||
# Fallback: approximate width by character count if helper fails
|
||||
date_width = len(game_date_str) * 6
|
||||
date_height = self.display_manager.get_font_height(date_font)
|
||||
date_x = (width - date_width) // 2
|
||||
date_y = (height - date_font.size) // 2 - 3
|
||||
self.logger.debug(f"[MiLB] Drawing date '{game_date_str}' at ({date_x}, {date_y})")
|
||||
date_y = (height - date_height) // 2 - 3
|
||||
self.logger.debug(f"[MiLB] Drawing date '{game_date_str}' at ({date_x}, {date_y}), size {date_width}x{date_height}")
|
||||
self._draw_text_with_outline(draw, game_date_str, (date_x, date_y), date_font)
|
||||
|
||||
# Draw a simple test rectangle to verify drawing is working
|
||||
draw.rectangle([date_x-2, date_y-2, date_x+date_width+2, date_y+date_font.size+2], outline=(255, 0, 0))
|
||||
|
||||
|
||||
# Debug rectangle around date text
|
||||
try:
|
||||
draw.rectangle([date_x-2, date_y-2, date_x+max(0, date_width)+2, date_y+date_height+2], outline=(255, 0, 0))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Draw time below date
|
||||
time_width = draw.textlength(game_time_formatted_str, font=time_font)
|
||||
try:
|
||||
time_width = self.display_manager.get_text_width(game_time_formatted_str, time_font)
|
||||
except Exception:
|
||||
time_width = len(game_time_formatted_str) * 6
|
||||
time_height = self.display_manager.get_font_height(time_font)
|
||||
time_x = (width - time_width) // 2
|
||||
time_y = date_y + 10
|
||||
self.logger.debug(f"[MiLB] Drawing time '{game_time_formatted_str}' at ({time_x}, {time_y})")
|
||||
time_y = date_y + date_height + 2
|
||||
self.logger.debug(f"[MiLB] Drawing time '{game_time_formatted_str}' at ({time_x}, {time_y}), size {time_width}x{time_height}")
|
||||
self._draw_text_with_outline(draw, game_time_formatted_str, (time_x, time_y), time_font)
|
||||
|
||||
# Draw a simple test rectangle to verify drawing is working
|
||||
draw.rectangle([time_x-2, time_y-2, time_x+time_width+2, time_y+time_font.size+2], outline=(0, 255, 0))
|
||||
|
||||
# Debug rectangle around time text
|
||||
try:
|
||||
draw.rectangle([time_x-2, time_y-2, time_x+max(0, time_width)+2, time_y+time_height+2], outline=(0, 255, 0))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# For recent/final games, show scores and status
|
||||
elif game_data['status'] in ['status_final', 'final', 'completed']:
|
||||
|
||||
Reference in New Issue
Block a user