From 4fe4a64b7d955b9d0658db52bc4013c94882c407 Mon Sep 17 00:00:00 2001 From: egguy Date: Wed, 13 May 2020 16:39:49 +0200 Subject: [PATCH] PEP8 + python version requirements --- octoprint_estop/__init__.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/octoprint_estop/__init__.py b/octoprint_estop/__init__.py index b2c0664..93a5bc1 100644 --- a/octoprint_estop/__init__.py +++ b/octoprint_estop/__init__.py @@ -3,29 +3,33 @@ from __future__ import absolute_import import octoprint.plugin + class EstopPlugin(octoprint.plugin.StartupPlugin, - octoprint.plugin.AssetPlugin, - octoprint.plugin.TemplatePlugin, - octoprint.plugin.SettingsPlugin): + octoprint.plugin.AssetPlugin, + octoprint.plugin.TemplatePlugin, + octoprint.plugin.SettingsPlugin): def get_settings_defaults(self): - return dict(estopCommand = "M112") + return dict(estopCommand="M112") def on_after_startup(self): self.estopCommand = self._settings.get(["estopCommand"]) if (self.estopCommand != "M112"): - self._logger.warn("WARNING! EMERGENCY STOP COMMAND HAS BEEN CHANGED FROM DEFAULT \"M112\" TO \"" + self.estopCommand + "\"") + self._logger.warn( + "WARNING! EMERGENCY STOP COMMAND HAS BEEN CHANGED FROM DEFAULT \"M112\" TO \"" + self.estopCommand + "\"") def get_assets(self): return dict( js=["js/estop.js"], css=["css/estop.css"] ) + def get_template_configs(self): return [ - dict(type="sidebar", name="Emergency STOP!", icon="close", template="estop_sidebar.jinja2", styles=["display: none"], data_bind="visible: loginState.isUser"), + dict(type="sidebar", name="Emergency STOP!", icon="close", template="estop_sidebar.jinja2", + styles=["display: none"], data_bind="visible: loginState.isUser"), dict(type="settings", name="E-Stop Settings", template="estop_settings.jinja2", custom_bindings=False) - ] + ] def get_update_information(self): return dict( @@ -44,7 +48,10 @@ class EstopPlugin(octoprint.plugin.StartupPlugin, ) ) + __plugin_name__ = "Emergency Stop Button" +__plugin_pythoncompat__ = ">=2.7,<4" # python 2 and 3 + def __plugin_load__(): global __plugin_implementation__ @@ -53,4 +60,4 @@ def __plugin_load__(): global __plugin_hooks__ __plugin_hooks__ = { "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information - } \ No newline at end of file + }