Make the plugin python 3 compatible #12

This commit is contained in:
Sebastien Clement 2020-03-25 15:02:02 +01:00
parent dc25fd8d96
commit 021d4754a7

View File

@ -1,16 +1,9 @@
# coding=utf-8
from __future__ import absolute_import
### (Don't forget to remove me)
# This is a basic skeleton for your plugin's __init__.py. You probably want to adjust the class name of your plugin
# as well as the plugin mixins it's subclassing from. This is really just a basic skeleton to get you started,
# defining your plugin as a template plugin, settings and asset plugin. Feel free to add or remove mixins
# as necessary.
#
# Take a look at the documentation on what other plugin mixins are available.
from __future__ import absolute_import, division, print_function, unicode_literals
import octoprint.plugin
class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.SettingsPlugin,
@ -19,7 +12,6 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
def __init__(self):
self.emergencyGCODE = ""
def get_settings_defaults(self):
return dict(
emergencyGCODE="M112",
@ -45,7 +37,7 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
)
def on_api_command(self, command, data):
## check if there is a : in line
# check if there is a : in line
find_this = ":"
if find_this in str(self.emergencyGCODE):
@ -62,7 +54,7 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
js=["js/simpleemergencystop.js"],
)
##~~ Softwareupdate hook
# Softwareupdate hook
def get_update_information(self):
# Define the configuration for your plugin to use with the Software Update
@ -89,6 +81,8 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
# ("OctoPrint-PluginSkeleton"), you may define that here. Same goes for the other metadata derived from setup.py that
# can be overwritten via __plugin_xyz__ control properties. See the documentation for that.
__plugin_name__ = "Simple Emergency Stop"
__plugin_pythoncompat__ = ">=2.7,<4"
def __plugin_load__():
global __plugin_implementation__
@ -98,4 +92,3 @@ def __plugin_load__():
__plugin_hooks__ = {
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
}