From c433e32e6cd6e9413a62ed3e44ae64f02dac3ae5 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Tue, 22 Mar 2016 22:16:26 -0700 Subject: [PATCH] Include extra extruder start/end.gcode in import Prior to this change, start2.gcode, end2.gcode, start3.gcode, end3.gcode, etc. were ignored due to the index coming before the period. Fixes #1289 --- src/octoprint/plugins/cura/profile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/cura/profile.py b/src/octoprint/plugins/cura/profile.py index 15fdc53e..3f6d3c24 100644 --- a/src/octoprint/plugins/cura/profile.py +++ b/src/octoprint/plugins/cura/profile.py @@ -459,13 +459,16 @@ class Profile(object): index = None for opt in arrayified_options: - if key.startswith(opt): + # if there's a period, the index comes before it + optsplit = opt.split('.') + keysplit = key.split('.') + if key.startswith(optsplit[0]) and keysplit[1:] == optsplit[1:]: if key == opt: index = 0 else: try: # try to convert the target index, e.g. print_temperature2 => print_temperature[1] - index = int(key[len(opt):]) - 1 + index = int(keysplit[0][len(optsplit[0]):]) - 1 except ValueError: # ignore entries for which that fails ignored = True