Tie printing and frontend together
This commit is contained in:
parent
8c48b68f77
commit
30d1cc8e3d
2 changed files with 10 additions and 4 deletions
|
@ -3,6 +3,8 @@ from PIL import Image
|
||||||
from gen_image import gen_image
|
from gen_image import gen_image
|
||||||
from printer_info import *
|
from printer_info import *
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from print import *
|
||||||
|
from format_image import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
valid_height=800
|
valid_height=800
|
||||||
|
@ -126,8 +128,12 @@ def text():
|
||||||
@app.route('/text-print', methods=['GET', 'POST'])
|
@app.route('/text-print', methods=['GET', 'POST'])
|
||||||
def tex_print():
|
def tex_print():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
image = format_image("static/text/text.png")
|
||||||
|
print_image(image)
|
||||||
|
|
||||||
if 'cut' in request.form:
|
if 'cut' in request.form:
|
||||||
print("printing and cutting")
|
print("printing and cutting")
|
||||||
|
cut_paper()
|
||||||
session["cut"] = True;
|
session["cut"] = True;
|
||||||
else:
|
else:
|
||||||
print("printing")
|
print("printing")
|
||||||
|
|
|
@ -19,9 +19,9 @@ def print_image(image):
|
||||||
# I'm sorry
|
# I'm sorry
|
||||||
os.system("cd epson/; ./print_image.sh /tmp/image.png; cd ..")
|
os.system("cd epson/; ./print_image.sh /tmp/image.png; cd ..")
|
||||||
|
|
||||||
image = format_image("static/text/text.png")
|
#image = format_image("static/text/text.png")
|
||||||
image.save("/tmp/image.png")
|
#image.save("/tmp/image.png")
|
||||||
print_image(image)
|
#print_image(image)
|
||||||
cut_paper()
|
#cut_paper()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue