initial commit, not much is working yet
This commit is contained in:
20
octoprint_switcher/__init__.py
Normal file
20
octoprint_switcher/__init__.py
Normal 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()
|
1
octoprint_switcher/static/css/switcher.css
Normal file
1
octoprint_switcher/static/css/switcher.css
Normal file
@ -0,0 +1 @@
|
||||
/* TODO: Have your plugin's CSS files generated to here. */
|
29
octoprint_switcher/static/js/switcher.js
Normal file
29
octoprint_switcher/static/js/switcher.js
Normal 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: [ /* ... */ ]
|
||||
});
|
||||
});
|
1
octoprint_switcher/static/less/switcher.less
Normal file
1
octoprint_switcher/static/less/switcher.less
Normal file
@ -0,0 +1 @@
|
||||
// TODO: Put your plugin's LESS here, have it generated to ../css.
|
1
octoprint_switcher/templates/README.txt
Normal file
1
octoprint_switcher/templates/README.txt
Normal file
@ -0,0 +1 @@
|
||||
Put your plugin's Jinja2 templates here.
|
1
octoprint_switcher/templates/switcher_navbar.jinja2
Normal file
1
octoprint_switcher/templates/switcher_navbar.jinja2
Normal file
@ -0,0 +1 @@
|
||||
<a href="foo">{{ plugin_switcher_switch0|escape }}</a>
|
8
octoprint_switcher/templates/switcher_settings.jinja2
Normal file
8
octoprint_switcher/templates/switcher_settings.jinja2
Normal 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>
|
3
octoprint_switcher/test.py
Normal file
3
octoprint_switcher/test.py
Normal file
@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
os.system('~/switchcontrol.py getlight')
|
Reference in New Issue
Block a user