Improved text
This commit is contained in:
parent
c33a34f9d8
commit
bad6d280da
1 changed files with 36 additions and 25 deletions
|
@ -6,6 +6,7 @@ from datetime import date, timedelta, datetime
|
|||
from SingelDayEventListDesign import SingelDayEventListDesign
|
||||
from Assets import fonts, colors, defaultfontsize
|
||||
from settings import general_settings
|
||||
from BoxDesign import BoxDesign
|
||||
|
||||
numberbox_ypos = 0.15
|
||||
numberbox_height = 1 - 2 * numberbox_ypos
|
||||
|
@ -14,8 +15,8 @@ month_height = numberbox_height / 4
|
|||
monthbox_xpadding = 0.013
|
||||
monthbox_width = 1 - numberbox_ypos - monthbox_xpadding
|
||||
weekday_height = numberbox_height * 0.19
|
||||
weekday_ypadding = 0.02
|
||||
weathercolumn_y_size = (0.4, 1)
|
||||
weekdaybox_height = 0.22
|
||||
eventlist_static_fontsize = defaultfontsize
|
||||
eventlist_padding = monthbox_xpadding
|
||||
|
||||
|
@ -57,7 +58,6 @@ class DayHeaderDesign (DesignEntity):
|
|||
def __finish_image__ (self):
|
||||
self.__draw_number_square__()
|
||||
self.__draw_month__()
|
||||
self.__draw_weekday__()
|
||||
|
||||
def __draw_event_list__ (self, events):
|
||||
box_ypos = numberbox_ypos * self.size[1]
|
||||
|
@ -74,20 +74,6 @@ class DayHeaderDesign (DesignEntity):
|
|||
event_list.pos = pos
|
||||
self.draw_design(event_list)
|
||||
|
||||
def __draw_weekday__ (self):
|
||||
font_size = int(weekday_height * self.size[1])
|
||||
padding = int(weekday_ypadding * self.size[1])
|
||||
box_ypos = int((numberbox_ypos) * self.size[1]) + padding
|
||||
box_xpos = int(numberbox_ypos * self.size[1])
|
||||
box_height = numberbox_height * self.size[1]
|
||||
box_pos = (box_xpos, box_ypos)
|
||||
box_size = (int(numberbox_height * self.size[1]), box_height)
|
||||
|
||||
week_day_name = self.date.strftime("%A")
|
||||
week_day = TextDesign(box_size, text=week_day_name, background_color=numberbox_background_color, color=numberbox_font_color, fontsize=font_size, horizontalalignment="center", font=weekday_font)
|
||||
week_day.pos = box_pos
|
||||
self.draw_design(week_day)
|
||||
|
||||
def __draw_month__ (self):
|
||||
font_size = int(month_height * self.size[1])
|
||||
padding = int(monthbox_xpadding * self.size[0])
|
||||
|
@ -102,19 +88,44 @@ class DayHeaderDesign (DesignEntity):
|
|||
self.draw_design(month)
|
||||
|
||||
def __draw_number_square__ (self):
|
||||
box_ypos = int(numberbox_ypos * self.size[1])
|
||||
box_height = int(numberbox_height * self.size[1])
|
||||
box_topleft = (box_ypos,box_ypos)
|
||||
box_bottomright = (box_topleft[0] + box_height, box_topleft[1] + box_height)
|
||||
ImageDraw.Draw(self.__image__).rectangle([ box_topleft, box_bottomright ], fill=numberbox_background_color)
|
||||
|
||||
font_size = int(number_height * self.size[1])
|
||||
box_height = numberbox_height * self.size[1]
|
||||
box_ypos = numberbox_ypos * self.size[1]
|
||||
box_pos = (box_ypos, box_ypos)
|
||||
box_size = (box_height, box_height)
|
||||
|
||||
box = BoxDesign(box_size, fill = numberbox_background_color)
|
||||
box.pos = box_pos
|
||||
self.draw_design(box)
|
||||
|
||||
self.__draw_today_number__()
|
||||
self.__draw_weekday__()
|
||||
|
||||
def __draw_today_number__ (self):
|
||||
font_size = number_height * self.size[1]
|
||||
box_height = numberbox_height * self.size[1]
|
||||
box_ypos = numberbox_ypos * self.size[1]
|
||||
size = (box_height, box_height)
|
||||
pos = (box_ypos, box_ypos)
|
||||
|
||||
day_text = self.__get_day_text__()
|
||||
number = TextDesign(box_size, text=day_text, background_color=numberbox_background_color, color=numberbox_font_color, fontsize=font_size, horizontalalignment="center", verticalalignment="center")
|
||||
number.pos = box_topleft
|
||||
number = TextDesign(size, text=day_text, background_color=numberbox_background_color, color=numberbox_font_color, fontsize=font_size, horizontalalignment="center", verticalalignment="center")
|
||||
number.pos = pos
|
||||
number.mask = False
|
||||
self.draw_design(number)
|
||||
|
||||
def __draw_weekday__ (self):
|
||||
font_size = weekday_height * self.size[1]
|
||||
box_height = numberbox_height * self.size[1]
|
||||
size = (box_height, weekdaybox_height * box_height)
|
||||
box_ypos = numberbox_ypos * self.size[1]
|
||||
pos = (box_ypos, box_ypos)
|
||||
|
||||
week_day_name = self.date.strftime("%A")
|
||||
week_day = TextDesign(size, text=week_day_name, background_color=numberbox_background_color, color=numberbox_font_color, fontsize=font_size, horizontalalignment="center", verticalalignment = "center", font=weekday_font)
|
||||
week_day.pos = pos
|
||||
week_day.mask = False
|
||||
self.draw_design(week_day)
|
||||
|
||||
def __abs_co__ (self, coordinates):
|
||||
return (int(coordinates[0] * self.size[0]),int(coordinates[1] * self.size[1]))
|
||||
|
||||
|
|
Loading…
Reference in a new issue