diff --git a/Calendar/AgendaListDesign.py b/Calendar/AgendaListDesign.py index f89f15c..3431fbd 100644 --- a/Calendar/AgendaListDesign.py +++ b/Calendar/AgendaListDesign.py @@ -12,12 +12,13 @@ separator_width = line_thickness class AgendaListDesign (DesignEntity): '''Lists upcoming events in chronological order and groups them by days''' - def __init__(self, size, calendar, line_spacing=0, col_spacing=8, text_size=defaultfontsize, start_date=date.today(), always_add_start_row=True): + def __init__(self, size, calendar, line_spacing=0, col_spacing=8, text_size=defaultfontsize, start_date=date.today(), always_add_start_row=True, day_limit_foresight=91): super(AgendaListDesign, self).__init__(size) self.calendar = calendar self.line_spacing = line_spacing self.col_spacing = col_spacing self.text_size = text_size + self.day_limit_foresight = day_limit_foresight self.start_dt = date(start_date.year, start_date.month, start_date.day) self.always_add_start_row = always_add_start_row @@ -37,7 +38,8 @@ class AgendaListDesign (DesignEntity): self.infos = [] self.cell_props = [] fetch_day = self.start_dt - while len(self.infos) < self.__event_number__: + days_foresight = 0 + while len(self.infos) < self.__event_number__ and days_foresight < self.day_limit_foresight: day_events = self.calendar.get_day_events(fetch_day) fetch_day_added_once = False for event in day_events: @@ -54,6 +56,7 @@ class AgendaListDesign (DesignEntity): self.infos.append(row) fetch_day = fetch_day + timedelta(1) + days_foresight = days_foresight + 1 if self.infos[0][1] != date_summary_str(self.start_dt) and self.always_add_start_row: row = ["", date_summary_str(self.start_dt), "", ""]