2019-05-06 11:05:10 +02:00
|
|
|
from DesignEntity import DesignEntity
|
2019-05-15 08:16:41 +02:00
|
|
|
from SingelDayEventListDesign import SingelDayEventListDesign
|
|
|
|
from TextDesign import TextDesign
|
|
|
|
|
|
|
|
header_height = 0.2
|
2019-05-06 11:05:10 +02:00
|
|
|
|
2019-07-13 08:05:35 +02:00
|
|
|
|
2019-05-06 11:05:10 +02:00
|
|
|
class DayBoxDesign (DesignEntity):
|
|
|
|
"""Represents a day with its events in a box."""
|
2019-07-13 08:05:35 +02:00
|
|
|
|
2019-05-06 11:05:10 +02:00
|
|
|
def __init__(self, size, date):
|
|
|
|
super(DayBoxDesign, self).__init__(size)
|
|
|
|
self.date = date
|
|
|
|
|
|
|
|
def add_calendar(self, calendar):
|
2019-05-15 08:16:41 +02:00
|
|
|
self.calendar = calendar
|
2019-05-06 11:05:10 +02:00
|
|
|
|
|
|
|
def __finish_image__(self):
|
2019-05-15 08:16:41 +02:00
|
|
|
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
|
2019-07-13 08:05:35 +02:00
|
|
|
self.draw_design(event_list)
|