Generalized TableDesign and improved imports
This commit is contained in:
parent
28938b45f8
commit
5dcae2d435
8 changed files with 19 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
|||
from DesignEntity import DesignEntity
|
||||
from Assets import defaultfontsize, colors
|
||||
from datetime import datetime, date, timedelta
|
||||
from TableTextDesign import TableTextDesign
|
||||
from TableDesign import TableDesign
|
||||
from PIL import ImageDraw
|
||||
from TextFormatter import date_summary_str, event_prefix_str
|
||||
|
||||
|
@ -59,7 +59,7 @@ class AgendaListDesign (DesignEntity):
|
|||
self.cell_props.insert(0, props)
|
||||
|
||||
def __draw_infos__ (self):
|
||||
table = TableTextDesign(self.size, self.infos, fontsize = self.__date_fontsize__, line_spacing=self.__date_linespace__, col_spacing = self.col_spacing, cell_properties=self.cell_props)
|
||||
table = TableDesign(self.size, self.infos, fontsize = self.__date_fontsize__, line_spacing=self.__date_linespace__, col_spacing = self.col_spacing, cell_properties=self.cell_props)
|
||||
self.draw_design(table)
|
||||
|
||||
def __draw_lines__ (self):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from PanelDesign import PanelDesign
|
||||
from Assets import *
|
||||
from settings import *
|
||||
from Assets import colors
|
||||
from settings import general_settings
|
||||
import calendar as callib
|
||||
from datetime import datetime, timedelta, date
|
||||
from PIL import ImageDraw
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from DesignEntity import DesignEntity
|
||||
from TableTextDesign import TableTextDesign
|
||||
from TableDesign import TableDesign
|
||||
from settings import language
|
||||
from Assets import defaultfontsize, colors
|
||||
from TextFormatter import date_str
|
||||
|
||||
class EventListDesign (DesignEntity):
|
||||
"""Creates a TableTextDesign filled with event
|
||||
"""Creates a TableDesign filled with event
|
||||
begin date and title"""
|
||||
def __init__ (self, size, events, text_size = defaultfontsize, line_spacing = 2, col_spacing = 10, event_prefix_rel_dates = [], event_prefix_func = None, font_family = None, general_color = colors["fg"], background_color = colors["bg"], highlight_color = colors["hl"], show_more_info = False):
|
||||
super(EventListDesign, self).__init__(size)
|
||||
|
@ -30,7 +30,7 @@ class EventListDesign (DesignEntity):
|
|||
self.__fill_event_matrix__()
|
||||
|
||||
col_hori_alignment = [ 'right', 'left' ]
|
||||
table_design = TableTextDesign(self.size, background_color = self.background_color, font=self.font_family, line_spacing=self.line_spacing, col_spacing=self.col_spacing, text_matrix=self.__event_matrix__, fontsize = self.text_size, column_horizontal_alignments=col_hori_alignment, mask=False, truncate_cols=False, cell_properties=self.__props_matrix__)
|
||||
table_design = TableDesign(self.size, background_color = self.background_color, font=self.font_family, line_spacing=self.line_spacing, col_spacing=self.col_spacing, text_matrix=self.__event_matrix__, fontsize = self.text_size, column_horizontal_alignments=col_hori_alignment, mask=False, truncate_cols=False, cell_properties=self.__props_matrix__)
|
||||
self.draw_design(table_design)
|
||||
|
||||
def __get_formatted_event__ (self, event, index):
|
||||
|
|
|
@ -2,8 +2,8 @@ from DesignEntity import DesignEntity
|
|||
import calendar as callib
|
||||
from datetime import datetime, timedelta
|
||||
from TextDesign import TextDesign
|
||||
from Assets import *
|
||||
from settings import *
|
||||
from Assets import colors
|
||||
from settings import week_starts_on
|
||||
from BoxDesign import BoxDesign
|
||||
|
||||
daynumberboxsize = (0.143, 0.2) #(0.143, 0.286)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from PanelDesign import PanelDesign
|
||||
from Assets import *
|
||||
from settings import *
|
||||
from Assets import colors
|
||||
from settings import general_settings, week_starts_on
|
||||
import calendar as callib
|
||||
from datetime import datetime, timedelta
|
||||
from WeatherHeaderDesign import WeatherHeaderDesign
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from DesignEntity import DesignEntity
|
||||
from TableTextDesign import TableTextDesign
|
||||
from TableDesign import TableDesign
|
||||
from Assets import defaultfontsize
|
||||
|
||||
class RssPostListDesign (DesignEntity):
|
||||
"""Creates a TableTextDesign filled with rss post
|
||||
"""Creates a TableDesign filled with rss post
|
||||
date and title"""
|
||||
def __init__ (self, size, rssfeed, text_size = defaultfontsize):
|
||||
super(RssPostListDesign, self).__init__(size)
|
||||
|
@ -14,7 +14,7 @@ class RssPostListDesign (DesignEntity):
|
|||
def __finish_image__ (self):
|
||||
self.__fill_post_matrix__()
|
||||
|
||||
table_design = TableTextDesign(self.size, line_spacing=5, col_spacing=3, text_matrix=self.__post_matrix__, fontsize = self.text_size, mask=False, truncate_cols=False, wrap=True)
|
||||
table_design = TableDesign(self.size, line_spacing=5, col_spacing=3, text_matrix=self.__post_matrix__, fontsize = self.text_size, mask=False, truncate_cols=False, wrap=True)
|
||||
self.draw_design(table_design)
|
||||
|
||||
def __get_formatted_post__ (self, post):
|
||||
|
|
|
@ -8,11 +8,11 @@ default_props = {
|
|||
"background_color" : colors["bg"]
|
||||
}
|
||||
|
||||
class TableTextDesign (TextDesign):
|
||||
"""Gets a matrix with text that is than
|
||||
class TableDesign (TextDesign):
|
||||
"""Gets a matrix with text or designs that is than
|
||||
displayed in a table without borders."""
|
||||
def __init__ (self, size, text_matrix, max_col_size = None, max_row_size = None, font = None, fontsize = defaultfontsize, column_horizontal_alignments = [], mask = True, line_spacing = 0, col_spacing = 0, truncate_rows = True, truncate_cols = True, wrap = False, truncate_text=True, truncate_suffix="...", cell_properties=None, background_color = colors["bg"]):
|
||||
super(TableTextDesign, self).__init__(size, font=font, fontsize=fontsize, mask=mask)
|
||||
super(TableDesign, self).__init__(size, font=font, fontsize=fontsize, mask=mask)
|
||||
self.__init_image__(background_color)
|
||||
self.matrix = text_matrix
|
||||
self.max_col_size = max_col_size
|
|
@ -1,6 +1,6 @@
|
|||
from DesignEntity import DesignEntity
|
||||
from TextDesign import TextDesign
|
||||
from TableTextDesign import TableTextDesign
|
||||
from TableDesign import TableDesign
|
||||
from Assets import wpath, weathericons, tempicon, humicon, windicon, no_response, colors, defaultfontsize
|
||||
from PIL import Image
|
||||
from settings import hours
|
||||
|
@ -41,7 +41,7 @@ class WeatherColumnDesign (DesignEntity):
|
|||
size = (self.size[0], self.size[1] - pos[1])
|
||||
line_spacing = (size[1] - len(numbers_list) * fontsize_static) / (len(numbers_list) + 1)
|
||||
|
||||
table = TableTextDesign(size, numbers_list, fontsize=fontsize_static, line_spacing=line_spacing, column_horizontal_alignments=[ "center" ], max_col_size=[ size[0] ], truncate_text=False)
|
||||
table = TableDesign(size, numbers_list, fontsize=fontsize_static, line_spacing=line_spacing, column_horizontal_alignments=[ "center" ], max_col_size=[ size[0] ], truncate_text=False)
|
||||
table.pos = pos
|
||||
self.draw_design(table)
|
||||
|
||||
|
|
Loading…
Reference in a new issue