Auto-expand agenda

Added feature to automatically expand agenda module if the bottom section is emtpy
This commit is contained in:
Ace 2019-12-12 00:10:00 +01:00 committed by GitHub
parent 6980e8e419
commit 0e361a0a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,8 +35,13 @@ event_col_start = time_col_start + time_col_width
"""Find max number of lines that can fit in the middle section and allocate
a position for each line"""
max_lines = int((middle_section_height - border_top*2) // line_height)
line_pos = [(border_left, int(top_section_height + line * line_height))
if bottom_section:
max_lines = int((middle_section_height - border_top*2) // line_height)
else:
max_lines = int(middle_section_height+bottom_section_height -
(border_top * 2))// line_height
line_pos = [(border_left, int(top_section_height + border_top + line * line_height))
for line in range(max_lines)]
def main():
@ -117,7 +122,11 @@ def main():
(event_col_start, line_pos[events][1]), alignment = 'left', font = font)
"""Crop the image to show only the middle section"""
agenda_image = crop_image(image, 'middle_section')
if bottom_section:
agenda_image = crop_image(image, 'middle_section')
else:
agenda_image = image.crop((0,middle_section_offset,display_width, display_height))
agenda_image.save(image_path+'agenda.png')
print('Done')