fix merge conflict

This commit is contained in:
ChrisTerBeke 2017-11-20 10:24:33 +01:00
commit 8522fbf6f5
3 changed files with 28 additions and 4 deletions

View file

@ -264,10 +264,12 @@ class PrintInformation(QObject):
def jobName(self): def jobName(self):
return self._job_name return self._job_name
def _updateJobName(self): def _updateJobName(self, empty_name = False):
# if the project name is set, we use the project name as the job name, so the job name should not get updated # if the project name is set, we use the project name as the job name, so the job name should not get updated
# if a model file is loaded after that. # if a model file is loaded after that.
if self._project_name != "": if self._project_name != "":
if empty_name:
self._project_name = ""
return return
if self._base_name == "": if self._base_name == "":
@ -304,12 +306,13 @@ class PrintInformation(QObject):
name = os.path.splitext(name)[0] name = os.path.splitext(name)[0]
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again # name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
if name == "" or (self._base_name == "" and self._base_name != name): is_empty = name == ""
if is_empty or (self._base_name == "" and self._base_name != name):
# remove ".curaproject" suffix from (imported) the file name # remove ".curaproject" suffix from (imported) the file name
if name.endswith(".curaproject"): if name.endswith(".curaproject"):
name = name[:name.rfind(".curaproject")] name = name[:name.rfind(".curaproject")]
self._base_name = name self._base_name = name
self._updateJobName() self._updateJobName(empty_name = is_empty)
## Created an acronymn-like abbreviated machine name from the currently active machine name ## Created an acronymn-like abbreviated machine name from the currently active machine name
# Called each time the global stack is switched # Called each time the global stack is switched

View file

@ -301,6 +301,26 @@ class CuraEngineBackend(QObject, Backend):
self.backendStateChange.emit(BackendState.NotStarted) self.backendStateChange.emit(BackendState.NotStarted)
return 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 job.getResult() == StartSliceJob.StartJobResult.BuildPlateError:
if Application.getInstance().platformActivity: 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."), self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."),

View file

@ -26,6 +26,7 @@ class StartJobResult(IntEnum):
NothingToSlice = 4 NothingToSlice = 4
MaterialIncompatible = 5 MaterialIncompatible = 5
BuildPlateError = 6 BuildPlateError = 6
ObjectSettingError = 7 #When an error occurs in per-object settings.
## Formatter class that handles token expansion in start/end gcod ## Formatter class that handles token expansion in start/end gcod
@ -105,7 +106,7 @@ class StartSliceJob(Job):
continue continue
if self._checkStackForErrors(node.callDecoration("getStack")): if self._checkStackForErrors(node.callDecoration("getStack")):
self.setResult(StartJobResult.SettingError) self.setResult(StartJobResult.ObjectSettingError)
return return
with self._scene.getSceneLock(): with self._scene.getSceneLock():