Change the way a Printer is used by the worker

This commit is contained in:
n07070
2026-10-11 21:42:29 +02:00
parent 31213eeeea
commit fd0507ff4f
4 changed files with 59 additions and 9 deletions

View File

@@ -75,6 +75,7 @@ class Printer(ABC):
self.ready = False
self.printer_type = printer_type
self._lock = threading.Lock()
self.used = False
@abstractmethod
def _has_paper(self) -> bool:
@@ -88,6 +89,13 @@ class Printer(ABC):
def print_task(self, task_type, data) -> None:
"""Takes a PrintTask and executes it"""
def use_printer(self) -> None:
"""Marks the printer as being used """
self.used = True
def free_printer(self) -> None:
"""Marks the printer as being not used, it's available."""
self.used = False
class EscPosPrinter(Printer):
"""