From 6d2bcd9b3e6acc7ae690c18758e9f6b6dd8beabb Mon Sep 17 00:00:00 2001 From: Ruben D Date: Mon, 20 Nov 2017 01:55:57 +0100 Subject: [PATCH] Fix error message when slicing with per-object setting errors The message was generating a list of settings that had an error state by going through all extruder stacks and the global stack, but didn't bother to check the per-object stacks. I could've added it to the regular message but then the user would be confused because he can't find any errors either. So instead I opted to specify that it happened in per-model settings. It's not perfect, but should narrow down the user's search considerably. Fixes #2427. --- .../CuraEngineBackend/CuraEngineBackend.py | 20 +++++++++++++++++++ plugins/CuraEngineBackend/StartSliceJob.py | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 0c1fc6f4ad..14c1c10b90 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -301,6 +301,26 @@ class CuraEngineBackend(QObject, Backend): self.backendStateChange.emit(BackendState.NotStarted) return + elif job.getResult() == StartSliceJob.StartJobResult.ObjectSettingError: + errors = {} + for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): + stack = node.callDecoration("getStack") + if not stack: + continue + for key in stack.getErrorKeys(): + definition = self._global_container_stack.getBottom().findDefinitions(key = key) + if not definition: + Logger.log("e", "When checking settings for errors, unable to find definition for key {key} in per-object stack.".format(key = key)) + continue + definition = definition[0] + errors[key] = definition.label + error_labels = ", ".join(errors.values()) + self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice due to some per-model settings. The following settings have errors on one or more models: {error_labels}").format(error_labels = error_labels), + title = catalog.i18nc("@info:title", "Unable to slice")) + self._error_message.show() + self.backendStateChange.emit(BackendState.Error) + return + if job.getResult() == StartSliceJob.StartJobResult.BuildPlateError: if Application.getInstance().platformActivity: self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."), diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index a53daa4e63..eb0337c4f2 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -26,6 +26,7 @@ class StartJobResult(IntEnum): NothingToSlice = 4 MaterialIncompatible = 5 BuildPlateError = 6 + ObjectSettingError = 7 #When an error occurs in per-object settings. ## Formatter class that handles token expansion in start/end gcod @@ -105,7 +106,7 @@ class StartSliceJob(Job): continue if self._checkStackForErrors(node.callDecoration("getStack")): - self.setResult(StartJobResult.SettingError) + self.setResult(StartJobResult.ObjectSettingError) return with self._scene.getSceneLock():