From 63bdb08ec2b548f321fff3d04245237fcf1610ec Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 9 Dec 2015 17:19:51 +0100 Subject: [PATCH] Make serialisation version static It needs to be accessed by GCodeReader to remain consistent. Contributes to issue CURA-34. --- plugins/GCodeWriter/GCodeWriter.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/GCodeWriter/GCodeWriter.py b/plugins/GCodeWriter/GCodeWriter.py index 69a94f59d3..f8fe45ec6e 100644 --- a/plugins/GCodeWriter/GCodeWriter.py +++ b/plugins/GCodeWriter/GCodeWriter.py @@ -9,6 +9,12 @@ import re #For escaping characters in the settings. class GCodeWriter(MeshWriter): + ## Serialisation version ID of the settings that get serialised in g-code. + # + # If the format of settings is modified in any way that breaks backwards + # compatibility, this version number must be incremented. + settings_version_id = 1 + def __init__(self): super().__init__() @@ -36,8 +42,8 @@ class GCodeWriter(MeshWriter): # \param profile The profile to serialise. # \return A serialised string of the profile. def _serialiseProfile(self, profile): - version = 1 #IF YOU CHANGE THIS FUNCTION IN A WAY THAT BREAKS REVERSE COMPATIBILITY, INCREMENT THIS VERSION NUMBER! - prefix = ";SETTING_" + str(version) + " " #The prefix to put before each line. + #IF YOU CHANGE THIS FUNCTION IN A WAY THAT BREAKS REVERSE COMPATIBILITY, INCREMENT settings_version_id! + prefix = ";SETTING_" + str(self.settings_version_id) + " " #The prefix to put before each line. serialised = profile.serialise()