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.
This commit is contained in:
		| @@ -14,7 +14,7 @@ border_top = int(bottom_section_height * 0.05) | |||||||
| border_left = int(bottom_section_width * 0.02) | border_left = int(bottom_section_width * 0.02) | ||||||
|  |  | ||||||
| """Choose font optimised for the weather section""" | """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 | space_between_lines = 1 | ||||||
| line_height = font.getsize('hg')[1] + space_between_lines | line_height = font.getsize('hg')[1] + space_between_lines | ||||||
| line_width = bottom_section_width - (border_left*2) | line_width = bottom_section_width - (border_left*2) | ||||||
| @@ -69,6 +69,11 @@ def generate_image(): | |||||||
|  |  | ||||||
|       rss_image = crop_image(image, 'bottom_section') |       rss_image = crop_image(image, 'bottom_section') | ||||||
|       rss_image.save(image_path+'inkycal_rss.png') |       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') |       print('Done') | ||||||
|  |  | ||||||
|     except Exception as e: |     except Exception as e: | ||||||
| @@ -76,8 +81,14 @@ def generate_image(): | |||||||
|       print('Failed!') |       print('Failed!') | ||||||
|       print('Error in RSS module!') |       print('Error in RSS module!') | ||||||
|       print('Reason: ',e) |       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 |       pass | ||||||
|  |  | ||||||
|  |  | ||||||
| def main(): | def main(): | ||||||
|   generate_image() |   generate_image() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user