add option to hide 'Open editor' button

This commit is contained in:
thelastWallE 2021-11-21 00:46:07 +01:00
parent ad0e8917dc
commit 0dd82e408f
3 changed files with 13 additions and 3 deletions

View File

@ -110,7 +110,8 @@ class KlipperPlugin(
return dict( return dict(
connection=dict( connection=dict(
port="/tmp/printer", port="/tmp/printer",
replace_connection_panel=True replace_connection_panel=True,
hide_editor_button=False
), ),
macros=[dict( macros=[dict(
name="E-Stop", name="E-Stop",

View File

@ -21,6 +21,13 @@
data-bind="checked: settings.settings.plugins.klipper.connection.replace_connection_panel"> data-bind="checked: settings.settings.plugins.klipper.connection.replace_connection_panel">
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label">{{ _('Hide \'Open Editor\' Button\nin the Connection Panel') }}</label>
<div class="controls">
<input class="controls-checkbox" title="{{ _('Hide \'Open Editor\' Button\nin the Connection Panel') }}" type="checkbox"
data-bind="checked: settings.settings.plugins.klipper.connection.hide_editor_button">
</div>
</div>
<div class="control-group border"> <div class="control-group border">
<label class="control-label">{{ _('Show Short Messages') }}</label> <label class="control-label">{{ _('Show Short Messages') }}</label>
<div class="controls"> <div class="controls">

View File

@ -3,8 +3,10 @@
<label for="connection_printers" data-bind="css: {disabled: !connectionState.isErrorOrClosed()}, enable: connectionState.isErrorOrClosed() && loginState.isUser()">{{ _('Printer Profile') }}</label> <label for="connection_printers" data-bind="css: {disabled: !connectionState.isErrorOrClosed()}, enable: connectionState.isErrorOrClosed() && loginState.isUser()">{{ _('Printer Profile') }}</label>
<select id="connection_printers" data-bind="options: connectionState.printerOptions, optionsText: 'name', optionsValue: 'id', value: connectionState.selectedPrinter, css: {disabled: !connectionState.isErrorOrClosed()}, enable: connectionState.isErrorOrClosed() && loginState.isUser()"></select> <select id="connection_printers" data-bind="options: connectionState.printerOptions, optionsText: 'name', optionsValue: 'id', value: connectionState.selectedPrinter, css: {disabled: !connectionState.isErrorOrClosed()}, enable: connectionState.isErrorOrClosed() && loginState.isUser()"></select>
<button class="btn btn-block" data-bind="click: connectionState.connect, text: connectionState.buttonText(), enable: loginState.isUser()">{{ _('Connect') }}</button> <button class="btn btn-block" data-bind="click: connectionState.connect, text: connectionState.buttonText(), enable: loginState.isUser()">{{ _('Connect') }}</button>
<button class="btn btn-block" title="{{ _('Open Editor') }}" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.PLUGIN_KLIPPER_CONFIG), click: showEditorDialog">{{ _('Open Editor') }}</button> <!-- ko ifnot: settings.settings.plugins.klipper.connection.hide_editor_button -->
</div> <button class="btn btn-block" title="{{ _('Open Editor') }}" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.PLUGIN_KLIPPER_CONFIG), click: showEditorDialog">{{ _('Open Editor') }}</button>
<!-- /ko -->
</div>
</div> </div>
<!-- ko if: settings.settings.plugins.klipper.configuration.shortStatus_sidebar --> <!-- ko if: settings.settings.plugins.klipper.configuration.shortStatus_sidebar -->
<div id="shortStatus_SideBar" class="plugin-klipper-sidebar"> <div id="shortStatus_SideBar" class="plugin-klipper-sidebar">