diff --git a/cura/Machines/MaterialManager.py b/cura/Machines/MaterialManager.py index 4d9574bf38..160508e7a6 100644 --- a/cura/Machines/MaterialManager.py +++ b/cura/Machines/MaterialManager.py @@ -683,7 +683,11 @@ class MaterialManager(QObject): @pyqtSlot(str) def removeFavorite(self, root_material_id: str) -> None: - self._favorites.remove(root_material_id) + try: + self._favorites.remove(root_material_id) + except KeyError: + Logger.log("w", "Could not delete material %s from favorites as it was already deleted", root_material_id) + return self.materialsUpdated.emit() # Ensure all settings are saved. @@ -692,4 +696,4 @@ class MaterialManager(QObject): @pyqtSlot() def getFavorites(self): - return self._favorites \ No newline at end of file + return self._favorites diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index f12a5b1222..ef0898bb04 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -833,7 +833,10 @@ class CuraEngineBackend(QObject, Backend): self._onChanged() def _onProcessLayersFinished(self, job: ProcessSlicedLayersJob) -> None: - del self._stored_optimized_layer_data[job.getBuildPlate()] + if job.getBuildPlate() in self._stored_optimized_layer_data: + del self._stored_optimized_layer_data[job.getBuildPlate()] + else: + Logger.log("w", "The optimized layer data was already deleted for buildplate %s", job.getBuildPlate()) self._process_layers_job = None Logger.log("d", "See if there is more to slice(2)...") self._invokeSlice() diff --git a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.py b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.py index 0a3e3a0ff0..59552775b6 100644 --- a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.py +++ b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.py @@ -57,7 +57,7 @@ class FirmwareUpdaterMachineAction(MachineAction): outputDeviceCanUpdateFirmwareChanged = pyqtSignal() @pyqtProperty(QObject, notify = outputDeviceCanUpdateFirmwareChanged) def firmwareUpdater(self) -> Optional["FirmwareUpdater"]: - if self._active_output_device and self._active_output_device.activePrinter.getController().can_update_firmware: + if self._active_output_device and self._active_output_device.activePrinter and self._active_output_device.activePrinter.getController().can_update_firmware: self._active_firmware_updater = self._active_output_device.getFirmwareUpdater() return self._active_firmware_updater