feat(Editor): add,change settings

add settings for parsing check on save and fontsize
change directory for configfile to only the path for the configs
This commit is contained in:
thelastWallE 2021-09-05 17:01:03 +02:00
parent 8b6c987640
commit d4abe1da08
4 changed files with 25 additions and 7 deletions

View File

@ -135,9 +135,8 @@ class KlipperPlugin(
),
configuration=dict(
debug_logging=False,
configpath="~/printer.cfg",
configpath="~/",
old_config="",
temp_config="",
logpath="/tmp/klippy.log",
reload_command="RESTART",
shortStatus_navbar=True,
@ -206,7 +205,7 @@ class KlipperPlugin(
)
def get_settings_version(self):
return 3
return 4
#migrate Settings

View File

@ -127,15 +127,15 @@ $(function () {
};
self.loadLastSession = function () {
if (self.settings.settings.plugins.klipper.configuration.temp_config() != "") {
if (self.settings.settings.plugins.klipper.configuration.old_config() != "") {
self.klipperViewModel.consoleMessage(
"info",
"lastSession:" +
self.settings.settings.plugins.klipper.configuration.temp_config()
self.settings.settings.plugins.klipper.configuration.old_config()
);
if (editor.session) {
editor.session.setValue(
self.settings.settings.plugins.klipper.configuration.temp_config()
self.settings.settings.plugins.klipper.configuration.old_config()
);
editor.clearSelection();
}

View File

@ -31,6 +31,13 @@ $(function () {
self.markedForFileRemove = ko.observableArray([]);
self.checkFontsize = function () {
if (settings.settings.plugins.klipper.configuration.fontsize() > 20) {
settings.settings.plugins.klipper.configuration.fontsize(20)
} else if (settings.settings.plugins.klipper.configuration.fontsize()< 9) {
settings.settings.plugins.klipper.configuration.fontsize(9)
}
}
// initialize list helper
self.configs = new ItemListHelper(
"klipperCfgFiles",

View File

@ -39,7 +39,19 @@
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Klipper Config File') }}</label>
<label class="control-label">Editor</label>
<div class="controls">
<label class="checkbox" title="{{ _('Check parsing on save') }}"><input type="checkbox"
data-bind="checked: settings.settings.plugins.klipper.configuration.parse_check" /> {{ _('Check parsing on save') }}
</label>
<label title="{{ _('Fontsize') }}"><input type="text"
class="input-block-level span1" data-bind="value: settings.settings.plugins.klipper.configuration.fontsize,
event: { change: checkFontsize}" /> {{ _('Fontsize') }}
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Klipper Config Directory') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.klipper.configuration.configpath" />
</div>