Merge remote-tracking branch 'origin/devel'

This commit is contained in:
BrokenFire 2017-07-26 00:01:51 +02:00
commit 35092fd211
6 changed files with 54 additions and 7 deletions

View File

@ -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

View File

@ -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):

View File

@ -7,10 +7,30 @@
$(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 () {
if(self.settings.confirmationDialog())
self.confirmation.modal("show");
else
self.sendCommand()
};
self.sendCommand = function () {
$.ajax({
url: API_BASEURL+"plugin/simpleemergencystop",
type: "POST",
@ -20,10 +40,13 @@ $(function() {
}),
contentType: "application/json; charset=UTF-8",
success: function (data,status) {
console.log(data);
}
})
self.confirmation.modal("hide");
}
});
};
}

View File

@ -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">&times;</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>

View File

@ -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>

View File

@ -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