Compare commits
4 Commits
54678175ba
...
175dd3385a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
175dd3385a | ||
|
|
3a1d9b20fb | ||
|
|
c57e2f91a2 | ||
|
|
9ccd2b8bdf |
@@ -83,7 +83,7 @@ except PermissionError:
|
|||||||
sys.exit(77)
|
sys.exit(77)
|
||||||
|
|
||||||
# Output the config file
|
# Output the config file
|
||||||
if os.getenv("FLASK_DEBUG"):
|
if not os.getenv("FLASK_DEBUG") is None and os.getenv("FLASK_DEBUG") is True:
|
||||||
pprint.pprint(configuration_file)
|
pprint.pprint(configuration_file)
|
||||||
|
|
||||||
# We define the app module used by Flask
|
# We define the app module used by Flask
|
||||||
@@ -402,4 +402,4 @@ def camera_status():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True, use_reloader=False, host="0.0.0.0", ssl_context="adhoc")
|
app.run(use_reloader=False, host="0.0.0.0", ssl_context="adhoc")
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class PrintQueue:
|
|||||||
with self._lock:
|
with self._lock:
|
||||||
self.app.logger.debug("Return current queue state")
|
self.app.logger.debug("Return current queue state")
|
||||||
return [
|
return [
|
||||||
{"task_id": t.task_id, "status": t.status, "type": str(t.task_type)}
|
{"task_id": t.task_id, "status": t.status, "type": str(t.task_type), "content": str(t.get_print_data())}
|
||||||
for t in self._queue
|
for t in self._queue
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ class EscPosPrinter(Printer):
|
|||||||
self.printer.textln(clean_msg)
|
self.printer.textln(clean_msg)
|
||||||
if clean_signature:
|
if clean_signature:
|
||||||
self.printer.textln(clean_signature)
|
self.printer.textln(clean_signature)
|
||||||
|
self.printer.textln()
|
||||||
self.printer.close()
|
self.printer.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.app.logger.error("Unable to print because : " + str(e))
|
self.app.logger.error("Unable to print because : " + str(e))
|
||||||
@@ -323,24 +324,28 @@ class EscPosPrinter(Printer):
|
|||||||
with self._lock:
|
with self._lock:
|
||||||
if self._state:
|
if self._state:
|
||||||
self._state = False
|
self._state = False
|
||||||
match (task_type.value):
|
try:
|
||||||
case "text":
|
match (task_type.value):
|
||||||
self._print_txt(data["txt"], signature=data["sign"])
|
case "text":
|
||||||
self._state = True
|
self._print_txt(data["txt"], signature=data["sign"])
|
||||||
case "image":
|
self._state = True
|
||||||
self._print_img(
|
case "image":
|
||||||
data["img"], signature=data["sign"], process=data["process"]
|
self._print_img(
|
||||||
)
|
data["img"], signature=data["sign"], process=data["process"]
|
||||||
self._state = True
|
)
|
||||||
case "cut":
|
self._state = True
|
||||||
self._cut()
|
case "cut":
|
||||||
self._state = True
|
self._cut()
|
||||||
case "qr":
|
self._state = True
|
||||||
self._qr(data["txt"])
|
case "qr":
|
||||||
self._state = True
|
self._qr(data["txt"])
|
||||||
case _:
|
self._state = True
|
||||||
raise RuntimeError("This task type is not supported")
|
case _:
|
||||||
else:
|
raise RuntimeError("This task type is not supported")
|
||||||
|
except Exception as e:
|
||||||
|
self._state = True
|
||||||
|
raise RuntimeError from e
|
||||||
|
|
||||||
raise RuntimeError("The printer is not ready to print yet !")
|
raise RuntimeError("The printer is not ready to print yet !")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
<h3 class="card-header">Print a short message</h3>
|
<h3 class="card-header">Print a short message</h3>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="form-group" action="/web/print/sms" method="post">
|
<form class="form-group" action="/web/print/sms" method="post">
|
||||||
<input class="form-control" type="text" name="txt" placeholder="200 chars or less " maxlength="200" required><br>
|
<textarea class="form-control" type="text" name="txt" placeholder="4096 chars or less " maxlength="4096"></textarea>
|
||||||
|
<br>
|
||||||
<input class="form-control" type="text" name="signature" placeholder="Signature or pseudo" maxlength="200"><br>
|
<input class="form-control" type="text" name="signature" placeholder="Signature or pseudo" maxlength="200"><br>
|
||||||
<input class="btn btn-primary float-right" type="submit" value="Imprimer" name="imprimer">
|
<input class="btn btn-primary float-right" type="submit" value="Imprimer" name="imprimer">
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user