diff --git a/src/calendar_manager.py b/src/calendar_manager.py index e841c183..39d3892b 100644 --- a/src/calendar_manager.py +++ b/src/calendar_manager.py @@ -98,6 +98,7 @@ class CalendarManager: def draw_event(self, event, y_start=1): """Draw a single calendar event on the canvas.""" + y_pos_at_start = y_start # Store the starting position try: # Get event details summary = event.get('summary', 'No Title') @@ -136,9 +137,11 @@ class CalendarManager: break self.display_manager.draw_text(line, y=y_pos, color=self.text_color, small_font=True) y_pos += 8 + 2 # Move down for the next line, add 2px spacing + return y_pos # Return the final y position if successful except Exception as e: logging.error(f"Error drawing calendar event: {str(e)}", exc_info=True) + return y_pos_at_start # Return the original starting position on error def _wrap_text(self, text, max_width, font): """Wrap text to fit within max_width using the provided font."""