From 2e3d6bba32c1d2ab414668d5f68f2c3c1bfcb54f Mon Sep 17 00:00:00 2001 From: TT-392 Date: Wed, 27 Nov 2024 23:55:50 +0100 Subject: [PATCH] Add "Remove by" template --- app.py | 19 ++++++++++++++++++- templates/image.html | 2 +- templates/text.html | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index d51509d..a691a3f 100644 --- a/app.py +++ b/app.py @@ -3,7 +3,7 @@ from flask import Flask, render_template, request, redirect, url_for, session, s from PIL import Image from gen_image import gen_image from config import * -from datetime import datetime +from datetime import * from print import * from process_image import * from file_handler import * @@ -44,6 +44,19 @@ templates = { "pos": 130 }, "cut": True + }, + "Remove by": { + "text1": { + "string": "Remove by", + "size": 130, + "pos": 0 + }, + "text2": { + "string": "", + "size": 50, + "pos": 130 + }, + "cut": True } } @@ -140,9 +153,13 @@ def text_template(): if request.method == 'POST': template = templates[request.form["template"]] + if request.form["template"] == "Food": template["text2"]["string"] = datetime.now().strftime('%Y-%m-%d') + if request.form["template"] == "Remove by": + template["text2"]["string"] = (datetime.now() + timedelta(weeks=3)).strftime('%Y-%m-%d') + session["text1"] = template["text1"] session["text2"] = template["text2"] session["cut"] = template["cut"] diff --git a/templates/image.html b/templates/image.html index 1a4f2f5..c23ffe6 100644 --- a/templates/image.html +++ b/templates/image.html @@ -6,7 +6,7 @@

- Recommended image height = {{label_width}}, taller images will be scaled + Recommended image height = {{label_width}}, other sizes will be scaled
{% if info %} diff --git a/templates/text.html b/templates/text.html index bcb3f1b..02a0f7b 100644 --- a/templates/text.html +++ b/templates/text.html @@ -8,6 +8,7 @@