From bd02f9116a445b56d45ae96034478e5ac31da730 Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Thu, 17 Sep 2020 15:34:43 +0200 Subject: [PATCH] Fix TypeError if USBPrinting plugin path is not found Fixes CURA-17T sentry issue --- plugins/USBPrinting/USBPrinterOutputDevice.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index f8d344839c..30694b074b 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -88,8 +88,12 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._firmware_name_requested = False self._firmware_updater = AvrFirmwareUpdater(self) - plugin_path = cast(str, PluginRegistry.getInstance().getPluginPath("USBPrinting")) - self._monitor_view_qml_path = os.path.join(plugin_path, "MonitorItem.qml") + plugin_path = PluginRegistry.getInstance().getPluginPath("USBPrinting") + if plugin_path: + self._monitor_view_qml_path = os.path.join(plugin_path, "MonitorItem.qml") + else: + Logger.log("e", "Cannot create Monitor QML view: cannot find plugin path for plugin [USBPrinting]") + self._monitor_view_qml_path = "" CuraApplication.getInstance().getOnExitCallbackManager().addCallback(self._checkActivePrintingUponAppExit)