mirror of
https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop.git
synced 2024-11-22 01:02:59 +01:00
Merge remote-tracking branch 'origin/devel'
This commit is contained in:
commit
35092fd211
@ -14,6 +14,7 @@ or manually using this URL:
|
||||
|
||||
- **emergencyGcode**
|
||||
Diffine the GCODE to send when the button is pressed.
|
||||
- **confirmationDialog** Show corfirmation dialog on click?
|
||||
|
||||
## API
|
||||
|
||||
|
@ -22,7 +22,8 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
||||
|
||||
def get_settings_defaults(self):
|
||||
return dict(
|
||||
emergencyGCODE="M112"
|
||||
emergencyGCODE="M112",
|
||||
confirmationDialog = True
|
||||
)
|
||||
|
||||
def on_settings_save(self, data):
|
||||
|
@ -7,11 +7,31 @@
|
||||
$(function() {
|
||||
function SimpleemergencystopViewModel(parameters) {
|
||||
var self = this;
|
||||
self.settings = undefined;
|
||||
self.allSettings = parameters[0];
|
||||
self.loginState = parameters[1];
|
||||
self.printerState = parameters[2];
|
||||
console.log(parameters);
|
||||
self.confirmation = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
self.onAfterBinding = function() {
|
||||
self.confirmation = $("#confirmation");
|
||||
self.settings = self.allSettings.settings.plugins.simpleemergencystop;
|
||||
};
|
||||
|
||||
|
||||
|
||||
self.click = function () {
|
||||
$.ajax({
|
||||
if(self.settings.confirmationDialog())
|
||||
self.confirmation.modal("show");
|
||||
else
|
||||
self.sendCommand()
|
||||
|
||||
};
|
||||
self.sendCommand = function () {
|
||||
$.ajax({
|
||||
url: API_BASEURL+"plugin/simpleemergencystop",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
@ -20,10 +40,13 @@ $(function() {
|
||||
}),
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
success: function (data,status) {
|
||||
console.log(data);
|
||||
self.confirmation.modal("hide");
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,3 +2,20 @@
|
||||
<i class="icon-warning-sign" style="color: red"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<div id="confirmation" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<a href="#" class="close" data-dismiss="modal" aria-hidden="true">×</a>
|
||||
<h3>Emergency Stop!</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
{{ _('Are you sure you want to stop your printer?') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Cancel') }}</a>
|
||||
<a href="#" class="btn btn-danger" data-bind="click: sendCommand()">{{ _('Proceed') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -5,5 +5,10 @@
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.simpleemergencystop.emergencyGCODE">
|
||||
</div>
|
||||
<label class="control-label">{{ _('Enable warding dialog ') }}</label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" data-bind="checked: settings.plugins.simpleemergencystop.confirmationDialog">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ plugin_package = "octoprint_simpleemergencystop"
|
||||
plugin_name = "OctoPrint-SimpleEmergencyStop"
|
||||
|
||||
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
||||
plugin_version = "0.1.0"
|
||||
plugin_version = "0.1.1"
|
||||
|
||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||
# module
|
||||
|
Loading…
Reference in New Issue
Block a user