From 407dbcffdeb5fe5870271eb06d39e8caf0c9b1bd Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 4 Feb 2020 16:45:22 +0100 Subject: [PATCH] Minor improvements Added support for 2-image mode (due to new driver files). In case something goes wrong, the error will be displayed on the E-Paper, at the corresponding section. --- modules/inkycal_rss.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/inkycal_rss.py b/modules/inkycal_rss.py index 8c4ce4b..0293258 100644 --- a/modules/inkycal_rss.py +++ b/modules/inkycal_rss.py @@ -14,7 +14,7 @@ border_top = int(bottom_section_height * 0.05) border_left = int(bottom_section_width * 0.02) """Choose font optimised for the weather section""" -font = ImageFont.truetype(NotoSans+'.ttf', rss_font_size) +font = ImageFont.truetype(NotoSans+'.ttf', rss_fontsize) space_between_lines = 1 line_height = font.getsize('hg')[1] + space_between_lines line_width = bottom_section_width - (border_left*2) @@ -69,6 +69,11 @@ def generate_image(): rss_image = crop_image(image, 'bottom_section') rss_image.save(image_path+'inkycal_rss.png') + + if three_colour_support == True: + rss_image_col = crop_image(image_col, 'bottom_section') + rss_image_col.save(image_path+'inkycal_rss_col.png') + print('Done') except Exception as e: @@ -76,8 +81,14 @@ def generate_image(): print('Failed!') print('Error in RSS module!') print('Reason: ',e) + clear_image('bottom_section') + write_text(bottom_section_width, bottom_section_height, str(e), + (0, bottom_section_offset), font = font) + rss = crop_image(image, 'bottom_section') + rss.save(image_path+'inkycal_rss.png') pass + def main(): generate_image()