parent
0190bf3b8d
commit
bc6302e967
|
@ -8,10 +8,17 @@ end_of_line = lf
|
|||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
max_line_length = 90
|
||||
|
||||
[**.py]
|
||||
indent_style = tab
|
||||
indent_size = 3
|
||||
|
||||
[**.js]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
[**.yaml]
|
||||
indent_size = 2
|
||||
|
||||
[/static/less/**.less]
|
||||
indent_size = 2
|
||||
|
||||
[**.jinja2]
|
||||
indent_size = 3
|
||||
|
|
|
@ -9,3 +9,4 @@ dist
|
|||
*.zip
|
||||
|
||||
*.bak
|
||||
.vscode
|
||||
|
|
|
@ -59,7 +59,7 @@ class KlipperPlugin(
|
|||
"description": gettext("Allows to config klipper"),
|
||||
"default_groups": [ADMIN_GROUP],
|
||||
"dangerous": True,
|
||||
"roles": ["admin"],
|
||||
"roles": ["admin"]
|
||||
},
|
||||
{
|
||||
"key": "MACRO",
|
||||
|
@ -67,7 +67,7 @@ class KlipperPlugin(
|
|||
"description": gettext("Allows to use klipper macros"),
|
||||
"default_groups": [ADMIN_GROUP],
|
||||
"dangerous": True,
|
||||
"roles": ["admin"],
|
||||
"roles": ["admin"]
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -118,6 +118,20 @@ class KlipperPlugin(
|
|||
)
|
||||
return data
|
||||
|
||||
def reloadConfigfile(self):
|
||||
data = octoprint.plugin.SettingsPlugin.on_settings_load(self)
|
||||
|
||||
filepath = os.path.expanduser(
|
||||
self._settings.get(["configuration", "configpath"]))
|
||||
try:
|
||||
f = open(filepath, "r", encoding="utf-8")
|
||||
data["config"] = f.read()
|
||||
f.close()
|
||||
except IOError:
|
||||
self._logger.error(
|
||||
"Error: Klipper config file not found at: {}".format(filepath))
|
||||
return data
|
||||
|
||||
def on_settings_save(self, data):
|
||||
if "config" in data:
|
||||
try:
|
||||
|
@ -396,4 +410,3 @@ def __plugin_load__():
|
|||
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.on_parse_gcode,
|
||||
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
#level .add-on {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#level .controls {
|
||||
padding: 1px;
|
||||
}
|
||||
|
@ -80,7 +76,7 @@ ul#klipper-settings {
|
|||
#tab_plugin_klipper_main .span4 {
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
max-width: 13%;
|
||||
/* max-width: 13%; */
|
||||
float: left;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
@ -109,11 +105,13 @@ ul#klipper-settings {
|
|||
}
|
||||
|
||||
#macros #item.control-group {
|
||||
margin-bottom: 5px;
|
||||
border: 1px solid #ddd;
|
||||
margin-bottom: 2px;
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 3px;
|
||||
background-color: #eeeeef;
|
||||
background-color: #eeeeee;
|
||||
color: #333;
|
||||
padding-bottom: 2px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
#klipper_graph_dialog form {
|
||||
|
|
|
@ -31,7 +31,7 @@ $(function () {
|
|||
dialog.modal({
|
||||
show: "true",
|
||||
backdrop: "static",
|
||||
keyboard: false,
|
||||
keyboard: false
|
||||
});
|
||||
self.levelingViewModel.initView();
|
||||
};
|
||||
|
@ -41,7 +41,7 @@ $(function () {
|
|||
dialog.modal({
|
||||
show: "true",
|
||||
backdrop: "static",
|
||||
keyboard: false,
|
||||
keyboard: false
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ $(function () {
|
|||
var dialog = $("#klipper_offset_dialog");
|
||||
dialog.modal({
|
||||
show: "true",
|
||||
backdrop: "static",
|
||||
backdrop: "static"
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -58,7 +58,7 @@ $(function () {
|
|||
dialog.modal({
|
||||
show: "true",
|
||||
minHeight: "500px",
|
||||
maxHeight: "600px",
|
||||
maxHeight: "600px"
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -79,7 +79,7 @@ $(function () {
|
|||
var dialog = $("#klipper_macro_dialog");
|
||||
dialog.modal({
|
||||
show: "true",
|
||||
backdrop: "static",
|
||||
backdrop: "static"
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -124,7 +124,7 @@ $(function () {
|
|||
self.logMessages.push({
|
||||
time: timestamp,
|
||||
type: type,
|
||||
msg: message.replace(/\n/gi, "<br>"),
|
||||
msg: message.replace(/\n/gi, "<br>")
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -137,9 +137,7 @@ $(function () {
|
|||
};
|
||||
|
||||
self.hasRight = function (right_role, type) {
|
||||
var arg = eval(
|
||||
"self.access.permissions.PLUGIN_KLIPPER_" + right_role
|
||||
);
|
||||
var arg = eval("self.access.permissions.PLUGIN_KLIPPER_" + right_role);
|
||||
|
||||
if (type == "Ko") {
|
||||
return self.loginState.hasPermissionKo(arg);
|
||||
|
@ -155,9 +153,7 @@ $(function () {
|
|||
$("li#settings_plugin_klipper_link a").click();
|
||||
if (profile_type) {
|
||||
var query =
|
||||
"#klipper-settings a[data-profile-type='" +
|
||||
profile_type +
|
||||
"']";
|
||||
"#klipper-settings a[data-profile-type='" + profile_type + "']";
|
||||
$(query).click();
|
||||
}
|
||||
};
|
||||
|
@ -171,12 +167,12 @@ $(function () {
|
|||
"connectionViewModel",
|
||||
"klipperLevelingViewModel",
|
||||
"klipperMacroDialogViewModel",
|
||||
"accessViewModel",
|
||||
"accessViewModel"
|
||||
],
|
||||
elements: [
|
||||
"#tab_plugin_klipper_main",
|
||||
"#sidebar_plugin_klipper",
|
||||
"#navbar_plugin_klipper",
|
||||
],
|
||||
"#navbar_plugin_klipper"
|
||||
]
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#tab_plugin_klipper iframe {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
border: 1px solid #808080;
|
||||
}
|
|
@ -7,11 +7,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="control-group" data-bind="visible: hasRight('MACRO', 'Ko')">
|
||||
<div class="controls">
|
||||
<button class="btn btn-block" data-bind="visible: loginState.hasPermissionKo(access.permissions.PLUGIN_KLIPPER_CONFIG), click: function() {openOctoKlipperSettings('klipper-config');}">{{ _('Open Klipper config') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="control-label small"><i class="icon-list-alt"></i> {{ _('Macros') }}</label>
|
||||
<div data-bind="foreach: settings.settings.plugins.klipper.macros">
|
||||
|
|
Loading…
Reference in New Issue