From 9c7a28fa2dbd842086c4180333e3ae3785849260 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 9 Aug 2016 17:01:11 +0200 Subject: [PATCH] Don't break if current settings machine is unknown Currently it sets the user profile to 'empty', which is bad because empty is read-only. But it allows me to continue for now. I'll find a solution for that later. Contributes to issue CURA-844. --- .../VersionUpgrade/VersionUpgrade21to22/MachineInstance.py | 6 +++++- plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py b/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py index 03c5a9f6b2..90f3776f52 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py @@ -79,9 +79,13 @@ class MachineInstance: if self._type_name in VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.machinesWithMachineQuality(): #This machine now has machine-quality profiles. active_profile += "_" + active_material #That means that the profile was split into multiple. variant = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateVariant(self._variant_name, type_name) + if self._type_name in VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.machinesWithMachineQuality(): #The current settings profile is now machine-specific. + current_settings = "empty" #The profile didn't know the definition ID when it was upgraded, so it will have been invalid. Sorry, your current settings are lost now. + else: + current_settings = self._name + "_current_settings" containers = [ - self._name + "_current_settings", + current_settings, active_profile, active_material, variant, diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index 75e0f158e5..b44b36f099 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -99,7 +99,7 @@ class Profile: translated_machine = VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translatePrinter(self._machine_type_id) config.set("general", "definition", translated_machine) else: - config.set("general", "definition", "fdmprinter") + config.set("general", "definition", "fdmprinter") #In this case, the machine definition is unknown, and it might now have machine-specific profiles, in which case this will fail. config.add_section("metadata") if self._type: