2015-04-15 23:41:05 +02:00
|
|
|
# coding=utf-8
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
|
|
__author__ = "Marc Hannappel <sunpack@web.de>"
|
|
|
|
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
|
|
|
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
|
|
|
|
2015-04-18 11:45:57 +02:00
|
|
|
from octoprint.settings import settings
|
|
|
|
|
2015-04-15 23:41:05 +02:00
|
|
|
import octoprint.plugin
|
|
|
|
|
|
|
|
class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
|
|
|
octoprint.plugin.TemplatePlugin,
|
|
|
|
octoprint.plugin.AssetPlugin):
|
2015-04-18 11:45:57 +02:00
|
|
|
|
2015-04-15 23:41:05 +02:00
|
|
|
def get_settings_defaults(self):
|
2015-04-18 11:45:57 +02:00
|
|
|
return dict(
|
|
|
|
controls = []
|
|
|
|
)
|
|
|
|
|
|
|
|
def on_settings_save(self, data):
|
|
|
|
s = settings()
|
|
|
|
s.set(["controls"], data["controls"])
|
2015-04-15 23:41:05 +02:00
|
|
|
|
|
|
|
def get_assets(self):
|
2015-04-18 13:12:06 +02:00
|
|
|
return dict(
|
|
|
|
js=[
|
2015-04-18 11:45:57 +02:00
|
|
|
"js/customControl.js",
|
2015-04-19 21:19:54 +02:00
|
|
|
"js/customControlDialog.js",
|
2015-04-18 11:45:57 +02:00
|
|
|
],
|
2015-04-18 13:12:06 +02:00
|
|
|
css=["css/customControls.css"],
|
2015-04-19 21:19:54 +02:00
|
|
|
less=["less/customControls.less"]
|
2015-04-18 13:12:06 +02:00
|
|
|
)
|
2015-04-15 23:41:05 +02:00
|
|
|
|
|
|
|
# If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py
|
|
|
|
# ("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__ = "CustomControl"
|
|
|
|
__plugin_license__ = "AGPLv3"
|
|
|
|
__plugin_implementation__ = CustomControlPlugin()
|