From 6d0da0d754a53c8070b78fb32b1dcf2791c5c3c6 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 4 Oct 2016 16:41:28 +0200 Subject: [PATCH 1/7] Revert "global_profile" reference changes while refixing import CURA-2518 and CURA-2478 --- cura/QualityManager.py | 3 --- cura/Settings/ContainerManager.py | 27 +++---------------------- cura/Settings/CuraContainerRegistry.py | 28 ++++++++++++-------------- cura/Settings/QualitySettingsModel.py | 2 +- 4 files changed, 17 insertions(+), 43 deletions(-) diff --git a/cura/QualityManager.py b/cura/QualityManager.py index fb3a623466..e84c83d1dd 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -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. diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 70575cf5e7..a917718e61 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -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 diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index f5b6568c4a..271d395307 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -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()) diff --git a/cura/Settings/QualitySettingsModel.py b/cura/Settings/QualitySettingsModel.py index d0ba7f4e11..09d6a3c821 100644 --- a/cura/Settings/QualitySettingsModel.py +++ b/cura/Settings/QualitySettingsModel.py @@ -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 From 2d41a992f152f09e40381a8d117a4f782355da6e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Oct 2016 11:40:27 +0200 Subject: [PATCH 2/7] Remove splitting profiles for each material The material is no longer listed in the profiles and no longer filtered for, so we don't need to create a new profile for each material. Contributes to issues CURA-844 and CURA-2320. --- .../VersionUpgrade21to22/MachineInstance.py | 7 ++-- .../VersionUpgrade21to22/Profile.py | 36 +++---------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py b/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py index 222af84d3a..2053b8acf9 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py @@ -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 + 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) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index e87432663d..d7d20db071 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -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 \ No newline at end of file + output = io.StringIO() + config.write(output) + return [self._filename], [output.getvalue()] \ No newline at end of file From 1fe574b3516a1bd872880ee805783d9c960a2312 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 6 Oct 2016 11:49:50 +0200 Subject: [PATCH 3/7] Details of profile changes now shows changes in all stacks. CURA-2558 --- cura/Settings/MachineManager.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 7bcf155e06..6d38d9968b 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -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", From 8644fb7113fc860cfefb271a2a30e5d3b3271aa3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Oct 2016 11:54:00 +0200 Subject: [PATCH 4/7] Never animate progress bars if they are invisible This is now the responsibility of the theme rather than the interface element, since the theme defines the animation itself. This makes it that the interface element doesn't need to worry about things like its style or animation. Contributes to issue CURA-2497. --- resources/qml/MonitorButton.qml | 4 ---- resources/themes/cura/styles.qml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 8bd593dd11..607d0a24ca 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -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": diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 8c419fb245..cc6bdfed77 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -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;} From edd06f860a546856eb27430211d85e78d6a2477d Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 6 Oct 2016 12:10:44 +0200 Subject: [PATCH 5/7] JSON fix: retractions speed warnings and raft margin warning based on likely possible testing values (CURA-905) --- resources/definitions/fdmprinter.def.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index a08b4948fe..9ab7a622b1 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -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, From e63b57241755e48f5b0f6da30a2c971a0363b6d4 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 6 Oct 2016 12:13:47 +0200 Subject: [PATCH 6/7] JSON fix: fixed raft warnings flawed logic (CURA-905) For layer_0_z_overlap we are only sure to overextrude when the overlap is more than the airgap. Layer height warnings are now based on line widths for raft, because the line widths are way larger than the nozzle size. --- resources/definitions/fdmprinter.def.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 9ab7a622b1..cf9ff8822e 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2896,7 +2896,7 @@ "default_value": 0.22, "value": "raft_airgap / 2", "minimum_value": "0", - "maximum_value_warning": "layer_height", + "maximum_value_warning": "airgap", "enabled": "resolveOrValue('adhesion_type') == 'raft'", "settable_per_mesh": false, "settable_per_extruder": true, @@ -2973,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, @@ -3021,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, From 7e8ce98f4852199fd45e3a6ae47f651842dff59a Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 6 Oct 2016 12:15:57 +0200 Subject: [PATCH 7/7] JSON fix: typo (CURA-905) --- resources/definitions/fdmprinter.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index cf9ff8822e..1300ef6348 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2896,7 +2896,7 @@ "default_value": 0.22, "value": "raft_airgap / 2", "minimum_value": "0", - "maximum_value_warning": "airgap", + "maximum_value_warning": "raft_airgap", "enabled": "resolveOrValue('adhesion_type') == 'raft'", "settable_per_mesh": false, "settable_per_extruder": true,