diff --git a/src/printers.py b/src/printers.py index 379ce18..b3d020c 100644 --- a/src/printers.py +++ b/src/printers.py @@ -1,13 +1,14 @@ """ A collection of Printers. -It has methods to discover printers, and provides an interface for the methods expected from printers. +It has methods to discover printers, and provides an interface for +the methods expected from printers. """ -from collections.abc import Mapping, Set +from collections.abc import Set import usb.core import usb.util -from printer import Printer, EscPosPrinter, BrotherPrinter, PrinterType +from printer import Printer, EscPosPrinter, BrotherPrinter class Printers: @@ -81,7 +82,7 @@ class Printers: # If the object creation is successfull, we add it to the list of Printers printers.add(escpos_printer) - self.app.logger.debug("Found a %s printer" % manufacturer) + self.app.logger.debug("Found a %s printer", manufacturer) # We already found the type of printer, # we don't need an extra comparaison. @@ -99,7 +100,7 @@ class Printers: ) except Exception as e: self.app.logger.error( - "Could not create a %s printer class with %s:%s" % product, + "Could not create a %s printer class with %s:%s" , product, dev.idVendor, dev.idProduct, ) @@ -107,9 +108,9 @@ class Printers: # If the object creation is successfull, we add it to the list of Printers printers.add(brother_printer) - self.app.logger.debug("Found a %s printer" % manufacturer) + self.app.logger.debug("Found a %s printer" , manufacturer) - self.app.logger.debug("Found %s printers" % len(printers)) + self.app.logger.debug("Found %s printers" , len(printers)) return printers def any(self) -> Printer: @@ -122,16 +123,20 @@ class Printers: else: raise RuntimeError("No printers available") - def get_printer(self, printer_type): - """ - Return a specific printer + # def get_printer(self, printer_type): + # """ + # Return a specific printer - printer_type -- a printer type - """ - return NotImplementedError() + # printer_type -- a printer type + # """ + # return NotImplementedError() class _FindClass: + """ + Use by usb.core to modify the way USB devices are found + Taken from pyUSB documentation on Github + """ def __init__(self, class_): self._class = class_