diff options
author | Ghostkeeper <rubend@tutanota.com> | 2018-07-09 10:01:52 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2018-07-09 10:01:52 +0300 |
commit | 6977b8de6e39d8bd7feab8b10d23ffd755f4b76e (patch) | |
tree | e4bc81559d36aaed9fdb7b5736fb3d1e2e66b24f /plugins | |
parent | 183cd0182d32f1e5a3477d11891d9fed33c6c5e7 (diff) |
Make getValue return an int if it's an integer number
This is a more generic solution to what's done in 7058ddbb66084bee9cd507ed69f031ec1262163e.
Contributes to issue CURA-5491.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/PostProcessingPlugin/Script.py | 9 | ||||
-rw-r--r-- | plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/plugins/PostProcessingPlugin/Script.py b/plugins/PostProcessingPlugin/Script.py index d844705f1c..cc839ca485 100644 --- a/plugins/PostProcessingPlugin/Script.py +++ b/plugins/PostProcessingPlugin/Script.py @@ -105,9 +105,12 @@ class Script: if m is None: return default try: - return float(m.group(0)) - except: - return default + return int(m.group(0)) + except ValueError: #Not an integer. + try: + return float(m.group(0)) + except ValueError: #Not a number at all. + return default ## Convenience function to produce a line of g-code. # diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index c78351909d..a70a54559c 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -162,12 +162,12 @@ class PauseAtHeight(Script): #Track the latest printing temperature in order to resume at the correct temperature. if line.startswith("T"): - current_t = int(self.getValue(line, "T")) + current_t = self.getValue(line, "T") m = self.getValue(line, "M") - if m is not None and (int(m) == 104 or int(m) == 109) and self.getValue(line, "S") is not None: + if m is not None and (m == 104 or m == 109) and self.getValue(line, "S") is not None: extruder = current_t if self.getValue(line, "T") is not None: - extruder = int(self.getValue(line, "T")) + extruder = self.getValue(line, "T") target_temperature[extruder] = self.getValue(line, "S") if not layers_started: |