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