Progressed month-view prototype
This commit is contained in:
parent
f22f4b825f
commit
d4df70ce39
2 changed files with 28 additions and 5 deletions
|
@ -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
|
||||
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)
|
|
@ -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
|
||||
return design
|
||||
|
||||
def __get_week_count__(self):
|
||||
return len(callib.monthcalendar(self.year, self.month))
|
Loading…
Reference in a new issue