2015-04-15 23:41:05 +02:00
|
|
|
# coding=utf-8
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2015-06-09 11:40:47 +02:00
|
|
|
__author__ = "Marc Hannappel <salandora@gmail.com>"
|
2015-04-15 23:41:05 +02:00
|
|
|
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
|
|
|
|
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 = []
|
|
|
|
)
|
|
|
|
|
2015-06-04 18:41:39 +02:00
|
|
|
def get_template_configs(self):
|
|
|
|
if "editorcollection" in self._plugin_manager.enabled_plugins:
|
|
|
|
return [
|
|
|
|
dict(type="plugin_editorcollection_EditorCollection", template="customControl_hookedsettings.jinja2", custom_bindings=True)
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
return [
|
|
|
|
dict(type="settings", template="customControl_hookedsettings.jinja2", custom_bindings=True)
|
|
|
|
]
|
|
|
|
|
2015-04-18 11:45:57 +02:00
|
|
|
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
|
|
|
|
2015-06-09 11:40:47 +02:00
|
|
|
def get_update_information(self):
|
|
|
|
return dict(
|
|
|
|
systemcommandeditor=dict(
|
|
|
|
displayName="Custom Control Editor Plugin",
|
|
|
|
displayVersion=self._plugin_version,
|
|
|
|
|
|
|
|
# version check: github repository
|
|
|
|
type="github_release",
|
|
|
|
user="Salanddora",
|
|
|
|
repo="octoprint-customControl",
|
|
|
|
current=self._plugin_version,
|
|
|
|
|
|
|
|
# update method: pip
|
|
|
|
pip="https://github.com/Salandora/octoprint-customControl/archive/{target_version}.zip"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
__plugin_name__ = "Custom Control Editor"
|
|
|
|
def __plugin_load__():
|
|
|
|
global __plugin_implementation__
|
|
|
|
__plugin_implementation__ = CustomControlPlugin()
|
|
|
|
|
|
|
|
global __plugin_hooks__
|
|
|
|
__plugin_hooks__ = {
|
|
|
|
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
|
|
|
}
|
|
|
|
|
|
|
|
global __plugin_license__
|
|
|
|
__plugin_license__ = "AGPLv3"
|
|
|
|
|