Browse Source

Fix type of fallback variable

These have to be strings because the configparser getter can only return strings.

Contributes to issue CURA-5936.
Ghostkeeper 6 years ago
parent
commit
b67d8d4103

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py

@@ -251,7 +251,7 @@ class VersionUpgrade21to22(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Gets the fallback quality to use for a specific machine-variant-material
     ##  Gets the fallback quality to use for a specific machine-variant-material

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py

@@ -156,5 +156,5 @@ class VersionUpgrade22to24(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py

@@ -43,7 +43,7 @@ class VersionUpgrade25to26(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades the preferences file from version 2.5 to 2.6.
     ##  Upgrades the preferences file from version 2.5 to 2.6.

+ 2 - 2
plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py

@@ -84,7 +84,7 @@ class VersionUpgrade26to27(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades a preferences file from version 2.6 to 2.7.
     ##  Upgrades a preferences file from version 2.6 to 2.7.
@@ -92,7 +92,7 @@ class VersionUpgrade26to27(VersionUpgrade):
     #   \param serialised The serialised form of a preferences file.
     #   \param serialised The serialised form of a preferences file.
     #   \param filename The name of the file to upgrade.
     #   \param filename The name of the file to upgrade.
     def upgradePreferences(self, serialised: str, filename: str) -> Tuple[List[str], List[str]]:
     def upgradePreferences(self, serialised: str, filename: str) -> Tuple[List[str], List[str]]:
-        parser = configparser.ConfigParser(interpolation=None)
+        parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
 
 
         # Update version numbers
         # Update version numbers

+ 2 - 2
plugins/VersionUpgrade/VersionUpgrade27to30/VersionUpgrade27to30.py

@@ -48,7 +48,7 @@ class VersionUpgrade27to30(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades a preferences file from version 2.7 to 3.0.
     ##  Upgrades a preferences file from version 2.7 to 3.0.
@@ -158,7 +158,7 @@ class VersionUpgrade27to30(VersionUpgrade):
     #   \param serialised The serialised form of the container file.
     #   \param serialised The serialised form of the container file.
     #   \param filename The name of the file to upgrade.
     #   \param filename The name of the file to upgrade.
     def upgradeOtherContainer(self, serialised: str, filename: str) -> Tuple[List[str], List[str]]:
     def upgradeOtherContainer(self, serialised: str, filename: str) -> Tuple[List[str], List[str]]:
-        parser = configparser.ConfigParser(interpolation=None)
+        parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
 
 
         # Update the skin pre-shrink settings:
         # Update the skin pre-shrink settings:

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade30to31/VersionUpgrade30to31.py

@@ -77,7 +77,7 @@ class VersionUpgrade30to31(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades a preferences file from version 3.0 to 3.1.
     ##  Upgrades a preferences file from version 3.0 to 3.1.

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade32to33/VersionUpgrade32to33.py

@@ -83,7 +83,7 @@ class VersionUpgrade32to33(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades a preferences file from version 3.2 to 3.3.
     ##  Upgrades a preferences file from version 3.2 to 3.3.

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade33to34/VersionUpgrade33to34.py

@@ -29,7 +29,7 @@ class VersionUpgrade33to34(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades instance containers to have the new version
     ##  Upgrades instance containers to have the new version

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade34to35/VersionUpgrade34to35.py

@@ -78,7 +78,7 @@ class VersionUpgrade34to35(VersionUpgrade):
         parser = configparser.ConfigParser(interpolation = None)
         parser = configparser.ConfigParser(interpolation = None)
         parser.read_string(serialised)
         parser.read_string(serialised)
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
         format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
-        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
         return format_version * 1000000 + setting_version
         return format_version * 1000000 + setting_version
 
 
     ##  Upgrades Preferences to have the new version number.
     ##  Upgrades Preferences to have the new version number.