Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebclem committed Jul 25, 2017
2 parents 7326632 + 11341b6 commit 35092fd
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion octoprint_simpleemergencystop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def __init__(self):

def get_settings_defaults(self):
return dict(
emergencyGCODE="M112"
emergencyGCODE="M112",
confirmationDialog = True
)

def on_settings_save(self, data):
Expand Down
33 changes: 28 additions & 5 deletions octoprint_simpleemergencystop/static/js/simpleemergencystop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,10 +40,13 @@ $(function() {
}),
contentType: "application/json; charset=UTF-8",
success: function (data,status) {
console.log(data);
self.confirmation.modal("hide");
}
})
}
});

};



}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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
Expand Down

0 comments on commit 35092fd

Please sign in to comment.