diff options
author | Jaime van Kessel <nallath@gmail.com> | 2016-10-06 14:50:18 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2016-10-06 14:50:18 +0300 |
commit | 39623ba2b868763b44a455ed0c32b1d21be93fb9 (patch) | |
tree | 6ff5df66c102c4aaff8be64a4ed978cdc564c5da /plugins | |
parent | fb24e552680d557be223b53f7461a5fe91dbe414 (diff) | |
parent | 7e8ce98f4852199fd45e3a6ae47f651842dff59a (diff) |
Merge branch 'master' of github.com:Ultimaker/Cura
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py | 7 | ||||
-rw-r--r-- | plugins/VersionUpgrade/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 |