mirror of
https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop.git
synced 2024-11-22 09:12:58 +01:00
Make the plugin python 3 compatible #12
This commit is contained in:
parent
dc25fd8d96
commit
021d4754a7
@ -1,16 +1,9 @@
|
|||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
### (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.
|
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
|
|
||||||
class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
||||||
octoprint.plugin.TemplatePlugin,
|
octoprint.plugin.TemplatePlugin,
|
||||||
octoprint.plugin.SettingsPlugin,
|
octoprint.plugin.SettingsPlugin,
|
||||||
@ -19,7 +12,6 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.emergencyGCODE = ""
|
self.emergencyGCODE = ""
|
||||||
|
|
||||||
|
|
||||||
def get_settings_defaults(self):
|
def get_settings_defaults(self):
|
||||||
return dict(
|
return dict(
|
||||||
emergencyGCODE="M112",
|
emergencyGCODE="M112",
|
||||||
@ -45,7 +37,7 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
|||||||
)
|
)
|
||||||
|
|
||||||
def on_api_command(self, command, data):
|
def on_api_command(self, command, data):
|
||||||
## check if there is a : in line
|
# check if there is a : in line
|
||||||
find_this = ":"
|
find_this = ":"
|
||||||
if find_this in str(self.emergencyGCODE):
|
if find_this in str(self.emergencyGCODE):
|
||||||
|
|
||||||
@ -62,7 +54,7 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
|||||||
js=["js/simpleemergencystop.js"],
|
js=["js/simpleemergencystop.js"],
|
||||||
)
|
)
|
||||||
|
|
||||||
##~~ Softwareupdate hook
|
# Softwareupdate hook
|
||||||
|
|
||||||
def get_update_information(self):
|
def get_update_information(self):
|
||||||
# Define the configuration for your plugin to use with the Software Update
|
# 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
|
# ("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.
|
# can be overwritten via __plugin_xyz__ control properties. See the documentation for that.
|
||||||
__plugin_name__ = "Simple Emergency Stop"
|
__plugin_name__ = "Simple Emergency Stop"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
|
||||||
|
|
||||||
def __plugin_load__():
|
def __plugin_load__():
|
||||||
global __plugin_implementation__
|
global __plugin_implementation__
|
||||||
@ -98,4 +92,3 @@ def __plugin_load__():
|
|||||||
__plugin_hooks__ = {
|
__plugin_hooks__ = {
|
||||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user