mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Merge branch '3.1' of github.com:Ultimaker/Cura into 3.1
This commit is contained in:
commit
ea7ff05a3d
2 changed files with 29 additions and 9 deletions
|
@ -238,12 +238,6 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
if profile_index == 0:
|
if profile_index == 0:
|
||||||
# This is assumed to be the global profile
|
# This is assumed to be the global profile
|
||||||
profile_id = (global_container_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_")
|
profile_id = (global_container_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_")
|
||||||
result = self._configureProfile(profile, profile_id, new_name)
|
|
||||||
if result is not None:
|
|
||||||
return {"status": "error", "message": catalog.i18nc(
|
|
||||||
"@info:status Don't translate the XML tags <filename> or <message>!",
|
|
||||||
"Failed to import profile from <filename>{0}</filename>: <message>{1}</message>",
|
|
||||||
file_name, result)}
|
|
||||||
|
|
||||||
elif len(machine_extruders) > profile_index:
|
elif len(machine_extruders) > profile_index:
|
||||||
# This is assumed to be an extruder profile
|
# This is assumed to be an extruder profile
|
||||||
|
@ -252,6 +246,14 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
profile.addMetaDataEntry("extruder", extruder_id)
|
profile.addMetaDataEntry("extruder", extruder_id)
|
||||||
else:
|
else:
|
||||||
profile.setMetaDataEntry("extruder", extruder_id)
|
profile.setMetaDataEntry("extruder", extruder_id)
|
||||||
|
profile_id = (extruder_id + "_" + name_seed).lower().replace(" ", "_")
|
||||||
|
|
||||||
|
result = self._configureProfile(profile, profile_id, new_name)
|
||||||
|
if result is not None:
|
||||||
|
return {"status": "error", "message": catalog.i18nc(
|
||||||
|
"@info:status Don't translate the XML tags <filename> or <message>!",
|
||||||
|
"Failed to import profile from <filename>{0}</filename>: <message>{1}</message>",
|
||||||
|
file_name, result)}
|
||||||
|
|
||||||
return {"status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile_or_list[0].getName())}
|
return {"status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile_or_list[0].getName())}
|
||||||
|
|
||||||
|
|
|
@ -733,6 +733,9 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
old_material = self._active_container_stack.material
|
old_material = self._active_container_stack.material
|
||||||
old_quality = self._active_container_stack.quality
|
old_quality = self._active_container_stack.quality
|
||||||
|
old_quality_type = None
|
||||||
|
if old_quality and old_quality.getId() != self._empty_quality_container.getId():
|
||||||
|
old_quality_type = old_quality.getMetaDataEntry("quality_type")
|
||||||
old_quality_changes = self._active_container_stack.qualityChanges
|
old_quality_changes = self._active_container_stack.qualityChanges
|
||||||
if not old_material:
|
if not old_material:
|
||||||
Logger.log("w", "While trying to set the active material, no material was found to replace it.")
|
Logger.log("w", "While trying to set the active material, no material was found to replace it.")
|
||||||
|
@ -773,13 +776,28 @@ class MachineManager(QObject):
|
||||||
quality_manager.getWholeMachineDefinition(global_stack.definition),
|
quality_manager.getWholeMachineDefinition(global_stack.definition),
|
||||||
[material_container])
|
[material_container])
|
||||||
|
|
||||||
if not candidate_quality or isinstance(candidate_quality, type(self._empty_quality_changes_container)):
|
if not candidate_quality or candidate_quality.getId() == self._empty_quality_changes_container:
|
||||||
Logger.log("d", "Attempting to find fallback quality")
|
Logger.log("d", "Attempting to find fallback quality")
|
||||||
# Fall back to a quality (which must be compatible with all other extruders)
|
# Fall back to a quality (which must be compatible with all other extruders)
|
||||||
new_qualities = quality_manager.findAllUsableQualitiesForMachineAndExtruders(
|
new_qualities = quality_manager.findAllUsableQualitiesForMachineAndExtruders(
|
||||||
self._global_container_stack, ExtruderManager.getInstance().getExtruderStacks())
|
self._global_container_stack, ExtruderManager.getInstance().getExtruderStacks())
|
||||||
if new_qualities:
|
|
||||||
new_quality_id = new_qualities[0].getId() # Just pick the first available one
|
quality_types = sorted([q.getMetaDataEntry("quality_type") for q in new_qualities], reverse = True)
|
||||||
|
quality_type_to_use = None
|
||||||
|
if quality_types:
|
||||||
|
# try to use the same quality as before, otherwise the first one in the quality_types
|
||||||
|
quality_type_to_use = quality_types[0]
|
||||||
|
if old_quality_type is not None and old_quality_type in quality_type_to_use:
|
||||||
|
quality_type_to_use = old_quality_type
|
||||||
|
|
||||||
|
new_quality = None
|
||||||
|
for q in new_qualities:
|
||||||
|
if quality_type_to_use is not None and q.getMetaDataEntry("quality_type") == quality_type_to_use:
|
||||||
|
new_quality = q
|
||||||
|
break
|
||||||
|
|
||||||
|
if new_quality is not None:
|
||||||
|
new_quality_id = new_quality.getId() # Just pick the first available one
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "No quality profile found that matches the current machine and extruders.")
|
Logger.log("w", "No quality profile found that matches the current machine and extruders.")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue