Add "Remove by" template
This commit is contained in:
parent
1746db8e37
commit
2e3d6bba32
3 changed files with 20 additions and 2 deletions
19
app.py
19
app.py
|
@ -3,7 +3,7 @@ from flask import Flask, render_template, request, redirect, url_for, session, s
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from gen_image import gen_image
|
from gen_image import gen_image
|
||||||
from config import *
|
from config import *
|
||||||
from datetime import datetime
|
from datetime import *
|
||||||
from print import *
|
from print import *
|
||||||
from process_image import *
|
from process_image import *
|
||||||
from file_handler import *
|
from file_handler import *
|
||||||
|
@ -44,6 +44,19 @@ templates = {
|
||||||
"pos": 130
|
"pos": 130
|
||||||
},
|
},
|
||||||
"cut": True
|
"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':
|
if request.method == 'POST':
|
||||||
template = templates[request.form["template"]]
|
template = templates[request.form["template"]]
|
||||||
|
|
||||||
if request.form["template"] == "Food":
|
if request.form["template"] == "Food":
|
||||||
template["text2"]["string"] = datetime.now().strftime('%Y-%m-%d')
|
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["text1"] = template["text1"]
|
||||||
session["text2"] = template["text2"]
|
session["text2"] = template["text2"]
|
||||||
session["cut"] = template["cut"]
|
session["cut"] = template["cut"]
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<form method="POST" action="/image" enctype="multipart/form-data">
|
<form method="POST" action="/image" enctype="multipart/form-data">
|
||||||
<input type="file" name="image">
|
<input type="file" name="image">
|
||||||
<input type="submit" value="Generate preview"><br>
|
<input type="submit" value="Generate preview"><br>
|
||||||
Recommended image height = {{label_width}}, taller images will be scaled
|
Recommended image height = {{label_width}}, other sizes will be scaled
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if info %}
|
{% if info %}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<select name="template">
|
<select name="template">
|
||||||
<option value="DNH">Do not hack</option>
|
<option value="DNH">Do not hack</option>
|
||||||
<option value="Food">Food</option>
|
<option value="Food">Food</option>
|
||||||
|
<option value="Remove by">Remove by</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" value="Apply">
|
<input type="submit" value="Apply">
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue