From d4df70ce39eba841fbe63b433c900589067b6186 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 15 May 2019 08:16:41 +0200 Subject: [PATCH] Progressed month-view prototype --- Calendar/DayBoxDesign.py | 22 ++++++++++++++++++++-- Calendar/MonthViewPanel.py | 11 ++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Calendar/DayBoxDesign.py b/Calendar/DayBoxDesign.py index 2128280..839a4f1 100644 --- a/Calendar/DayBoxDesign.py +++ b/Calendar/DayBoxDesign.py @@ -1,4 +1,8 @@ from DesignEntity import DesignEntity +from SingelDayEventListDesign import SingelDayEventListDesign +from TextDesign import TextDesign + +header_height = 0.2 class DayBoxDesign (DesignEntity): """Represents a day with its events in a box.""" @@ -7,7 +11,21 @@ class DayBoxDesign (DesignEntity): self.date = date def add_calendar(self, calendar): - pass + self.calendar = calendar def __finish_image__(self): - pass \ No newline at end of file + self.__draw_header__() + self.__draw_events__() + + def __draw_header__(self): + pass + + def __draw_events__(self): + events = self.calendar.get_day_events(self.date) + + pos = (0, self.size[1] * header_height) + size = (self.size[0], self.size[1] - pos[1]) + + event_list = SingelDayEventListDesign(size, events) + event_list.pos = pos + self.draw_design(event_list) \ No newline at end of file diff --git a/Calendar/MonthViewPanel.py b/Calendar/MonthViewPanel.py index ff81348..fe130f0 100644 --- a/Calendar/MonthViewPanel.py +++ b/Calendar/MonthViewPanel.py @@ -38,10 +38,12 @@ class MonthViewPanel (PanelDesign): self.weather_height = weather_height self.day_area_height = 1 - self.weather_height - self.info_height self.day_area_ypos = self.weather_height + + self.week_count = self.__get_week_count__() area_height = self.size[1] * self.day_area_height area_width = self.size[0] - self.day_box_size = (area_width / 7, area_height) + self.day_box_size = (area_width / 7, area_height / self.week_count) def add_weather (self, weather): if general_settings["weather-info"] == False: @@ -80,7 +82,7 @@ class MonthViewPanel (PanelDesign): def __draw_days__(self): size = (self.size[0], self.size[1] * self.day_area_height) - pos = (0, self.size[0] * self.day_area_ypos) + pos = (0, self.size[1] * self.day_area_ypos) table = TableDesign(size, matrix = self.day_table) table.pos = pos @@ -107,4 +109,7 @@ class MonthViewPanel (PanelDesign): design = DayBoxDesign(self.day_box_size, date(self.year, self.month, int(day))) - return design \ No newline at end of file + return design + + def __get_week_count__(self): + return len(callib.monthcalendar(self.year, self.month)) \ No newline at end of file