mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Fix VersionUpgrade to handle both formats of ContainerStack files
Contributes to CURA-3098
This commit is contained in:
parent
ab16722047
commit
c212014d88
1 changed files with 15 additions and 3 deletions
|
@ -19,8 +19,14 @@ class VersionUpgrade22to24(VersionUpgrade):
|
|||
config = configparser.ConfigParser(interpolation = None)
|
||||
config.read_string(serialised) # Read the input string as config file.
|
||||
config.set("general", "version", "3")
|
||||
containers = config.get("general", "containers")
|
||||
container_list = containers.split(",")
|
||||
|
||||
container_list = []
|
||||
if config.has_section("containers"):
|
||||
for index, container_id in config.items("containers"):
|
||||
container_list.append(container_id)
|
||||
elif config.has_option("general", "containers")
|
||||
containers = config.get("general", "containers")
|
||||
container_list = containers.split(",")
|
||||
|
||||
user_variants = self.__getUserVariants()
|
||||
name_path_dict = {}
|
||||
|
@ -45,7 +51,13 @@ class VersionUpgrade22to24(VersionUpgrade):
|
|||
|
||||
container_list = new_container_list
|
||||
|
||||
config.set("general", "containers", ",".join(container_list))
|
||||
if not config.has_section("containers"):
|
||||
config.add_section("containers")
|
||||
|
||||
config.remove_option("general", "containers")
|
||||
|
||||
for index in range(len(container_list)):
|
||||
config.set("containers", index, container_list[index])
|
||||
|
||||
output = io.StringIO()
|
||||
config.write(output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue