From a604f2041a1813f44f12054d46f49a2b1b2e17b9 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 30 Jun 2015 23:32:06 +0200 Subject: [PATCH] Do not show a firmware update window if there are no printers connected Contributes to Ultimaker/Uranium#8 --- plugins/USBPrinting/USBPrinterManager.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/USBPrinting/USBPrinterManager.py b/plugins/USBPrinting/USBPrinterManager.py index f52a0c45ac..441b5d176f 100644 --- a/plugins/USBPrinting/USBPrinterManager.py +++ b/plugins/USBPrinting/USBPrinterManager.py @@ -7,6 +7,7 @@ from UM.Application import Application from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.SceneNode import SceneNode from UM.Resources import Resources +from UM.Logger import Logger import threading import platform import glob @@ -110,9 +111,16 @@ class USBPrinterManager(QObject, SignalEmitter, Extension): time.sleep(5) # Throttle, as we don"t need this information to be updated every single second. def updateAllFirmware(self): + if not self._printer_connections: + Logger.log("e", "No printer connected to update firmware of!") + return + self.spawnFirmwareInterface("") for printer_connection in self._printer_connections: - printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName())) + try: + printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName())) + except FileNotFoundError: + continue def updateFirmwareBySerial(self, serial_port): printer_connection = self.getConnectionByPort(serial_port)