mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 00:37:50 -06:00
Fix copying ConfigParser
Turns out that copy.copy() doesn't work on ConfigParsers. It returns a different instance but modifying that instance still modifies the old configs. Deep copy isn't allowed. But this dictionary copy works. Contributes to issue CURA-844.
This commit is contained in:
parent
71505a8b35
commit
36b027b290
1 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,6 @@
|
|||
# Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import configparser #To read config files.
|
||||
import copy #To split config files into multiple config files.
|
||||
import io #To write config files to strings as if they were files.
|
||||
|
||||
import UM.VersionUpgrade
|
||||
|
@ -146,7 +145,8 @@ class Profile:
|
|||
#Split this profile into multiple profiles, one for each material.
|
||||
for material_id in _new_materials:
|
||||
filenames.append("{profile}_{material}".format(profile = self._filename, material = material_id))
|
||||
config_copy = copy.copy(config)
|
||||
config_copy = configparser.ConfigParser(interpolation = None)
|
||||
config_copy.read_dict(config) #Copy the config to a new ConfigParser instance.
|
||||
config_copy.set("metadata", "material", material_id)
|
||||
configs.append(config_copy)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue