Updated for EditorCollectionPlugin
This commit is contained in:
parent
b7179b75a8
commit
c7f67b8fc0
@ -18,6 +18,16 @@ class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
|
||||
controls = []
|
||||
)
|
||||
|
||||
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)
|
||||
]
|
||||
|
||||
def on_settings_save(self, data):
|
||||
s = settings()
|
||||
s.set(["controls"], data["controls"])
|
||||
|
@ -1,6 +1,6 @@
|
||||
<h4>{{ _('Control') }}</h4>
|
||||
|
||||
<div style="min-height:15px; margin: 16px 16px; border:1px solid #00e500" id="base" data-bind="contextMenu: { menuSelector: '#controlContextMenu', menuSelected: $root.controlContextMenu }, visible: loginState.isUser">
|
||||
<div style="min-height:15px; margin: 16px 16px; border:1px solid #00e500" id="base" data-bind="contextMenu: { menuSelector: '#controlContextMenu', menuSelected: $root.controlContextMenu }">
|
||||
</div>
|
||||
|
||||
<!-- "width: 588px" to be the same as teh real Control tab-->
|
||||
@ -46,33 +46,33 @@
|
||||
</ul>
|
||||
|
||||
<!-- Templates for custom controls -->
|
||||
<script type="text/html" id="settingsCustomControls_containerTemplate_nameless">
|
||||
<div class="custom_section" data-bind="contextMenu: { menuSelector: '#containerContextMenu', menuSelected: $root.controlContextMenu }, css: { 'custom_section_vertical_section': name() == '' }, attr: { 'id': id }">
|
||||
<!-- ko template: { name: 'settingsCustomControls_containerTemplate', data: $data } --><!-- /ko -->
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="settingsCustomControls_containerTemplate_collapsable">
|
||||
<div class="custom_section" data-bind="contextMenu: { menuSelector: '#containerContextMenu', menuSelected: $root.controlContextMenu }, css: { 'custom_section_vertical_section': name() == '' }, attr: { 'id': id }">
|
||||
<h1 onclick="$(this).children().first().toggleClass('icon-caret-down icon-caret-right').parent().next().slideToggle('fast')"><i data-bind="css: {'icon-caret-down': !collapsed(), 'icon-caret-right': collapsed()}"></i> <span data-bind="text: name"></span></h1>
|
||||
<!-- ko template: { name: 'settingsCustomControls_containerTemplate', data: $data } --><!-- /ko -->
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="settingsCustomControls_containerTemplate">
|
||||
<!-- ko if: layout() == 'vertical' -->
|
||||
<div class="custom_section_vertical" data-bind="template: { name: $root.displayMode, foreach: children }, css: {hide: collapsed() && name() != '' }"></div>
|
||||
<!-- /ko -->
|
||||
|
||||
<!-- ko if: layout() == 'horizontal' -->
|
||||
<div class="custom_section_horizontal" data-bind="template: { name: $root.displayMode, foreach: children }, css: {hide: collapsed() && name() != '' }"></div>
|
||||
<!-- /ko -->
|
||||
|
||||
<!-- ko if: layout() == 'horizontal_grid' -->
|
||||
<div class="row-fluid custom_section_horizontal_grid" data-bind="css: {hide: collapsed() && name() != ''}">
|
||||
<!-- ko foreach: children -->
|
||||
<div data-bind="template: { name: $root.displayMode }, css: $root.rowCss($data)"></div>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
<script type="text/html" id="settingsCustomControls_containerTemplate_nameless">
|
||||
<div class="custom_section" data-bind="contextMenu: { menuSelector: '#containerContextMenu', menuSelected: $root.controlContextMenu }, css: { 'custom_section_vertical_section': name() == '' }, attr: { 'id': id }">
|
||||
<!-- ko template: { name: 'settingsCustomControls_containerTemplate', data: $data } --><!-- /ko -->
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="settingsCustomControls_containerTemplate_collapsable">
|
||||
<div class="custom_section" data-bind="contextMenu: { menuSelector: '#containerContextMenu', menuSelected: $root.controlContextMenu }, css: { 'custom_section_vertical_section': name() == '' }, attr: { 'id': id }">
|
||||
<h1 onclick="$(this).children().first().toggleClass('icon-caret-down icon-caret-right').parent().next().slideToggle('fast')"><i data-bind="css: {'icon-caret-down': !collapsed(), 'icon-caret-right': collapsed()}"></i> <span data-bind="text: name"></span></h1>
|
||||
<!-- ko template: { name: 'settingsCustomControls_containerTemplate', data: $data } --><!-- /ko -->
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="settingsCustomControls_containerTemplate">
|
||||
<!-- ko if: layout() == 'vertical' -->
|
||||
<div class="custom_section_vertical" data-bind="template: { name: $root.displayMode, foreach: children }, css: {hide: collapsed() && name() != '' }"></div>
|
||||
<!-- /ko -->
|
||||
|
||||
<!-- ko if: layout() == 'horizontal' -->
|
||||
<div class="custom_section_horizontal" data-bind="template: { name: $root.displayMode, foreach: children }, css: {hide: collapsed() && name() != '' }"></div>
|
||||
<!-- /ko -->
|
||||
|
||||
<!-- ko if: layout() == 'horizontal_grid' -->
|
||||
<div class="row-fluid custom_section_horizontal_grid" data-bind="css: {hide: collapsed() && name() != ''}">
|
||||
<!-- ko foreach: children -->
|
||||
<div data-bind="template: { name: $root.displayMode }, css: $root.rowCss($data)"></div>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
<!-- /ko -->
|
||||
</script>
|
||||
<script type="text/html" id="settingsCustomControls_controlTemplate">
|
||||
<form class="form-inline custom_control" style="min-height:15px; border:1px dotted #000000" data-bind="contextMenu: { menuSelector: '#commandContextMenu', menuSelected: $root.controlContextMenu }, attr: { 'id': id }">
|
Loading…
Reference in New Issue
Block a user