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 __future__ import print_function
|
||||||
from inkycal_icalendar import fetch_events
|
from inkycal_icalendar import fetch_events
|
||||||
from configuration import*
|
from configuration import*
|
||||||
from settings import *
|
|
||||||
import arrow
|
|
||||||
|
|
||||||
fontsize = 14
|
fontsize = 14
|
||||||
show_events = True
|
show_events = True
|
||||||
@ -45,7 +43,8 @@ else:
|
|||||||
line_pos = [(border_left, int(top_section_height + border_top + line * 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 generate_image():
|
||||||
|
if middle_section == 'inkycal_agenda' and internet_available() == True:
|
||||||
try:
|
try:
|
||||||
clear_image('middle_section')
|
clear_image('middle_section')
|
||||||
if not bottom_section:
|
if not bottom_section:
|
||||||
@ -107,7 +106,7 @@ def main():
|
|||||||
|
|
||||||
previous_date = agenda_events[events]['date']
|
previous_date = agenda_events[events]['date']
|
||||||
draw.line((date_col_start, line_pos[events][1],
|
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':
|
elif agenda_events[events]['type'] == 'timed_event':
|
||||||
write_text(time_col_width, line_height, agenda_events[events]['time'],
|
write_text(time_col_width, line_height, agenda_events[events]['time'],
|
||||||
@ -130,7 +129,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
agenda_image = image.crop((0,middle_section_offset,display_width, display_height))
|
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')
|
print('Done')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -140,5 +139,7 @@ def main():
|
|||||||
print('Reason: ',e)
|
print('Reason: ',e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
|
generate_image()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user