Add _read() method to the CupsPrinter() connector

This commit is contained in:
belono 2023-04-14 12:36:15 +02:00
parent 361afe3555
commit b1a1204bb8
1 changed files with 11 additions and 0 deletions

View File

@ -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.