Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion octoprint_octolapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1490,11 +1490,19 @@ def accept_snapshot_plan_preview_request(self):
with OctolapsePlugin.admin_permission.require(http_exception=403):
request_values = request.get_json()
preprocessing_job_guid = request_values["preprocessing_job_guid"]
disable_for_print = request_values["disable_for_print"]
if (
preprocessing_job_guid is not None and
str(self.preprocessing_job_guid) == preprocessing_job_guid
):
self.accept_snapshot_plan_preview(preprocessing_job_guid)
if (not disable_for_print):
self.accept_snapshot_plan_preview(preprocessing_job_guid)
else:
logger.info("Disabling Octolapse for the current print as per user request.")
self.reset_preprocessing()
self._timelapse.release_job_on_hold_lock(reset=True)
self.send_snapshot_preview_complete_message()
print("Disabling Octolapse for the current print as per user request!!")
return jsonify({
'success': True
})
Expand Down
7 changes: 5 additions & 2 deletions octoprint_octolapse/static/js/octolapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1498,9 +1498,12 @@ $(function () {
*/
};

self.acceptSnapshotPlanPreview = function () {
self.acceptSnapshotPlanPreview = function (disable_for_print) {
//console.log("Accepting snapshot plan preview.");
var data = { "preprocessing_job_guid": self.preprocessing_job_guid };
var data = {
"preprocessing_job_guid": self.preprocessing_job_guid,
"disable_for_print": !!disable_for_print
};
$.ajax({
url: "./plugin/octolapse/acceptSnapshotPlanPreview",
type: "POST",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $(function() {
dialog.$snapshotPlanPreviewDialog = $("#octolapse_snapshot_plan_preview_dialog");
dialog.$snapshotPlanPreviewForm = dialog.$snapshotPlanPreviewDialog.find("#octolapse_snapshot_plan_preview_form");
dialog.$cancelButton = $(".cancel", dialog.$snapshotPlanPreviewDialog);
dialog.$disableButton = $(".continue-disable", dialog.$snapshotPlanPreviewDialog);
dialog.$closeIcon = $("a.close", dialog.$snapshotPlanPreviewDialog);
dialog.$continueButton = $(".continue", dialog.$snapshotPlanPreviewDialog);
dialog.$modalBody = dialog.$snapshotPlanPreviewDialog.find(".modal-body");
Expand All @@ -50,6 +51,11 @@ $(function() {
self.closeSnapshotPlanPreviewDialog();
});

dialog.$disableButton.unbind("click");
dialog.$disableButton.bind("click", function () {
Octolapse.Globals.acceptSnapshotPlanPreview(true);
});

// Prevent hiding unless the event was initiated by the hideAddEditDialog function
dialog.$snapshotPlanPreviewDialog.on("hide.bs.modal", function () {
return self.can_hide;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
</div>
<div class="modal-footer" style="bottom:0;position:relative">
<div class="row-fluid">
<button type="button" class="span6 btn btn-default cancel input-block-level" title="Cancel the print">Cancel Print</button>
<button type="button" class="span6 btn btn-primary continue input-block-level" title="Accept the snapshot plan and continue printing">
<button type="button" class="span4 btn btn-default cancel input-block-level" title="Cancel the print">Cancel Print</button>
<button type="button" class="span4 btn btn-default continue-disable input-block-level" title="Disable Octolapse for this print and continue printing">Print without Timelapse</button>
<button type="button" class="span4 btn btn-primary continue input-block-level" title="Accept the snapshot plan and continue printing">
Accept and Continue <span data-bind="visible: SnapshotPlanState.autoclose">(<span data-bind="text:SnapshotPlanState.autoclose_seconds"></span> seconds)</span></button>
</span>
</div>
Expand Down