Revert "Merge branch '4.7' of github.com:Ultimaker/Cura into 4.7"

This reverts commit 7f47f12bf0, reversing
changes made to dd42c87da7.
This commit is contained in:
Ghostkeeper 2020-08-20 16:01:46 +02:00
parent 2fe9ee2cf2
commit 28f4d8513d
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
13 changed files with 149 additions and 274 deletions

View file

@ -133,10 +133,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# In Cura 2.5 and 2.6, the empty profiles used to have those long names
self._old_empty_profile_id_dict = {"empty_%s" % k: "empty" for k in ["material", "variant"]}
self._is_same_machine_type = False
self._old_new_materials = {} # type: Dict[str, str]
self._machine_info = None
def _clearState(self):
self._is_same_machine_type = False
self._id_mapping = {}
self._old_new_materials = {}
self._machine_info = None
@ -227,7 +229,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# Read definition containers
#
machine_definition_id = None
updatable_machines = []
machine_definition_container_count = 0
extruder_definition_container_count = 0
definition_container_files = [name for name in cura_file_names if name.endswith(self._definition_container_suffix)]
@ -244,9 +245,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
definition_container_type = definition_container.get("type")
if definition_container_type == "machine":
machine_definition_id = container_id
machine_definition_containers = self._container_registry.findDefinitionContainers(id = machine_definition_id)
if machine_definition_containers:
updatable_machines = [machine for machine in self._container_registry.findContainerStacks(type = "machine") if machine.definition == machine_definition_containers[0]]
machine_type = definition_container["name"]
variant_type_name = definition_container.get("variants_name", variant_type_name)
@ -388,8 +386,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
machine_definition_id = id_list[7]
stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine")
self._is_same_machine_type = True
existing_global_stack = None
global_stack = None
if stacks:
global_stack = stacks[0]
@ -402,9 +400,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if global_stack.getContainer(index).getId() != container_id:
machine_conflict = True
break
if updatable_machines and not containers_found_dict["machine"]:
containers_found_dict["machine"] = True
self._is_same_machine_type = global_stack.definition.getId() == machine_definition_id
# Get quality type
parser = ConfigParser(interpolation = None)
@ -489,7 +485,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if intent_id not in ("empty", "empty_intent"):
extruder_info.intent_info = instance_container_info_dict[intent_id]
if not machine_conflict and containers_found_dict["machine"] and global_stack:
if not machine_conflict and containers_found_dict["machine"]:
if int(position) >= len(global_stack.extruderList):
continue
@ -562,6 +558,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._machine_info.custom_quality_name = quality_name
self._machine_info.intent_category = intent_category
if machine_conflict and not self._is_same_machine_type:
machine_conflict = False
is_printer_group = False
if machine_conflict:
group_name = existing_global_stack.getMetaDataEntry("group_name")
@ -582,7 +581,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._dialog.setNumSettingsOverriddenByQualityChanges(num_settings_overridden_by_quality_changes)
self._dialog.setNumUserSettings(num_user_settings)
self._dialog.setActiveMode(active_mode)
self._dialog.setUpdatableMachines(updatable_machines)
self._dialog.setMachineName(machine_name)
self._dialog.setMaterialLabels(material_labels)
self._dialog.setMachineType(machine_type)
@ -663,8 +661,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
application.expandedCategoriesChanged.emit() # Notify the GUI of the change
# If there are no machines of the same type, create a new machine.
if self._resolve_strategies["machine"] != "override" or self._dialog.updatableMachinesModel.count <= 1:
# If a machine with the same name is of a different type, always create a new one.
if not self._is_same_machine_type or self._resolve_strategies["machine"] != "override":
# We need to create a new machine
machine_name = self._container_registry.uniqueName(self._machine_info.name)
@ -679,12 +677,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._container_registry.addContainer(global_stack)
else:
# Find the machine which will be overridden
global_stacks = self._container_registry.findContainerStacks(id = self._dialog.getMachineToOverride(), type = "machine")
# Find the machine
global_stacks = self._container_registry.findContainerStacks(name = self._machine_info.name, type = "machine")
if not global_stacks:
message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tag <filename>!",
"Project file <filename>{0}</filename> is made using profiles that"
" are unknown to this version of Ultimaker Cura.", file_name))
message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tag <filename>!", "Project file <filename>{0}</filename> is made using profiles that are unknown to this version of Ultimaker Cura.", file_name))
message.show()
self.setWorkspaceName("")
return [], {}