From 4f321815947860bcad46a4227bedce2a583a8c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gert=20Lindstr=C3=B6m?= <32777118+gertlind@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:03:21 +0100 Subject: [PATCH 1/2] Update imagegen.py Added "anchor" to element type multiline. --- custom_components/open_epaper_link/imagegen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/open_epaper_link/imagegen.py b/custom_components/open_epaper_link/imagegen.py index cb69b8a..a208559 100644 --- a/custom_components/open_epaper_link/imagegen.py +++ b/custom_components/open_epaper_link/imagegen.py @@ -175,12 +175,13 @@ def customimage(entity_id, service, hass): font_file = os.path.join(os.path.dirname(__file__), font) font = ImageFont.truetype(font_file, size) color = element.get('color', "black") + anchor = element.get('anchor', "lm") _LOGGER.debug("Got Multiline string: %s with delimiter: %s" % (element['value'],element["delimiter"])) lst = element['value'].replace("\n","").split(element["delimiter"]) pos = element.get('start_y', pos_y + element.get('y_padding', 10)) for elem in lst: _LOGGER.debug("String: %s" % (elem)) - d.text((element['x'], pos ), str(elem), fill=getIndexColor(color), font=font) + d.text((element['x'], pos ), str(elem), fill=getIndexColor(color), font=font, anchor=anchor)) pos = pos + element['offset_y'] pos_y = pos #icon From cc59a5c6a9911cea83838ad6c972fe2d603bd75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gert=20Lindstr=C3=B6m?= <32777118+gertlind@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:45:52 +0100 Subject: [PATCH 2/2] Update imagegen.py Extra parenthesis removed. --- custom_components/open_epaper_link/imagegen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/open_epaper_link/imagegen.py b/custom_components/open_epaper_link/imagegen.py index a208559..9f1aa33 100644 --- a/custom_components/open_epaper_link/imagegen.py +++ b/custom_components/open_epaper_link/imagegen.py @@ -181,7 +181,7 @@ def customimage(entity_id, service, hass): pos = element.get('start_y', pos_y + element.get('y_padding', 10)) for elem in lst: _LOGGER.debug("String: %s" % (elem)) - d.text((element['x'], pos ), str(elem), fill=getIndexColor(color), font=font, anchor=anchor)) + d.text((element['x'], pos ), str(elem), fill=getIndexColor(color), font=font, anchor=anchor) pos = pos + element['offset_y'] pos_y = pos #icon