improved execution handling
This commit is contained in:
parent
87eaf0d5da
commit
e05c13bbc6
@ -7,8 +7,6 @@ Copyright by aceisace
|
||||
from __future__ import print_function
|
||||
from inkycal_icalendar import fetch_events
|
||||
from configuration import*
|
||||
from settings import *
|
||||
import arrow
|
||||
|
||||
fontsize = 14
|
||||
show_events = True
|
||||
@ -45,7 +43,8 @@ else:
|
||||
line_pos = [(border_left, int(top_section_height + border_top + line * line_height))
|
||||
for line in range(max_lines)]
|
||||
|
||||
def main():
|
||||
def generate_image():
|
||||
if middle_section == 'inkycal_agenda' and internet_available() == True:
|
||||
try:
|
||||
clear_image('middle_section')
|
||||
if not bottom_section:
|
||||
@ -107,7 +106,7 @@ def main():
|
||||
|
||||
previous_date = agenda_events[events]['date']
|
||||
draw.line((date_col_start, line_pos[events][1],
|
||||
line_width,line_pos[events][1]), fill = 'red' if display_type == 'colour' else 'black')
|
||||
line_width,line_pos[events][1]), fill = 'red' if three_colour_support == True' else 'black')
|
||||
|
||||
elif agenda_events[events]['type'] == 'timed_event':
|
||||
write_text(time_col_width, line_height, agenda_events[events]['time'],
|
||||
@ -130,7 +129,7 @@ def main():
|
||||
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+'inkycal_agenda.png')
|
||||
print('Done')
|
||||
|
||||
except Exception as e:
|
||||
@ -140,5 +139,7 @@ def main():
|
||||
print('Reason: ',e)
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
def main():
|
||||
generate_image()
|
||||
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user