diff --git a/octoprint_simpleemergencystop/__init__.py b/octoprint_simpleemergencystop/__init__.py index 58b3ae5..930f734 100644 --- a/octoprint_simpleemergencystop/__init__.py +++ b/octoprint_simpleemergencystop/__init__.py @@ -16,7 +16,9 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin, return dict( emergencyGCODE="M112", confirmationDialog=False, - big_button=False + big_button=False, + enableMargin=False, + marginValue=0, ) def on_settings_save(self, data): diff --git a/octoprint_simpleemergencystop/static/js/simpleemergencystop.js b/octoprint_simpleemergencystop/static/js/simpleemergencystop.js index c9b18c4..ba31ad0 100644 --- a/octoprint_simpleemergencystop/static/js/simpleemergencystop.js +++ b/octoprint_simpleemergencystop/static/js/simpleemergencystop.js @@ -49,15 +49,33 @@ $(function () { return user.permissions.includes("control") || user.needs.role.includes("control"); } 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 () { - return this.loginState.isUser() && this.settings.big_button() && this.hasControlPermition(); + return this.settings.big_button(); }; this.little_button_visible = function () { - return this.loginState.isUser() && !this.settings.big_button() && this.hasControlPermition(); + return !this.settings.big_button(); }; this.can_send_command = function () { diff --git a/octoprint_simpleemergencystop/templates/simpleemergencystop_navbar.jinja2 b/octoprint_simpleemergencystop/templates/simpleemergencystop_navbar.jinja2 index b9340e8..beadd8c 100644 --- a/octoprint_simpleemergencystop/templates/simpleemergencystop_navbar.jinja2 +++ b/octoprint_simpleemergencystop/templates/simpleemergencystop_navbar.jinja2 @@ -1,28 +1,30 @@ -
- - - - - - -
+
+
+ + + + + + +
-
- -
- - - - -
{{ _("Emergency Stop") }}
- - - - -
-
+
+ +
+ + + + +
{{ _("Emergency Stop") }}
+ + + + +
+
+
-
\ No newline at end of file + diff --git a/octoprint_simpleemergencystop/templates/simpleemergencystop_settings.jinja2 b/octoprint_simpleemergencystop/templates/simpleemergencystop_settings.jinja2 index 3345927..963851b 100644 --- a/octoprint_simpleemergencystop/templates/simpleemergencystop_settings.jinja2 +++ b/octoprint_simpleemergencystop/templates/simpleemergencystop_settings.jinja2 @@ -3,7 +3,7 @@
-
@@ -19,6 +19,21 @@ - - +
+ +
+ +
+
+
+ +
+
+ + px +
+
+