aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-06-16 08:00:33 +0300
committerFrederick Muriuki Muriithi2023-06-20 13:36:50 +0300
commit3ac57ba09a504bf0f03c0786c1d2504363a660ec (patch)
treeac7a75e41d655504ebcee720674919b46eb8901e /wqflask/utility
parentaa4d213692cb27a903fe1593e2dd3387e638b350 (diff)
downloadgenenetwork2-3ac57ba09a504bf0f03c0786c1d2504363a660ec.tar.gz
Add blueprint and rework configuration retrieval
Add a blueprint for the `wqflask.api` package and register the `wqflask.api.router` module as a child. Rework the cascading imports to use the new configuration system to avoid circular imports.
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/pillow_utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/wqflask/utility/pillow_utils.py b/wqflask/utility/pillow_utils.py
index e302df18..eca45244 100644
--- a/wqflask/utility/pillow_utils.py
+++ b/wqflask/utility/pillow_utils.py
@@ -1,6 +1,7 @@
+from flask import current_app as app
from PIL import Image, ImageColor, ImageDraw, ImageFont
-from utility.tools import TEMPDIR
+from utility.configuration import get_setting
BLACK = ImageColor.getrgb("black")
WHITE = ImageColor.getrgb("white")
@@ -15,7 +16,7 @@ def draw_rotated_text(canvas, text, font, xy, fill=BLACK, angle=-90):
draw_text = ImageDraw.Draw(tmp_img)
draw_text.text(text=text, xy=(0, 0), font=font, fill=fill)
tmp_img2 = tmp_img.rotate(angle, expand=1)
- tmp_img2.save("/{0}/{1}.png".format(TEMPDIR, text), format="png")
+ tmp_img2.save("/{0}/{1}.png".format(get_setting(app, "TEMPDIR"), text), format="png")
canvas.paste(im=tmp_img2, box=tuple([int(i) for i in xy]))
# def draw_open_polygon(canvas: Image, xy: tuple, fill: ImageColor=WHITE, outline: ImageColor=BLACK):