From 30d1cc8e3d477ccf6cae26d9b75295098ee7612c Mon Sep 17 00:00:00 2001 From: TT-392 Date: Sun, 15 Sep 2024 12:41:12 +0200 Subject: [PATCH] Tie printing and frontend together --- flask/app.py | 6 ++++++ flask/print.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/flask/app.py b/flask/app.py index 8a529d5..d203deb 100644 --- a/flask/app.py +++ b/flask/app.py @@ -3,6 +3,8 @@ from PIL import Image from gen_image import gen_image from printer_info import * from datetime import datetime +from print import * +from format_image import * import os valid_height=800 @@ -126,8 +128,12 @@ def text(): @app.route('/text-print', methods=['GET', 'POST']) def tex_print(): if request.method == 'POST': + image = format_image("static/text/text.png") + print_image(image) + if 'cut' in request.form: print("printing and cutting") + cut_paper() session["cut"] = True; else: print("printing") diff --git a/flask/print.py b/flask/print.py index 5425d0a..0effc24 100644 --- a/flask/print.py +++ b/flask/print.py @@ -19,9 +19,9 @@ def print_image(image): # I'm sorry os.system("cd epson/; ./print_image.sh /tmp/image.png; cd ..") -image = format_image("static/text/text.png") -image.save("/tmp/image.png") -print_image(image) -cut_paper() +#image = format_image("static/text/text.png") +#image.save("/tmp/image.png") +#print_image(image) +#cut_paper()