mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
39623ba2b8
10 changed files with 51 additions and 99 deletions
|
@ -44,9 +44,6 @@ class QualityManager:
|
|||
criteria = {"type": "quality_changes", "name": quality_changes_name}
|
||||
result = self._getFilteredContainersForStack(machine_definition, [], **criteria)
|
||||
|
||||
criteria = {"type": "quality_changes", "global_profile": quality_changes_name}
|
||||
result.extend(self._getFilteredContainersForStack(machine_definition, [], **criteria))
|
||||
|
||||
return result
|
||||
|
||||
## Fetch the list of available quality types for this combination of machine definition and materials.
|
||||
|
|
|
@ -467,8 +467,6 @@ class ContainerManager(QObject):
|
|||
base_name = active_quality_name
|
||||
unique_name = self._container_registry.uniqueName(base_name)
|
||||
|
||||
global_changes = None
|
||||
|
||||
# Go through the active stacks and create quality_changes containers from the user containers.
|
||||
for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
|
||||
user_container = stack.getTop()
|
||||
|
@ -484,11 +482,6 @@ class ContainerManager(QObject):
|
|||
extruder_id)
|
||||
self._performMerge(new_changes, user_container)
|
||||
|
||||
if stack is global_stack:
|
||||
global_changes = new_changes
|
||||
else:
|
||||
new_changes.setMetaDataEntry("global_profile", global_changes.getId())
|
||||
|
||||
self._container_registry.addContainer(new_changes)
|
||||
stack.replaceContainer(stack.getContainerIndex(quality_changes_container), new_changes)
|
||||
|
||||
|
@ -570,16 +563,10 @@ class ContainerManager(QObject):
|
|||
container_registry = self._container_registry
|
||||
|
||||
containers_to_rename = self._container_registry.findInstanceContainers(type = "quality_changes", name = quality_name)
|
||||
containers_to_rename.extend(self._container_registry.findInstanceContainers(type = "quality_changes", global_profile = quality_name))
|
||||
|
||||
global_changes_id = ""
|
||||
for container in containers_to_rename:
|
||||
stack_id = container.getMetaDataEntry("extruder", global_stack.getId())
|
||||
container_registry.renameContainer(container.getId(), new_name, self._createUniqueId(stack_id, new_name))
|
||||
if "global_profile" not in container.getMetaData():
|
||||
global_changes_id = container.getId()
|
||||
else:
|
||||
container.setMetaDataEntry("global_profile", global_changes_id)
|
||||
|
||||
if not containers_to_rename:
|
||||
UM.Logger.log("e", "Unable to rename %s, because we could not find the profile", quality_name)
|
||||
|
@ -649,10 +636,9 @@ class ContainerManager(QObject):
|
|||
# Handle the extruders if present.
|
||||
extruders = machine_definition.getMetaDataEntry("machine_extruder_trains")
|
||||
if extruders:
|
||||
for key in extruders:
|
||||
value = extruders[key]
|
||||
new_changes = self._createQualityChanges(quality_container, new_name, machine_definition, value)
|
||||
new_changes.addMetaDataEntry("global_profile", global_changes.getId())
|
||||
for extruder_id in extruders:
|
||||
extruder = extruders[extruder_id]
|
||||
new_changes = self._createQualityChanges(quality_container, new_name, machine_definition, extruder)
|
||||
new_change_instances.append(new_changes)
|
||||
self._container_registry.addContainer(new_changes)
|
||||
|
||||
|
@ -661,19 +647,12 @@ class ContainerManager(QObject):
|
|||
# Duplicate a quality changes container
|
||||
def _duplicateQualityChangesForMachineType(self, quality_changes_name, base_name, machine_definition):
|
||||
new_change_instances = []
|
||||
profile_index = -1
|
||||
global_changes_id = ""
|
||||
for container in QualityManager.getInstance().findQualityChangesByName(quality_changes_name,
|
||||
machine_definition):
|
||||
new_unique_id = self._createUniqueId(container.getId(), base_name)
|
||||
new_container = container.duplicate(new_unique_id, base_name)
|
||||
if profile_index >= 0:
|
||||
new_container.setMetaDataEntry("global_profile", global_changes_id)
|
||||
else:
|
||||
global_changes_id = new_unique_id
|
||||
new_change_instances.append(new_container)
|
||||
self._container_registry.addContainer(new_container)
|
||||
profile_index += 1
|
||||
|
||||
return new_change_instances
|
||||
|
||||
|
|
|
@ -161,21 +161,19 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
profile_index = -1
|
||||
global_profile = None
|
||||
|
||||
new_name = self.uniqueName(name_seed)
|
||||
|
||||
for profile in profile_or_list:
|
||||
if profile_index >= 0:
|
||||
if len(machine_extruders) > profile_index:
|
||||
extruder_id = machine_extruders[profile_index].getBottom().getId()
|
||||
profile_name = "%s_%s" % (extruder_id, name_seed)
|
||||
# Ensure the extruder profiles get non-conflicting names
|
||||
# NB: these are not user-facing
|
||||
if "extruder" in profile.getMetaData():
|
||||
profile.setMetaDataEntry("extruder", extruder_id)
|
||||
else:
|
||||
profile.addMetaDataEntry("extruder", extruder_id)
|
||||
if "global_profile" in profile.getMetaData():
|
||||
profile.setMetaDataEntry("global_profile", global_profile.getId())
|
||||
else:
|
||||
profile.addMetaDataEntry("global_profile", global_profile.getId())
|
||||
profile_id = (extruder_id + "_" + name_seed).lower().replace(" ", "_")
|
||||
elif profile_index == 0:
|
||||
# Importing a multiextrusion profile into a single extrusion machine; merge 1st extruder profile into global profile
|
||||
profile._id = self.uniqueName("temporary_profile")
|
||||
|
@ -188,16 +186,9 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
break
|
||||
else:
|
||||
global_profile = profile
|
||||
profile_name = name_seed
|
||||
new_name = self.uniqueName(profile_name)
|
||||
profile_id = (global_container_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_")
|
||||
|
||||
profile.setDirty(True) # Ensure the profiles are correctly saved
|
||||
if "type" in profile.getMetaData():
|
||||
profile.setMetaDataEntry("type", "quality_changes")
|
||||
else:
|
||||
profile.addMetaDataEntry("type", "quality_changes")
|
||||
self._configureProfile(profile, profile_name)
|
||||
profile.setName(new_name)
|
||||
self._configureProfile(profile, profile_id, new_name)
|
||||
|
||||
profile_index += 1
|
||||
|
||||
|
@ -206,11 +197,18 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
# If it hasn't returned by now, none of the plugins loaded the profile successfully.
|
||||
return {"status": "error", "message": catalog.i18nc("@info:status", "Profile {0} has an unknown file type.", file_name)}
|
||||
|
||||
def _configureProfile(self, profile, id_seed):
|
||||
def _configureProfile(self, profile, id_seed, new_name):
|
||||
profile.setReadOnly(False)
|
||||
profile.setDirty(True) # Ensure the profiles are correctly saved
|
||||
|
||||
new_id = self.createUniqueName("quality_changes", "", id_seed, catalog.i18nc("@label", "Custom profile"))
|
||||
profile._id = new_id
|
||||
profile.setName(new_name)
|
||||
|
||||
if "type" in profile.getMetaData():
|
||||
profile.setMetaDataEntry("type", "quality_changes")
|
||||
else:
|
||||
profile.addMetaDataEntry("type", "quality_changes")
|
||||
|
||||
if self._machineHasOwnQualities():
|
||||
profile.setDefinition(self._activeQualityDefinition())
|
||||
|
|
|
@ -745,10 +745,20 @@ class MachineManager(QObject):
|
|||
def _askUserToKeepOrClearCurrentSettings(self):
|
||||
# Ask the user if the user profile should be cleared or not (discarding the current settings)
|
||||
# In Simple Mode we assume the user always wants to keep the (limited) current settings
|
||||
details = catalog.i18nc("@label", "You made changes to the following setting(s):")
|
||||
user_settings = self._active_container_stack.getTop().findInstances(**{})
|
||||
for setting in user_settings:
|
||||
details = details + "\n " + setting.definition.label
|
||||
details_text = catalog.i18nc("@label", "You made changes to the following setting(s):")
|
||||
|
||||
# user changes in global stack
|
||||
details_list = [setting.definition.label for setting in self._global_container_stack.getTop().findInstances(**{})]
|
||||
|
||||
# user changes in extruder stacks
|
||||
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
for stack in stacks:
|
||||
details_list.extend([
|
||||
"%s (%s)" % (setting.definition.label, stack.getName())
|
||||
for setting in stack.getTop().findInstances(**{})])
|
||||
|
||||
# Format to output string
|
||||
details = "\n ".join([details_text, ] + details_list)
|
||||
|
||||
Application.getInstance().messageBox(catalog.i18nc("@window:title", "Switched profiles"),
|
||||
catalog.i18nc("@label",
|
||||
|
|
|
@ -154,7 +154,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
|||
criteria = {"type": "quality_changes", "quality_type": quality_type, "definition": definition_id, "name": quality_changes_container.getName()}
|
||||
if self._extruder_definition_id != "":
|
||||
criteria["extruder"] = self._extruder_definition_id
|
||||
criteria["name"] = "%s_%s" % (self._extruder_definition_id, quality_changes_container.getName())
|
||||
criteria["name"] = quality_changes_container.getName()
|
||||
else:
|
||||
criteria["extruder"] = None
|
||||
|
||||
|
|
|
@ -88,13 +88,10 @@ class MachineInstance:
|
|||
active_quality_changes = "empty_quality_changes"
|
||||
else:
|
||||
active_quality = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.getQualityFallback(type_name, variant, active_material)
|
||||
if has_machine_qualities: #Then the profile will have split into multiple.
|
||||
active_quality_changes = self._active_profile_name + "_" + active_material + "_" + variant
|
||||
else:
|
||||
active_quality_changes = self._active_profile_name
|
||||
|
||||
if has_machine_qualities: #This machine now has machine-quality profiles.
|
||||
active_material += "_" + variant_materials #That means that the profile was split into multiple.
|
||||
active_material += "_" + variant_materials
|
||||
|
||||
#Create a new user profile and schedule it to be upgraded.
|
||||
user_profile = configparser.ConfigParser(interpolation = None)
|
||||
|
|
|
@ -49,7 +49,7 @@ class Profile:
|
|||
self._machine_type_id = parser.get("general", "machine_type", fallback = None)
|
||||
self._machine_variant_name = parser.get("general", "machine_variant", fallback = None)
|
||||
self._machine_instance_name = parser.get("general", "machine_instance", fallback = None)
|
||||
if "material" in parser["general"]:
|
||||
if "material" in parser["general"]: #Note: Material name is unused in this upgrade.
|
||||
self._material_name = parser.get("general", "material")
|
||||
elif self._type == "material":
|
||||
self._material_name = parser.get("general", "name", fallback = None)
|
||||
|
@ -124,34 +124,6 @@ class Profile:
|
|||
for item in disabled_settings_defaults[1:]:
|
||||
disabled_defaults_string += "," + str(item)
|
||||
|
||||
#Material metadata may cause the file to split, so do it last to minimise processing time (do more with the copy).
|
||||
filenames = []
|
||||
configs = []
|
||||
if self._material_name and self._type != "material":
|
||||
config.set("metadata", "material", self._material_name)
|
||||
filenames.append(self._filename)
|
||||
configs.append(config)
|
||||
elif self._type != "material" and self._machine_type_id in VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.machinesWithMachineQuality():
|
||||
#Split this profile into multiple profiles, one for each material.
|
||||
_new_materials = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.machinesWithMachineQuality()[self._machine_type_id]["materials"]
|
||||
_new_variants = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.machinesWithMachineQuality()[self._machine_type_id]["variants"]
|
||||
translated_machine = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translatePrinter(self._machine_type_id)
|
||||
for material_id in _new_materials:
|
||||
for variant_id in _new_variants:
|
||||
variant_id_new = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateVariant(variant_id, translated_machine)
|
||||
filenames.append("{profile}_{material}_{variant}".format(profile = self._filename, material = material_id, variant = variant_id_new))
|
||||
config_copy = configparser.ConfigParser(interpolation = None)
|
||||
config_copy.read_dict(config) #Copy the config to a new ConfigParser instance.
|
||||
variant_id_new_materials = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateVariantForMaterials(variant_id, translated_machine)
|
||||
config_copy.set("metadata", "material", "{material}_{variant}".format(material = material_id, variant = variant_id_new_materials))
|
||||
configs.append(config_copy)
|
||||
else:
|
||||
configs.append(config)
|
||||
filenames.append(self._filename)
|
||||
|
||||
outputs = []
|
||||
for config in configs:
|
||||
output = io.StringIO()
|
||||
config.write(output)
|
||||
outputs.append(output.getvalue())
|
||||
return filenames, outputs
|
||||
return [self._filename], [output.getvalue()]
|
|
@ -1211,7 +1211,7 @@
|
|||
"minimum_value": "0",
|
||||
"minimum_value_warning": "1",
|
||||
"maximum_value": "machine_max_feedrate_e",
|
||||
"maximum_value_warning": "25",
|
||||
"maximum_value_warning": "70",
|
||||
"enabled": "retraction_enable",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true,
|
||||
|
@ -1225,7 +1225,7 @@
|
|||
"minimum_value": "0",
|
||||
"maximum_value": "machine_max_feedrate_e",
|
||||
"minimum_value_warning": "1",
|
||||
"maximum_value_warning": "25",
|
||||
"maximum_value_warning": "70",
|
||||
"enabled": "retraction_enable",
|
||||
"value": "retraction_speed",
|
||||
"settable_per_mesh": false,
|
||||
|
@ -1240,7 +1240,7 @@
|
|||
"minimum_value": "0",
|
||||
"maximum_value": "machine_max_feedrate_e",
|
||||
"minimum_value_warning": "1",
|
||||
"maximum_value_warning": "25",
|
||||
"maximum_value_warning": "70",
|
||||
"enabled": "retraction_enable",
|
||||
"value": "retraction_speed",
|
||||
"settable_per_mesh": false,
|
||||
|
@ -1363,7 +1363,8 @@
|
|||
"enabled": "retraction_enable",
|
||||
"default_value": 20,
|
||||
"minimum_value": "0.1",
|
||||
"maximum_value_warning": "25",
|
||||
"minimum_value_warning": "1",
|
||||
"maximum_value_warning": "70",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true,
|
||||
"children":
|
||||
|
@ -1378,7 +1379,8 @@
|
|||
"default_value": 20,
|
||||
"value": "switch_extruder_retraction_speeds",
|
||||
"minimum_value": "0.1",
|
||||
"maximum_value_warning": "25",
|
||||
"minimum_value_warning": "1",
|
||||
"maximum_value_warning": "70",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true
|
||||
},
|
||||
|
@ -1392,7 +1394,8 @@
|
|||
"default_value": 20,
|
||||
"value": "switch_extruder_retraction_speeds",
|
||||
"minimum_value": "0.1",
|
||||
"maximum_value_warning": "25",
|
||||
"minimum_value_warning": "1",
|
||||
"maximum_value_warning": "70",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true
|
||||
}
|
||||
|
@ -2865,7 +2868,7 @@
|
|||
"type": "float",
|
||||
"default_value": 15,
|
||||
"minimum_value_warning": "raft_interface_line_width",
|
||||
"maximum_value_warning": "10",
|
||||
"maximum_value_warning": "20",
|
||||
"enabled": "resolveOrValue('adhesion_type') == 'raft'",
|
||||
"limit_to_extruder": "adhesion_extruder_nr",
|
||||
"settable_per_mesh": false,
|
||||
|
@ -2893,7 +2896,7 @@
|
|||
"default_value": 0.22,
|
||||
"value": "raft_airgap / 2",
|
||||
"minimum_value": "0",
|
||||
"maximum_value_warning": "layer_height",
|
||||
"maximum_value_warning": "raft_airgap",
|
||||
"enabled": "resolveOrValue('adhesion_type') == 'raft'",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true,
|
||||
|
@ -2970,7 +2973,7 @@
|
|||
"value": "layer_height * 1.5",
|
||||
"minimum_value": "0.001",
|
||||
"minimum_value_warning": "0.04",
|
||||
"maximum_value_warning": "0.75 * extruderValue(adhesion_extruder_nr, 'machine_nozzle_size')",
|
||||
"maximum_value_warning": "0.75 * extruderValue(adhesion_extruder_nr, 'raft_interface_line_width')",
|
||||
"enabled": "resolveOrValue('adhesion_type') == 'raft'",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true,
|
||||
|
@ -3018,7 +3021,7 @@
|
|||
"value": "resolveOrValue('layer_height_0') * 1.2",
|
||||
"minimum_value": "0.001",
|
||||
"minimum_value_warning": "0.04",
|
||||
"maximum_value_warning": "0.75 * extruderValue(adhesion_extruder_nr, 'machine_nozzle_size')",
|
||||
"maximum_value_warning": "0.75 * extruderValue(adhesion_extruder_nr, 'raft_base_line_width')",
|
||||
"enabled": "resolveOrValue('adhesion_type') == 'raft'",
|
||||
"settable_per_mesh": false,
|
||||
"settable_per_extruder": true,
|
||||
|
|
|
@ -161,10 +161,6 @@ Rectangle
|
|||
visible: showProgress;
|
||||
indeterminate:
|
||||
{
|
||||
if(!showProgress)
|
||||
{
|
||||
return false; //Never be indeterminate when not visible, since that triggers a redraw of the screen.
|
||||
}
|
||||
switch(Cura.MachineManager.printerOutputDevices[0].jobState)
|
||||
{
|
||||
case "pausing":
|
||||
|
|
|
@ -237,7 +237,7 @@ QtObject {
|
|||
SequentialAnimation on x {
|
||||
id: xAnim
|
||||
property int animEndPoint: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) - Theme.getSize("progressbar_control").width
|
||||
running: control.indeterminate
|
||||
running: control.indeterminate && control.visible
|
||||
loops: Animation.Infinite
|
||||
NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;}
|
||||
NumberAnimation { from: xAnim.animEndPoint; to: 0; duration: 2000;}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue