Skip to content

Commit

Permalink
Compatibility with Slic3r 1.3.0: presets names are now saved without …
Browse files Browse the repository at this point in the history
…extension

    * fixes slic3r/Slic3r#3813
  • Loading branch information
xoan committed May 2, 2017
1 parent 27584de commit 38331ad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2181,13 +2181,16 @@ def load_slic3r_configs(self, menus):
self.slic3r_configpath = configpath
configfile = os.path.join(configpath, "slic3r.ini")
config = self.read_slic3r_config(configfile)
version = config.get("dummy", "version") # Slic3r version
self.slic3r_configs = {}
for cat in menus:
menu = menus[cat]
pattern = os.path.join(configpath, cat, "*.ini")
files = sorted(glob.glob(pattern))
try:
preset = config.get("presets", cat)
# Starting from Slic3r 1.3.0, preset names have no extension
if version >= "1.3.0": preset += ".ini"
self.slic3r_configs[cat] = preset
except:
preset = None
Expand Down Expand Up @@ -2224,7 +2227,11 @@ def set_slic3r_config(self, configfile, cat, file):
self.slic3r_configs[cat] = file
if self.settings.slic3rupdate:
config = self.read_slic3r_config(configfile)
config.set("presets", cat, os.path.basename(file))
version = config.get("dummy", "version") # Slic3r version
preset = os.path.basename(file)
# Starting from Slic3r 1.3.0, preset names have no extension
if version >= "1.3.0": preset = os.path.splitext(preset)[0];
config.set("presets", cat, preset)
f = StringIO.StringIO()
config.write(f)
data = f.getvalue()
Expand Down

0 comments on commit 38331ad

Please sign in to comment.