diff options
author | Simon Edwards <s.edwards@ultimaker.com> | 2016-12-14 13:37:29 +0300 |
---|---|---|
committer | Simon Edwards <s.edwards@ultimaker.com> | 2016-12-14 15:52:07 +0300 |
commit | 22012bdb1cb572a80e81489b2771056ef92f02be (patch) | |
tree | 8a9d3b473e819645438dea2bd81eec95cf4accbe /plugins/VersionUpgrade/VersionUpgrade22to24 | |
parent | f4fa3ac53f3bde4ce59b6ca4617abfaeb0ab0813 (diff) |
Show the Z seam related settings after upgrade. CURA-2953
Diffstat (limited to 'plugins/VersionUpgrade/VersionUpgrade22to24')
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py | 21 | ||||
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py | 6 |
2 files changed, 25 insertions, 2 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index b820306fe1..1dd6a504ee 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -8,6 +8,7 @@ import io from UM import Resources
from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
+import UM.VersionUpgrade
class VersionUpgrade22to24(VersionUpgrade):
@@ -120,6 +121,26 @@ class VersionUpgrade22to24(VersionUpgrade): config.write(output)
return [filename], [output.getvalue()]
+ def upgradePreferences(self, serialised, filename):
+ config = configparser.ConfigParser(interpolation = None)
+ config.read_string(serialised)
+
+ if not config.has_section("general"):
+ raise UM.VersionUpgrade.FormatException("No \"general\" section.")
+
+ # Make z_seam_x and z_seam_y options visible. In a clean 2.4 they are visible by default.
+ if config.has_option("general", "visible_settings"):
+ visible_settings = config.get("general", "visible_settings")
+ visible_set = set(visible_settings.split(";"))
+ visible_set.add("z_seam_x")
+ visible_set.add("z_seam_y")
+ config.set("general", "visible_settings", ";".join(visible_set))
+ config.set("general", "version", value="4")
+
+ output = io.StringIO()
+ config.write(output)
+ return [filename], [output.getvalue()]
+
def getCfgVersion(self, serialised):
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialised)
diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py index 85d53199e4..e1114922d6 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py @@ -20,8 +20,10 @@ def getMetaData(): "version_upgrade": {
# From To Upgrade function
("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance),
- ("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain)
- },
+ ("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain),
+ ("preferences", 3): ("preferences", 4, upgrade.upgradePreferences)
+
+ },
"sources": {
"machine_stack": {
"get_version": upgrade.getCfgVersion,
|