Merge branch '3.1'

This commit is contained in:
Ghostkeeper 2017-11-30 16:57:01 +01:00
commit 96c38bce2b
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
38 changed files with 1791 additions and 2016 deletions

View file

@ -449,6 +449,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
extruder_stacks = []
extruder_stacks_added = []
container_stacks_added = []
machine_extruder_count = None
containers_added = []
@ -636,6 +637,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# The ID already exists, but nothing in the values changed, so do nothing.
pass
quality_and_definition_changes_instance_containers.append(instance_container)
if container_type == "definition_changes":
definition_changes_extruder_count = instance_container.getProperty("machine_extruder_count", "value")
if definition_changes_extruder_count is not None:
machine_extruder_count = definition_changes_extruder_count
else:
existing_container = self._container_registry.findInstanceContainers(id = container_id)
if not existing_container:
@ -794,8 +801,14 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if stack.quality.getId() in ("empty", "empty_quality"):
has_not_supported = True
break
# We filter out extruder stacks that are not actually used, for example the UM3 and custom FDM printer extruder count setting.
extruder_stacks_in_use = extruder_stacks
if machine_extruder_count is not None:
extruder_stacks_in_use = extruder_stacks[:machine_extruder_count]
available_quality = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_stack,
extruder_stacks)
extruder_stacks_in_use)
if not has_not_supported:
has_not_supported = not available_quality
@ -803,10 +816,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if has_not_supported:
empty_quality_container = self._container_registry.findInstanceContainers(id = "empty_quality")[0]
for stack in [global_stack] + extruder_stacks:
for stack in [global_stack] + extruder_stacks_in_use:
stack.replaceContainer(_ContainerIndexes.Quality, empty_quality_container)
empty_quality_changes_container = self._container_registry.findInstanceContainers(id = "empty_quality_changes")[0]
for stack in [global_stack] + extruder_stacks:
for stack in [global_stack] + extruder_stacks_in_use:
stack.replaceContainer(_ContainerIndexes.QualityChanges, empty_quality_changes_container)
quality_has_been_changed = True
@ -839,7 +852,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
global_stack.quality = containers[0]
global_stack.qualityChanges = empty_quality_changes_container
# also find the quality containers for the extruders
for extruder_stack in extruder_stacks:
for extruder_stack in extruder_stacks_in_use:
search_criteria = {"id": preferred_quality_id,
"type": "quality",
"definition": definition_id}
@ -868,8 +881,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if len(extruder_stacks) == 1:
extruder_stack = extruder_stacks[0]
search_criteria = {"type": "quality",
"quality_type": global_stack.quality.getMetaDataEntry("quality_type")}
search_criteria = {"type": "quality", "quality_type": global_stack.quality.getMetaDataEntry("quality_type")}
search_criteria["definition"] = global_stack.definition.getId()
if not parseBool(global_stack.getMetaDataEntry("has_machine_quality", "False")):
search_criteria["definition"] = "fdmprinter"

View file

@ -188,29 +188,32 @@ class MachineSettingsAction(MachineAction):
# In other words: only continue for the UM2 (extended), but not for the UM2+
return
stacks = ExtruderManager.getInstance().getExtruderStacks()
has_materials = self._global_container_stack.getProperty("machine_gcode_flavor", "value") != "UltiGCode"
material_container = self._global_container_stack.material
if has_materials:
if "has_materials" in self._global_container_stack.getMetaData():
self._global_container_stack.setMetaDataEntry("has_materials", True)
else:
self._global_container_stack.addMetaDataEntry("has_materials", True)
# Set the material container to a sane default
if material_container == self._empty_container:
search_criteria = { "type": "material", "definition": "fdmprinter", "id": self._global_container_stack.getMetaDataEntry("preferred_material")}
materials = self._container_registry.findInstanceContainers(**search_criteria)
if materials:
self._global_container_stack.material = materials[0]
# Set the material container for each extruder to a sane default
for stack in stacks:
material_container = stack.material
if material_container == self._empty_container:
machine_approximate_diameter = str(round(self._global_container_stack.getProperty("material_diameter", "value")))
search_criteria = { "type": "material", "definition": "fdmprinter", "id": self._global_container_stack.getMetaDataEntry("preferred_material"), "approximate_diameter": machine_approximate_diameter}
materials = self._container_registry.findInstanceContainers(**search_criteria)
if materials:
stack.material = materials[0]
else:
# The metadata entry is stored in an ini, and ini files are parsed as strings only.
# Because any non-empty string evaluates to a boolean True, we have to remove the entry to make it False.
if "has_materials" in self._global_container_stack.getMetaData():
self._global_container_stack.removeMetaDataEntry("has_materials")
self._global_container_stack.material = ContainerRegistry.getInstance().getEmptyInstanceContainer()
for stack in stacks:
stack.material = ContainerRegistry.getInstance().getEmptyInstanceContainer()
Application.getInstance().globalContainerStackChanged.emit()

View file

@ -43,7 +43,7 @@ UM.Dialog
anchors.right: parent.right
text: catalog.i18nc("@action:button", "I understand and agree")
onClicked: {
manager.didAgree(true)
baseDialog.accepted()
}
}
@ -52,13 +52,12 @@ UM.Dialog
anchors.left: parent.left
text: catalog.i18nc("@action:button", "I don't agree")
onClicked: {
manager.didAgree(false)
baseDialog.rejected()
}
}
}
onClosing: {
manager.didAgree(false)
}
onAccepted: manager.didAgree(true)
onRejected: manager.didAgree(false)
onClosing: manager.didAgree(false)
}

View file

@ -203,6 +203,14 @@ class VersionUpgrade30to31(VersionUpgrade):
def _createExtruderQualityChangesForSingleExtrusionMachine(self, filename, global_quality_changes):
suffix = "_" + quote_plus(global_quality_changes["general"]["name"].lower())
machine_name = os.path.os.path.basename(filename).replace(".inst.cfg", "").replace(suffix, "")
# Why is this here?!
# When we load a .curaprofile file the deserialize will trigger a version upgrade, creating a dangling file.
# This file can be recognized by it's lack of a machine name in the target filename.
# So when we detect that situation here, we don't create the file and return.
if machine_name == "":
return
new_filename = machine_name + "_" + "fdmextruder" + suffix
extruder_quality_changes_parser = configparser.ConfigParser()