Made property public
This commit is contained in:
parent
d206b5e1c6
commit
5cb04d9dcf
1 changed files with 10 additions and 7 deletions
|
@ -36,7 +36,7 @@ class HourListDesign (DesignEntity):
|
||||||
|
|
||||||
def __calc_parameters__ (self):
|
def __calc_parameters__ (self):
|
||||||
self.hour_count = self.last_hour - self.first_hour + 1
|
self.hour_count = self.last_hour - self.first_hour + 1
|
||||||
self.__row_size__ = (self.size[0], self.size[1] / self.hour_count)
|
self.row_size = (self.size[0], self.size[1] / self.hour_count)
|
||||||
self.number_columns = self.__get_max_num_simultaneous_events__()
|
self.number_columns = self.__get_max_num_simultaneous_events__()
|
||||||
|
|
||||||
def __get_hour_text__ (self, hour):
|
def __get_hour_text__ (self, hour):
|
||||||
|
@ -50,7 +50,7 @@ class HourListDesign (DesignEntity):
|
||||||
return self.__get_height_for_duration__(hour, minute) - self.__get_height_for_duration__(self.first_hour)
|
return self.__get_height_for_duration__(hour, minute) - self.__get_height_for_duration__(self.first_hour)
|
||||||
|
|
||||||
def __get_height_for_duration__ (self, hours, minutes = 0):
|
def __get_height_for_duration__ (self, hours, minutes = 0):
|
||||||
row_height = self.__row_size__[1]
|
row_height = self.row_size[1]
|
||||||
return row_height * (hours + minutes / 60)
|
return row_height * (hours + minutes / 60)
|
||||||
|
|
||||||
def __draw_events__ (self):
|
def __draw_events__ (self):
|
||||||
|
@ -77,10 +77,10 @@ class HourListDesign (DesignEntity):
|
||||||
self.__draw_row__(hour)
|
self.__draw_row__(hour)
|
||||||
|
|
||||||
def __draw_row__ (self, hour):
|
def __draw_row__ (self, hour):
|
||||||
subtext_height = self.__row_size__[1] * hoursubtext_height
|
subtext_height = self.row_size[1] * hoursubtext_height
|
||||||
sub_fontsize = subtext_height * hoursubtext_fontsize
|
sub_fontsize = subtext_height * hoursubtext_fontsize
|
||||||
width = hourbox_y_width * self.__row_size__[1]
|
width = hourbox_y_width * self.row_size[1]
|
||||||
height = self.__row_size__[1] - subtext_height
|
height = self.row_size[1] - subtext_height
|
||||||
size = (width, height)
|
size = (width, height)
|
||||||
pos = (0, self.__get_ypos_for_time__(hour))
|
pos = (0, self.__get_ypos_for_time__(hour))
|
||||||
fontsize = size[1] * hour_box_fontsize
|
fontsize = size[1] * hour_box_fontsize
|
||||||
|
@ -95,7 +95,7 @@ class HourListDesign (DesignEntity):
|
||||||
|
|
||||||
def __draw_lines__ (self):
|
def __draw_lines__ (self):
|
||||||
for i in range(self.hour_count):
|
for i in range(self.hour_count):
|
||||||
ypos = i * self.__row_size__[1]
|
ypos = i * self.row_size[1]
|
||||||
line_start = (0, ypos)
|
line_start = (0, ypos)
|
||||||
line_end = (self.size[0], ypos)
|
line_end = (self.size[0], ypos)
|
||||||
ImageDraw.Draw(self.__image__).line([ line_start, line_end ], fill=colors["fg"], width=line_thickness)
|
ImageDraw.Draw(self.__image__).line([ line_start, line_end ], fill=colors["fg"], width=line_thickness)
|
||||||
|
@ -107,7 +107,7 @@ class HourListDesign (DesignEntity):
|
||||||
return "AM" if hour < 12 else "PM"
|
return "AM" if hour < 12 else "PM"
|
||||||
|
|
||||||
def __draw_event__ (self, event, column = 0):
|
def __draw_event__ (self, event, column = 0):
|
||||||
xoffset = hourbox_y_width * self.__row_size__[1]
|
xoffset = hourbox_y_width * self.row_size[1]
|
||||||
column_width = (self.size[0] - xoffset) / self.number_columns
|
column_width = (self.size[0] - xoffset) / self.number_columns
|
||||||
|
|
||||||
begin = event.begin_datetime
|
begin = event.begin_datetime
|
||||||
|
@ -122,6 +122,9 @@ class HourListDesign (DesignEntity):
|
||||||
pos = (xoffset + column_width * column, time_ypos - yoffset_correction)
|
pos = (xoffset + column_width * column, time_ypos - yoffset_correction)
|
||||||
size = (column_width, time_height + yoffset_correction)
|
size = (column_width, time_height + yoffset_correction)
|
||||||
|
|
||||||
|
if size[1] < 0:
|
||||||
|
return #Event not in shown time range
|
||||||
|
|
||||||
self.__draw_event_block__(pos, size, event)
|
self.__draw_event_block__(pos, size, event)
|
||||||
|
|
||||||
def __draw_event_block__ (self, pos, size, event):
|
def __draw_event_block__ (self, pos, size, event):
|
||||||
|
|
Loading…
Reference in a new issue