mirror of
https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop.git
synced 2024-11-22 01:02:59 +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
|
||||
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,15 +12,14 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
||||
def __init__(self):
|
||||
self.emergencyGCODE = ""
|
||||
|
||||
|
||||
def get_settings_defaults(self):
|
||||
return dict(
|
||||
emergencyGCODE="M112",
|
||||
confirmationDialog = False
|
||||
confirmationDialog=False
|
||||
)
|
||||
|
||||
def on_settings_save(self, data):
|
||||
octoprint.plugin.SettingsPlugin.on_settings_save(self,data)
|
||||
octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
|
||||
self.emergencyGCODE = self._settings.get(["emergencyGCODE"])
|
||||
|
||||
def on_after_startup(self):
|
||||
@ -35,7 +27,7 @@ class SimpleemergencystopPlugin(octoprint.plugin.StartupPlugin,
|
||||
|
||||
def get_template_configs(self):
|
||||
return [
|
||||
#dict(type="navbar", custom_bindings=False),
|
||||
# dict(type="navbar", custom_bindings=False),
|
||||
dict(type="settings", custom_bindings=False)
|
||||
]
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user