Browse Source

Use preferences upgrader

Instead of the placeholder.

Contributes to issue CURA-844.
Ghostkeeper 8 years ago
parent
commit
51aa82bd6c

+ 8 - 4
plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py

@@ -6,6 +6,7 @@ import configparser #To get version numbers from config files.
 from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
 
 from . import MachineInstance # To upgrade machine instances.
+from . import Preferences #To upgrade preferences.
 from . import Profile # To upgrade profiles.
 
 ##  Converts configuration from Cura 2.1's file formats to Cura 2.2's.
@@ -35,13 +36,16 @@ class VersionUpgrade21to22(VersionUpgrade):
             return None
         return machine_instance.export()
 
-    ##  Converts preferences from format version 1 to version 2.
+    ##  Converts preferences from format version 2 to version 3.
     #
-    #   \param serialised The serialised preferences file in version 1.
-    #   \return The serialised preferences in version 2, or None if the input
+    #   \param serialised The serialised preferences file in version 2.
+    #   \return The serialised preferences in version 3, or None if the input
     #   was not of the correct format.
     def upgradePreferences(self, serialised):
-        return serialised #TODO
+        preferences = Preferences.importFrom(serialised)
+        if not preferences: #Invalid file format.
+            return None
+        return preferences.export()
 
     ##  Converts profiles from format version 1 to version 2.
     #