initial commit, not much is working yet

This commit is contained in:
koksnuss
2019-10-24 00:09:33 +02:00
commit ca9cf55756
18 changed files with 348 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# coding=utf-8
from __future__ import absolute_import
import octoprint.plugin
class OctoSwitcherPlugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.SettingsPlugin):
def on_after_startup(self):
self._logger.info("Switcher settings: %s" % self._settings.get(["switch0"]))
def get_settings_defaults(self):
return dict(switch0='light')
def get_template_vars(self):
return dict(switch0=self._settings.get(["switch0"]))
__plugin_name__ = 'Switcher'
__plugin_implementation__ = OctoSwitcherPlugin()

View File

@ -0,0 +1 @@
/* TODO: Have your plugin's CSS files generated to here. */

View File

@ -0,0 +1,29 @@
/*
* View model for OctoPrint-Switcher
*
* Author: Moritz Münch
* License: AGPLv3
*/
$(function() {
function SwitcherViewModel(parameters) {
var self = this;
// assign the injected parameters, e.g.:
// self.loginStateViewModel = parameters[0];
// self.settingsViewModel = parameters[1];
// TODO: Implement your plugin's view model here.
}
/* view model class, parameters for constructor, container to bind to
* Please see http://docs.octoprint.org/en/master/plugins/viewmodels.html#registering-custom-viewmodels for more details
* and a full list of the available options.
*/
OCTOPRINT_VIEWMODELS.push({
construct: SwitcherViewModel,
// ViewModels your plugin depends on, e.g. loginStateViewModel, settingsViewModel, ...
dependencies: [ /* "loginStateViewModel", "settingsViewModel" */ ],
// Elements to bind to, e.g. #settings_plugin_switcher, #tab_plugin_switcher, ...
elements: [ /* ... */ ]
});
});

View File

@ -0,0 +1 @@
// TODO: Put your plugin's LESS here, have it generated to ../css.

View File

@ -0,0 +1 @@
Put your plugin's Jinja2 templates here.

View File

@ -0,0 +1 @@
<a href="foo">{{ plugin_switcher_switch0|escape }}</a>

View File

@ -0,0 +1,8 @@
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">{{ _('Switch 0') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.plugins.switcher.switch0">
</div>
</div>
</form>

View File

@ -0,0 +1,3 @@
import os
os.system('~/switchcontrol.py getlight')