PEP8 + python version requirements

This commit is contained in:
egguy 2020-05-13 16:39:49 +02:00
parent f8688d6415
commit 4fe4a64b7d

View File

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