Merge branch '3.1'

This commit is contained in:
Ghostkeeper 2017-11-22 17:13:16 +01:00
commit f3da1a25fc
No known key found for this signature in database
GPG Key ID: 5252B696FB5E7C7A
5 changed files with 24 additions and 8 deletions

1
.gitignore vendored
View File

@ -44,6 +44,7 @@ plugins/cura-god-mode-plugin
plugins/cura-big-flame-graph
plugins/cura-siemensnx-plugin
plugins/CuraVariSlicePlugin
plugins/CuraLiveScriptingPlugin
#Build stuff
CMakeCache.txt

View File

@ -70,6 +70,7 @@ class PrintInformation(QObject):
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
Application.getInstance().fileLoaded.connect(self.setBaseName)
Application.getInstance().workspaceLoaded.connect(self.setProjectName)
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
self._active_material_container = None
@ -283,7 +284,11 @@ class PrintInformation(QObject):
return self._base_name
@pyqtSlot(str)
def setBaseName(self, base_name):
def setProjectName(self, name):
self.setBaseName(name, is_project_file = True)
@pyqtSlot(str)
def setBaseName(self, base_name, is_project_file = False):
# Ensure that we don't use entire path but only filename
name = os.path.basename(base_name)
@ -291,15 +296,17 @@ class PrintInformation(QObject):
# extension. This cuts the extension off if necessary.
name = os.path.splitext(name)[0]
# if this is a profile file, always update the job name
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
is_empty = name == ""
if is_empty or (self._base_name == "" and self._base_name != name):
if is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)):
# remove ".curaproject" suffix from (imported) the file name
if name.endswith(".curaproject"):
name = name[:name.rfind(".curaproject")]
self._base_name = name
self._updateJobName()
## Created an acronymn-like abbreviated machine name from the currently active machine name
# Called each time the global stack is switched
def _setAbbreviatedMachineName(self):

View File

@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack = None
# if extruders are defined in the machine definition use those instead
if machine.extruders and len(machine.extruders) > 0:
if machine.extruders and "0" in machine.extruders:
new_extruder_id = machine.extruders["0"].getId()
extruder_stack = machine.extruders["0"]
@ -449,15 +449,16 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack.setVariantById(variant_id)
extruder_stack.setMaterialById("default")
extruder_stack.setQualityById("default")
quality_changes_id = "default"
if machine.qualityChanges.getId() != "empty_quality_changes":
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
if extruder_quality_changes_container:
quality_changes_id = extruder_quality_changes_container[0].getId()
extruder_stack.setQualityChangesById(quality_changes_id)
extruder_stack.setQualityChangesById(quality_changes_id)
self.addContainer(extruder_stack)
return extruder_stack
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
# The stacks are now responsible for setting the next stack on deserialize. However,
# due to problems with loading order, some stacks may not have the proper next stack

View File

@ -621,9 +621,16 @@ class MachineManager(QObject):
def activeQualityId(self) -> str:
if self._active_container_stack:
quality = self._active_container_stack.quality
if isinstance(quality, type(self._empty_quality_container)):
return ""
quality_changes = self._active_container_stack.qualityChanges
if quality and quality_changes and isinstance(quality_changes, type(self._empty_quality_changes_container)) and not isinstance(quality, type(self._empty_quality_container)):
return quality.getId()
if quality and quality_changes:
if isinstance(quality_changes, type(self._empty_quality_changes_container)):
# It's a built-in profile
return quality.getId()
else:
# Custom profile
return quality_changes.getId()
return ""
@pyqtProperty(str, notify=activeQualityChanged)

View File

@ -746,7 +746,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
if not extruder_stacks:
self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")
extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder"))
except:
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")