Manage error when no Printers are found
This commit is contained in:
@@ -111,6 +111,11 @@ class Printers:
|
|||||||
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))
|
||||||
|
|
||||||
|
if len(printers) < 1:
|
||||||
|
self.app.logger.warning("Not printers found ! Please plug in a Printer and restart the program.")
|
||||||
|
raise RuntimeError("No printers found")
|
||||||
|
|
||||||
return printers
|
return printers
|
||||||
|
|
||||||
def any(self) -> Printer:
|
def any(self) -> Printer:
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class PrintWorker(threading.Thread):
|
|||||||
"Ready" if self.printer.ready else "Not ready",
|
"Ready" if self.printer.ready else "Not ready",
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.app.logger.error(str(e))
|
self.app.logger.error("No printer detected" + str(e))
|
||||||
self.printer = None
|
self.printer = None
|
||||||
|
|
||||||
if self.state != "idle":
|
if self.state != "idle":
|
||||||
|
|||||||
Reference in New Issue
Block a user