Fix blank calendar display by optimizing clear/redraw logic

This commit is contained in:
ChuckBuilds
2025-04-22 12:26:08 -05:00
parent cfd3ea6928
commit 6ad1af1919
2 changed files with 8 additions and 2 deletions

View File

@@ -266,8 +266,9 @@ class CalendarManager:
logger.debug("Calendar manager is disabled, skipping display")
return
# Always clear the display before drawing new content
self.display_manager.clear()
# Only clear if force_clear is True (mode switch) or no events are drawn
if force_clear:
self.display_manager.clear()
if not self.events:
# Display "No Events" message if the list is empty
@@ -287,6 +288,8 @@ class CalendarManager:
# Only log at INFO level when switching to calendar or when force_clear is True
if force_clear:
logger.info(f"CalendarManager displaying event index {self.current_event_index}: {event_to_display.get('summary')}")
logger.info(f"CalendarManager displaying event: {event_to_display.get('summary')}")
logger.info(f"Event details - Date: {self._format_event_date(event_to_display)}, Time: {self._format_event_time(event_to_display)}, Summary: {event_to_display.get('summary', 'No Title')}")
else:
logger.debug(f"CalendarManager displaying event index {self.current_event_index}: {event_to_display.get('summary')}")

View File

@@ -376,6 +376,9 @@ class DisplayController:
self.news.display_news()
elif self.current_display_mode == 'calendar' and self.calendar:
# Update calendar data if needed
self.calendar.update(current_time)
# Always display the calendar, with force_clear only on mode switch
self.calendar.display(force_clear=self.force_clear)
elif self.current_display_mode == 'nhl_recent' and self.nhl_recent: