mirror of
https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop.git
synced 2024-11-22 09:12:58 +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**
|
- **emergencyGcode**
|
||||||
Diffine the GCODE to send when the button is pressed.
|
Diffine the GCODE to send when the button is pressed.
|
||||||
|
- **confirmationDialog** Show corfirmation dialog on click?
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
|||||||
|
|
||||||
def get_settings_defaults(self):
|
def get_settings_defaults(self):
|
||||||
return dict(
|
return dict(
|
||||||
emergencyGCODE="M112"
|
emergencyGCODE="M112",
|
||||||
|
confirmationDialog = True
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_settings_save(self, data):
|
def on_settings_save(self, data):
|
||||||
|
@ -7,10 +7,30 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
function SimpleemergencystopViewModel(parameters) {
|
function SimpleemergencystopViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
self.settings = undefined;
|
||||||
|
self.allSettings = parameters[0];
|
||||||
self.loginState = parameters[1];
|
self.loginState = parameters[1];
|
||||||
self.printerState = parameters[2];
|
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 () {
|
self.click = function () {
|
||||||
|
if(self.settings.confirmationDialog())
|
||||||
|
self.confirmation.modal("show");
|
||||||
|
else
|
||||||
|
self.sendCommand()
|
||||||
|
|
||||||
|
};
|
||||||
|
self.sendCommand = function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL+"plugin/simpleemergencystop",
|
url: API_BASEURL+"plugin/simpleemergencystop",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -20,10 +40,13 @@ $(function() {
|
|||||||
}),
|
}),
|
||||||
contentType: "application/json; charset=UTF-8",
|
contentType: "application/json; charset=UTF-8",
|
||||||
success: function (data,status) {
|
success: function (data,status) {
|
||||||
console.log(data);
|
self.confirmation.modal("hide");
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,3 +2,20 @@
|
|||||||
<i class="icon-warning-sign" style="color: red"></i>
|
<i class="icon-warning-sign" style="color: red"></i>
|
||||||
</a>
|
</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">
|
<div class="controls">
|
||||||
<input type="text" class="input-block-level" data-bind="value: settings.plugins.simpleemergencystop.emergencyGCODE">
|
<input type="text" class="input-block-level" data-bind="value: settings.plugins.simpleemergencystop.emergencyGCODE">
|
||||||
</div>
|
</div>
|
||||||
|
<label class="control-label">{{ _('Enable warding dialog ') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="checkbox" data-bind="checked: settings.plugins.simpleemergencystop.confirmationDialog">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ plugin_package = "octoprint_simpleemergencystop"
|
|||||||
plugin_name = "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
|
# 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
|
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||||
# module
|
# module
|
||||||
|
Loading…
Reference in New Issue
Block a user