Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <ghost_keeper+github@hotmail.com>2015-12-16 17:05:30 +0300
committerGhostkeeper <ghost_keeper+github@hotmail.com>2015-12-17 15:35:16 +0300
commitcfa43820527d7c4fa29c1ecf2dfef753ee7e23bf (patch)
tree5a0a5ea24160b63e3dcd1114ce676d375521e250 /plugins/GCodeProfileReader
parenta12246781d159ce361d61ac648dd264db9a0ded8 (diff)
Move serialised version number to top of GCode reader/writer
The version number is more clearly exposed there. Contributes to issue CURA-34.
Diffstat (limited to 'plugins/GCodeProfileReader')
-rw-r--r--plugins/GCodeProfileReader/GCodeProfileReader.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/GCodeProfileReader/GCodeProfileReader.py b/plugins/GCodeProfileReader/GCodeProfileReader.py
index 02727dec4c..524e4662d5 100644
--- a/plugins/GCodeProfileReader/GCodeProfileReader.py
+++ b/plugins/GCodeProfileReader/GCodeProfileReader.py
@@ -11,6 +11,13 @@ import re #Regular expressions for parsing escape characters in the settings.
# It reads the profile data from g-code files and stores it in a new profile.
# This class currently does not process the rest of the g-code in any way.
class GCodeProfileReader(ProfileReader):
+ ## The file format version of the serialised g-code.
+ #
+ # It can only read settings with the same version as the version it was
+ # written with. If the file format is changed in a way that breaks reverse
+ # compatibility, increment this version number!
+ version = 1
+
## Initialises the g-code reader as a profile reader.
def __init__(self):
super().__init__()
@@ -22,7 +29,6 @@ class GCodeProfileReader(ProfileReader):
# specified file was no g-code or contained no parsable profile, \code
# None \endcode is returned.
def read(self, file_name):
- version = 1 #IF YOU CHANGE THIS FUNCTION IN A WAY THAT BREAKS REVERSE COMPATIBILITY, INCREMENT THIS VERSION NUMBER!
prefix = ";SETTING_" + str(version) + " "
#Loading all settings from the file. They are all at the end, but Python has no reverse seek any more since Python3. TODO: Consider moving settings to the start?