Compare commits

..

No commits in common. "58b46132a437693a238de7baa02b3625d2f4dcea" and "070603cbe796133439ff28332c78409bfeab0b54" have entirely different histories.

6 changed files with 31 additions and 68 deletions

View File

@ -62,7 +62,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[license-shield]: https://img.shields.io/github/license/Sebclem/OctoPrint-SimpleEmergencyStop.svg?style=flat-square [license-shield]: https://img.shields.io/github/license/Sebclem/OctoPrint-SimpleEmergencyStop.svg?style=flat-square
[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg?style=flat-square [maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg?style=flat-square
[project-stage-shield]: https://img.shields.io/badge/project%20stage-Production-green.svg?style=flat-square [project-stage-shield]: https://img.shields.io/badge/project%20stage-Production-green.svg?style=flat-square
[releases-shield]: https://img.shields.io/github/release/Sebclem/OctoPrint-SimpleEmergencyStop.svg?style=flat-square [releases-shield]: https://img.shields.io/github/release/Sebclem/OctoPrint-SimpleEmergencyStop.svg?style=flat-square
[releases]: https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop/releases [releases]: https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop/releases

View File

@ -16,9 +16,7 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
return dict( return dict(
emergencyGCODE="M112", emergencyGCODE="M112",
confirmationDialog=False, confirmationDialog=False,
big_button=False, big_button=False
enableMargin=False,
marginValue=0,
) )
def on_settings_save(self, data): def on_settings_save(self, data):

View File

@ -49,33 +49,15 @@ $(function () {
return user.permissions.includes("control") || user.needs.role.includes("control"); return user.permissions.includes("control") || user.needs.role.includes("control");
} }
else return true; else return true;
} }
this.ses_margin_css = function () {
if (this.settings.enableMargin()) {
$('#ses_wrapper').css({
'margin-left':`${this.settings.marginValue()}px`,
'margin-right':`${this.settings.marginValue()}px`
});
} else {
$('#ses_wrapper').css({
'margin-left':'0px',
'margin-right':'0px'
});
}
};
this.ses_visible = function () {
return this.loginState.isUser() && this.hasControlPermition();
};
this.big_button_visible = function () { this.big_button_visible = function () {
return this.settings.big_button(); return this.loginState.isUser() && this.settings.big_button() && this.hasControlPermition();
}; };
this.little_button_visible = function () { this.little_button_visible = function () {
return !this.settings.big_button(); return this.loginState.isUser() && !this.settings.big_button() && this.hasControlPermition();
}; };
this.can_send_command = function () { this.can_send_command = function () {

View File

@ -1,30 +1,28 @@
<div id="ses_wrapper" data-bind="css: ses_margin_css(), visible: ses_visible()"> <div>
<div> <a data-bind="click: click, css: little_button_css(), attr: { title: get_title() }, visible: little_button_visible()"
<a data-bind="click: click, css: little_button_css(), attr: { title: get_title() }, visible: little_button_visible()" href="#">
href="#"> <span class="fa-stack">
<i class="far fa-circle fa-stack-2x"></i>
<i class="fas fa-hand-paper fa-stack-1x fa-inverse"></i>
</span>
</a>
</div>
<div>
<a data-bind="click: click, css: big_button_css(), attr: { title: get_title() }, visible: big_button_visible()"
href="#">
<div class="ses_big_middle">
<span class="fa-stack"> <span class="fa-stack">
<i class="far fa-circle fa-stack-2x"></i> <i class="far fa-circle fa-stack-2x"></i>
<i class="fas fa-hand-paper fa-stack-1x fa-inverse"></i> <i class="fas fa-hand-paper fa-stack-1x fa-inverse"></i>
</span> </span>
</a> <h5>{{ _("Emergency Stop") }}</h5>
</div> <span class="fa-stack">
<i class="far fa-circle fa-stack-2x"></i>
<div> <i class="fas fa-hand-paper fa-stack-1x fa-inverse"></i>
<a data-bind="click: click, css: big_button_css(), attr: { title: get_title() }, visible: big_button_visible()" </span>
href="#"> </div>
<div class="ses_big_middle"> </a>
<span class="fa-stack">
<i class="far fa-circle fa-stack-2x"></i>
<i class="fas fa-hand-paper fa-stack-1x fa-inverse"></i>
</span>
<h5>{{ _("Emergency Stop") }}</h5>
<span class="fa-stack">
<i class="far fa-circle fa-stack-2x"></i>
<i class="fas fa-hand-paper fa-stack-1x fa-inverse"></i>
</span>
</div>
</a>
</div>
</div> </div>
<div id="confirmation" class="modal hide fade"> <div id="confirmation" class="modal hide fade">
@ -45,4 +43,4 @@
_("Proceed") _("Proceed")
}}</a> }}</a>
</div> </div>
</div> </div>

View File

@ -3,7 +3,7 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">{{ _('Emergency GCODE:') }}</label> <label class="control-label">{{ _('Emergency GCODE:') }}</label>
<div class="controls"> <div class="controls">
<input type="text" class="" <input type="text" class="input-block-level"
data-bind="value: settings.plugins.simpleemergencystop.emergencyGCODE"> data-bind="value: settings.plugins.simpleemergencystop.emergencyGCODE">
</div> </div>
</div> </div>
@ -19,21 +19,6 @@
<input type="checkbox" data-bind="checked: settings.plugins.simpleemergencystop.big_button"> <input type="checkbox" data-bind="checked: settings.plugins.simpleemergencystop.big_button">
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label">{{ _('Enable margin') }}</label>
<div class="controls">
<input type="checkbox" data-bind="checked: settings.plugins.simpleemergencystop.enableMargin">
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Margin value:') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="" step="5" min="0" data-bind="
value: settings.plugins.simpleemergencystop.marginValue,
enable: settings.plugins.simpleemergencystop.enableMargin()">
<span class="add-on">px</span>
</div>
</div>
</div>
</form> </form>

View File

@ -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 = "1.0.6" plugin_version = "1.0.5"
# 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