From 8dff6d67506d81d00d73987582f6e581588b0dea Mon Sep 17 00:00:00 2001 From: Ross Hendrickson Date: Sun, 21 Jul 2013 19:01:36 -0600 Subject: [PATCH] Cura enabled will change if an STL is sliced or not --- octoprint/gcodefiles.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/octoprint/gcodefiles.py b/octoprint/gcodefiles.py index 1275f470..dd2b6189 100644 --- a/octoprint/gcodefiles.py +++ b/octoprint/gcodefiles.py @@ -19,7 +19,9 @@ class GcodeManager: def __init__(self): self._logger = logging.getLogger(__name__) - self._uploadFolder = settings().getBaseFolder("uploads") + self._settings = settings() + + self._uploadFolder = self._settings.getBaseFolder("uploads") self._callbacks = [] @@ -128,10 +130,13 @@ class GcodeManager: file.save(absolutePath) filename = file.filename + if isGcodeFileName(filename): return self.processGcode(absolutePath) - if isSTLFileName(filename): + curaEnabled = self._settings.get(["curaEngine", "enabled"]) + + if isSTLFileName(filename) and curaEnabled: gcodePath = util.genGcodeFileName(absolutePath) logging.info("FILENAME: %s" % filename) @@ -142,19 +147,20 @@ class GcodeManager: filename, absolutePath, callBack, callBackArgs) def processSTL(self, filename, absolutePath, callBack, callBackArgs): + from octoprint.cura import CuraFactory curaEngine = CuraFactory.create_slicer() - current_settings = settings() gcodePath = util.genGcodeFileName(absolutePath) - config = current_settings.get(["curaEngine", "config"]) + config = self._settings.get(["curaEngine", "config"]) curaEngine.process_file( config, gcodePath, absolutePath, callBack, callBackArgs) def processGcode(self, absolutePath): + filename = self._getBasicFilename(absolutePath) if filename in self._metadata.keys():