Auto-expand agenda
Added feature to automatically expand agenda module if the bottom section is emtpy
This commit is contained in:
		| @@ -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 | """Find max number of lines that can fit in the middle section and allocate | ||||||
| a position for each line""" | a position for each line""" | ||||||
| max_lines = int((middle_section_height - border_top*2) // line_height) | if bottom_section: | ||||||
| line_pos = [(border_left, int(top_section_height + line * line_height)) |   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)] |   for line in range(max_lines)] | ||||||
|  |  | ||||||
| def main(): | def main(): | ||||||
| @@ -117,7 +122,11 @@ def main(): | |||||||
|             (event_col_start, line_pos[events][1]), alignment = 'left', font = font) |             (event_col_start, line_pos[events][1]), alignment = 'left', font = font) | ||||||
|  |  | ||||||
|     """Crop the image to show only the middle section""" |     """Crop the image to show only the middle section""" | ||||||
|  |     if bottom_section: | ||||||
|       agenda_image = crop_image(image, 'middle_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') |     agenda_image.save(image_path+'agenda.png') | ||||||
|     print('Done') |     print('Done') | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user