Merge branch 'dev/cancelconfirm' of https://github.com/ntoff/OctoPrint into pr/ntoff/dev/cancelconfirm
This commit is contained in:
commit
cbbfb4af20
5 changed files with 25 additions and 10 deletions
|
|
@ -125,7 +125,8 @@ def getSettings():
|
|||
"pollWatched": s.getBoolean(["feature", "pollWatched"]),
|
||||
"ignoreIdenticalResends": s.getBoolean(["feature", "ignoreIdenticalResends"]),
|
||||
"modelSizeDetection": s.getBoolean(["feature", "modelSizeDetection"]),
|
||||
"firmwareDetection": s.getBoolean(["feature", "firmwareDetection"])
|
||||
"firmwareDetection": s.getBoolean(["feature", "firmwareDetection"]),
|
||||
"printCancelConfirmation": s.getBoolean(["feature", "printCancelConfirmation"])
|
||||
},
|
||||
"serial": {
|
||||
"port": connectionOptions["portPreference"],
|
||||
|
|
@ -309,6 +310,7 @@ def _saveSettings(data):
|
|||
if "ignoreIdenticalResends" in data["feature"]: s.setBoolean(["feature", "ignoreIdenticalResends"], data["feature"]["ignoreIdenticalResends"])
|
||||
if "modelSizeDetection" in data["feature"]: s.setBoolean(["feature", "modelSizeDetection"], data["feature"]["modelSizeDetection"])
|
||||
if "firmwareDetection" in data["feature"]: s.setBoolean(["feature", "firmwareDetection"], data["feature"]["firmwareDetection"])
|
||||
if "printCancelConfirmation" in data["feature"]: s.setBoolean(["feature", "printCancelConfirmation"], data["feature"]["printCancelConfirmation"])
|
||||
|
||||
if "serial" in data.keys():
|
||||
if "autoconnect" in data["serial"].keys(): s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"])
|
||||
|
|
|
|||
|
|
@ -200,7 +200,8 @@ default_settings = {
|
|||
"identicalResendsCountdown": 7,
|
||||
"supportFAsCommand": False,
|
||||
"modelSizeDetection": True,
|
||||
"firmwareDetection": True
|
||||
"firmwareDetection": True,
|
||||
"printCancelConfirmation": True
|
||||
},
|
||||
"folder": {
|
||||
"uploads": None,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ $(function() {
|
|||
var self = this;
|
||||
|
||||
self.loginState = parameters[0];
|
||||
self.settings = parameters[1];
|
||||
|
||||
self.stateString = ko.observable(undefined);
|
||||
self.isErrorOrClosed = ko.observable(undefined);
|
||||
|
|
@ -288,18 +289,22 @@ $(function() {
|
|||
};
|
||||
|
||||
self.cancel = function() {
|
||||
showConfirmationDialog({
|
||||
message: gettext("This will cancel your print."),
|
||||
onproceed: function() {
|
||||
OctoPrint.job.cancel();
|
||||
}
|
||||
});
|
||||
if (!self.settings.feature_printCancelConfirmation()) {
|
||||
OctoPrint.job.cancel();
|
||||
} else {
|
||||
showConfirmationDialog({
|
||||
message: gettext("This will cancel your print."),
|
||||
onproceed: function() {
|
||||
OctoPrint.job.cancel();
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
PrinterStateViewModel,
|
||||
["loginStateViewModel"],
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
["#state_wrapper", "#drop_overlay"]
|
||||
]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ $(function() {
|
|||
self.feature_ignoreIdenticalResends = ko.observable(undefined);
|
||||
self.feature_modelSizeDetection = ko.observable(undefined);
|
||||
self.feature_firmwareDetection = ko.observable(undefined);
|
||||
self.feature_printCancelConfirmation = ko.observable(undefined);
|
||||
|
||||
self.serial_port = ko.observable();
|
||||
self.serial_baudrate = ko.observable();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,13 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: feature_printCancelConfirmation" id="settings-printCancelConfirmation"> {{ _('Confirm before cancelling a print') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
|
|
|
|||
Loading…
Reference in a new issue