2019-03-10 15:07:27 +01:00
|
|
|
from EventListDesign import EventListDesign
|
|
|
|
from settings import hours
|
2019-03-10 15:54:46 +01:00
|
|
|
from Assets import fonts
|
2019-03-10 15:07:27 +01:00
|
|
|
|
|
|
|
eventlist_allday_char = "•"
|
2019-03-10 15:54:46 +01:00
|
|
|
font = fonts["regular"]
|
2019-03-10 15:07:27 +01:00
|
|
|
|
|
|
|
class SingelDayEventListDesign (EventListDesign):
|
|
|
|
"""Specialized event list for day list design."""
|
2019-03-10 19:10:30 +01:00
|
|
|
def __init__ (self, size, calendar, date, font_size = 16, line_spacing=2, col_spacing=5, general_color="black", background_color="white", highlight_color="red"):
|
2019-03-10 15:07:27 +01:00
|
|
|
prefix_func = lambda x : self.__get_event_prefix__(x)
|
2019-03-10 15:54:46 +01:00
|
|
|
super().__init__(size, calendar, filter_date=date, text_size=font_size, line_spacing=line_spacing, col_spacing=col_spacing, event_prefix_func=prefix_func, font_family=font)
|
2019-03-10 15:07:27 +01:00
|
|
|
|
|
|
|
def __get_event_prefix__ (self, event):
|
|
|
|
if event.allday:
|
|
|
|
return eventlist_allday_char
|
|
|
|
else:
|
|
|
|
return self.__get_time__(event.begin_datetime)
|
|
|
|
|
|
|
|
def __get_time__ (self, time):
|
|
|
|
if hours == "24":
|
|
|
|
return time.strftime('%H:%M')
|
|
|
|
else:
|
|
|
|
return time.strftime('%I:%M')
|