From 2d41a992f152f09e40381a8d117a4f782355da6e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Oct 2016 11:40:27 +0200 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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;}