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