diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 8d8a70b0..cefa18ca 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -353,7 +353,7 @@ def gcodeFileCommand(filename, target): select_after_slicing = True print_after_slicing = False - if "print" in data.keys() and data["select"] in valid_boolean_trues: + if "print" in data.keys() and data["print"] in valid_boolean_trues: if not printer.isOperational(): return make_response("Printer is not operational, cannot directly start printing", 409) select_after_slicing = print_after_slicing = True @@ -374,8 +374,6 @@ def gcodeFileCommand(filename, target): printer.selectFile(filenameToSelect, sd, print_after_slicing) ok, result = fileManager.slice(slicer, target, filename, target, gcode_name, - printer_after_slicing=print_after_slicing, - select_after_slicing=select_after_slicing, profile=profile, printer_profile_id=printerProfile, position=position, diff --git a/src/octoprint/static/js/app/viewmodels/slicing.js b/src/octoprint/static/js/app/viewmodels/slicing.js index 98521939..23a18937 100644 --- a/src/octoprint/static/js/app/viewmodels/slicing.js +++ b/src/octoprint/static/js/app/viewmodels/slicing.js @@ -20,12 +20,20 @@ function SlicingViewModel(loginStateViewModel, printerProfilesViewModel) { self.profiles = ko.observableArray(); self.printerProfile = ko.observable(); + self.afterSlicingOptions = [ + {"value": "none", "text": gettext("Do nothing")}, + {"value": "select", "text": gettext("Select for printing")}, + {"value": "print", "text": gettext("Start printing")} + ]; + self.afterSlicing = ko.observable("none"); + self.show = function(target, file) { self.target = target; self.file = file; self.title(_.sprintf(gettext("Slicing %(filename)s"), {filename: self.file})); self.gcodeFilename(self.file.substr(0, self.file.lastIndexOf("."))); self.printerProfile(self.printerProfiles.currentProfile()); + self.afterSlicing("none"); $("#slicing_configuration_dialog").modal("show"); }; @@ -127,6 +135,12 @@ function SlicingViewModel(loginStateViewModel, printerProfilesViewModel) { gcode: gcodeFilename }; + if (self.afterSlicing() == "print") { + data["print"] = true; + } else if (self.afterSlicing() == "select") { + data["select"] = true; + } + $.ajax({ url: API_BASEURL + "files/" + self.target + "/" + self.file, type: "POST", diff --git a/src/octoprint/templates/dialogs.jinja2 b/src/octoprint/templates/dialogs.jinja2 index 894c62f8..ad9adab9 100644 --- a/src/octoprint/templates/dialogs.jinja2 +++ b/src/octoprint/templates/dialogs.jinja2 @@ -36,14 +36,7 @@