WIP: Multi-printers #32

Draft
n07070 wants to merge 25 commits from multi-printers into master
Showing only changes of commit 3a1d9b20fb - Show all commits

View File

@@ -216,6 +216,7 @@ class EscPosPrinter(Printer):
self.printer.textln(clean_msg)
if clean_signature:
self.printer.textln(clean_signature)
self.printer.textln()
self.printer.close()
except Exception as e:
self.app.logger.error("Unable to print because : " + str(e))
@@ -323,6 +324,7 @@ class EscPosPrinter(Printer):
with self._lock:
if self._state:
self._state = False
try:
match (task_type.value):
case "text":
self._print_txt(data["txt"], signature=data["sign"])
@@ -340,7 +342,10 @@ class EscPosPrinter(Printer):
self._state = True
case _:
raise RuntimeError("This task type is not supported")
else:
except Exception as e:
self._state = True
raise RuntimeError from e
raise RuntimeError("The printer is not ready to print yet !")