From b1a1204bb8c53444fa9189e4e5991782d2c0c72f Mon Sep 17 00:00:00 2001 From: belono Date: Fri, 14 Apr 2023 12:36:15 +0200 Subject: [PATCH] Add _read() method to the CupsPrinter() connector --- src/escpos/printer.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/escpos/printer.py b/src/escpos/printer.py index 06e48a2..f2fbe6e 100644 --- a/src/escpos/printer.py +++ b/src/escpos/printer.py @@ -523,6 +523,17 @@ if _CUPSPRINT: self.tmpfile.close() self.pending_job = False + def _read(self): + """Return a single-item array with the accepting state of the print queue. + + states: idle = [3], printing a job = [4], stopped = [5] + """ + printer = self.printers.get(self.printer_name, {}) + state = printer.get("printer-state") + if not state: + return [] + return [state] + def close(self): """Close CUPS connection.