mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00

This plug-in does nothing at the moment. It merely says that it is able to upgrade configuration from version 2.1 to 2.2, but then raises exceptions when you actually try to use it. This is by design. I will now implement the functions that do the conversion. Contributes to issue CURA-844.
45 lines
No EOL
1.9 KiB
Python
45 lines
No EOL
1.9 KiB
Python
# Copyright (c) 2015 Ultimaker B.V.
|
|
# Cura is released under the terms of the AGPLv3 or higher.
|
|
|
|
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.
|
|
#
|
|
# It converts the machine instances, preferences and profiles.
|
|
class VersionUpgrade21to22(VersionUpgrade):
|
|
## Converts machine instances from format version 1 to version 2.
|
|
#
|
|
# \param serialised The serialised machine instance in version 1.
|
|
# \return The serialised machine instance in version 2, or None if the
|
|
# input was not of the correct format.
|
|
def upgradeMachineInstance(self, serialised):
|
|
machine_instance = MachineInstance.importVersion1(serialised)
|
|
if not machine_instance: #Invalid file format.
|
|
return None
|
|
return machine_instance.exportVersion2()
|
|
|
|
## Converts preferences from format version 2 to version 3.
|
|
#
|
|
# \param serialised The serialised preferences file in version 2.
|
|
# \return The serialised preferences file in version 3, or None if the
|
|
# input was not of the correct format.
|
|
def upgradePreferences(self, serialised):
|
|
preferences = Preferences.importVersion2(serialised)
|
|
if not preferences: #Invalid file format.
|
|
return None
|
|
return preferences.exportVersion3()
|
|
|
|
## Converts profiles from format version 1 to version 2.
|
|
#
|
|
# \param serialised The serialised profile in version 1.
|
|
# \return The serialised profile in version 2, or None if the input was
|
|
# not of the correct format.
|
|
def upgradeProfile(self, serialised):
|
|
profile = Profile.importVersion1(serialised)
|
|
if not profile: #Invalid file format.
|
|
return None
|
|
return profile.exportVersion2() |