improved execution handling
This commit is contained in:
parent
e05c13bbc6
commit
4967a86063
@ -7,9 +7,6 @@ Copyright by aceisace
|
||||
from __future__ import print_function
|
||||
import calendar
|
||||
from configuration import *
|
||||
from settings import *
|
||||
import arrow
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
print_events = False
|
||||
show_events = True
|
||||
@ -68,7 +65,8 @@ max_event_lines = (events_height - border_top) // (font.getsize('hg')[1]
|
||||
event_lines = [(border_left,(bottom_section_offset - events_height)+
|
||||
int(events_height/max_event_lines*_)) for _ in range(max_event_lines)]
|
||||
|
||||
def main():
|
||||
def generate_image():
|
||||
if middle_section == "inkycal_calendar" and internet_available() == True:
|
||||
try:
|
||||
clear_image('middle_section')
|
||||
print('Calendar module: Generating image...', end = '')
|
||||
@ -114,7 +112,7 @@ def main():
|
||||
y_text = int((icon_height / 2) - (text_height / 1.7))
|
||||
ImageDraw.Draw(icon).ellipse((x_circle-radius, y_circle-radius,
|
||||
x_circle+radius, y_circle+radius), fill= 'red' if
|
||||
display_type == 'colour' else 'black', outline=None)
|
||||
three_colour_support == True else 'black', outline=None)
|
||||
ImageDraw.Draw(icon).text((x_text, y_text), str(now.day), fill='white',
|
||||
font=bold)
|
||||
image.paste(icon, current_day_pos, icon)
|
||||
@ -198,7 +196,7 @@ def main():
|
||||
events.end.format(style)), events.all_day)
|
||||
|
||||
calendar_image = crop_image(image, 'middle_section')
|
||||
calendar_image.save(image_path+'calendar.png')
|
||||
calendar_image.save(image_path+'inkycal_calendar.png')
|
||||
|
||||
print('Done')
|
||||
|
||||
@ -209,6 +207,7 @@ def main():
|
||||
print('Reason: ',e)
|
||||
pass
|
||||
|
||||
def main():
|
||||
generate_image()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user