Merge branch 'devel' into dev/customControlsDocs
Conflicts: src/octoprint/static/js/app/viewmodels/control.js
This commit is contained in:
commit
7ed9cc0f87
7 changed files with 70 additions and 18 deletions
|
|
@ -184,6 +184,7 @@
|
|||
* [#719](https://github.com/foosel/OctoPrint/issues/719) - Properly center print bed in GCODE viewer
|
||||
* [#780](https://github.com/foosel/OctoPrint/issues/780) - Always (re)set file position in SD files to 0 so that reprints
|
||||
work correctly (backported from ``devel``)
|
||||
* [#801](https://github.com/foosel/OctoPrint/issues/801) - Fixed setting of bed temperature offset
|
||||
* [IRC] - Don't hiccup on slic3r ``filament_diameter`` comments generated for multi extruder setups
|
||||
* [ML] - Fixed relative URL to SockJS endpoint, wasn't yet using the proper base url
|
||||
* [unreported] & [#698](https://github.com/foosel/OctoPrint/issues/698) - Generated URLs now take X-Forwarded-Host header
|
||||
|
|
|
|||
|
|
@ -278,31 +278,27 @@ def index():
|
|||
else:
|
||||
data = include[1]
|
||||
|
||||
key = "plugin_" + name + data["suffix"] if "suffix" in data else ""
|
||||
suffix = data["suffix"] if "suffix" in data else ""
|
||||
key = "plugin_" + name + suffix
|
||||
if "replaces" in data:
|
||||
key = data["replaces"]
|
||||
templates[t]["entries"][key] = include
|
||||
|
||||
#~~ order internal templates and plugins
|
||||
|
||||
templates["navbar"]["order"] = ["settings", "systemmenu", "login"]
|
||||
templates["sidebar"]["order"] = ["connection", "state", "files"]
|
||||
templates["tab"]["order"] = ["temperature", "control", "gcodeviewer", "terminal", "timelapse"]
|
||||
templates["settings"]["order"] = [
|
||||
"section_printer", "serial", "printerprofiles", "temperatures", "terminalfilters", "gcodescripts",
|
||||
"section_features", "features", "webcam", "accesscontrol", "api",
|
||||
"section_octoprint", "folders", "appearance", "logs"
|
||||
]
|
||||
|
||||
# make sure that
|
||||
# 1) we only have keys in our ordered list that we have entries for and
|
||||
# 2) we have all entries located somewhere within the order
|
||||
|
||||
for t in ("navbar", "sidebar", "tab", "settings", "generic"):
|
||||
templates[t]["order"] = [x for x in templates[t]["order"] if x in templates[t]["entries"]]
|
||||
all_ordered = set(templates[t]["order"])
|
||||
configured_order = settings().get(["appearance", "components", "order", t], merged=True)
|
||||
configured_disabled = settings().get(["appearance", "components", "disabled", t])
|
||||
templates[t]["order"] = [x for x in configured_order if x in templates[t]["entries"] and not x in configured_disabled]
|
||||
|
||||
missing_in_order = set(templates[t]["entries"].keys()).difference(all_ordered)
|
||||
all_ordered = set(templates[t]["order"])
|
||||
all_disabled = set(configured_disabled)
|
||||
|
||||
missing_in_order = set(templates[t]["entries"].keys()).difference(all_ordered).difference(all_disabled)
|
||||
if len(missing_in_order) == 0:
|
||||
continue
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,27 @@ default_settings = {
|
|||
"appearance": {
|
||||
"name": "",
|
||||
"color": "default",
|
||||
"colorTransparent": False
|
||||
"colorTransparent": False,
|
||||
"components": {
|
||||
"order": {
|
||||
"navbar": ["settings", "systemmenu", "login"],
|
||||
"sidebar": ["connection", "state", "files"],
|
||||
"tab": ["temperature", "control", "gcodeviewer", "terminal", "timelapse"],
|
||||
"settings": [
|
||||
"section_printer", "serial", "printerprofiles", "temperatures", "terminalfilters", "gcodescripts",
|
||||
"section_features", "features", "webcam", "accesscontrol", "api",
|
||||
"section_octoprint", "folders", "appearance", "logs"
|
||||
],
|
||||
"generic": []
|
||||
},
|
||||
"disabled": {
|
||||
"navbar": [],
|
||||
"sidebar": [],
|
||||
"tab": [],
|
||||
"settings": [],
|
||||
"generic": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"controls": [],
|
||||
"system": {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,22 @@ $(function() {
|
|||
return new viewModelClass(constructorParameters);
|
||||
};
|
||||
|
||||
// map any additional view model bindings we might need to make
|
||||
var additionalBindings = {};
|
||||
_.each(OCTOPRINT_ADDITIONAL_BINDINGS, function(bindings) {
|
||||
var viewModelId = bindings[0];
|
||||
var viewModelBindTargets = bindings[1];
|
||||
if (!_.isArray(viewModelBindTargets)) {
|
||||
viewModelBindTargets = [viewModelBindTargets];
|
||||
}
|
||||
|
||||
if (!additionalBindings.hasOwnProperty(viewModelId)) {
|
||||
additionalBindings[viewModelId] = viewModelBindTargets;
|
||||
} else {
|
||||
additionalBindings[viewModelId] = additionalBindings[viewModelId].concat(viewModelBindTargets);
|
||||
}
|
||||
});
|
||||
|
||||
// helper for translating the name of a view model class into an identifier for the view model map
|
||||
var _getViewModelId = function(viewModel){
|
||||
var name = viewModel[0].name;
|
||||
|
|
@ -129,8 +145,16 @@ $(function() {
|
|||
}
|
||||
|
||||
// we could resolve the depdendencies and the view model is not defined yet => add it, it's now fully processed
|
||||
var viewModelBindTarget = viewModel[2];
|
||||
allViewModelData.push([viewModelInstance, viewModelBindTarget]);
|
||||
var viewModelBindTargets = viewModel[2];
|
||||
if (!_.isArray(viewModelBindTargets)) {
|
||||
viewModelBindTargets = [viewModelBindTargets];
|
||||
}
|
||||
|
||||
if (additionalBindings.hasOwnProperty(viewModelId)) {
|
||||
viewModelBindTargets = viewModelBindTargets.concat(additionalBindings[viewModelId]);
|
||||
}
|
||||
|
||||
allViewModelData.push([viewModelInstance, viewModelBindTargets]);
|
||||
allViewModels.push(viewModelInstance);
|
||||
viewModelMap[viewModelId] = viewModelInstance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,6 +141,11 @@ $(function() {
|
|||
control.input[i].slider = false;
|
||||
}
|
||||
}
|
||||
} else if (control.type == "feedback_command" || control.type == "feedback") {
|
||||
control.output = ko.observable("");
|
||||
self.feedbackControlLookup[control.name] = control.output;
|
||||
} else if (control.type == "section" || control.type == "row" || control.type == "section_row") {
|
||||
control.children = self._processControls(control.children);
|
||||
}
|
||||
|
||||
var js;
|
||||
|
|
@ -166,6 +171,7 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
control.processed = true;
|
||||
return control;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@
|
|||
<div class="container octoprint-container">
|
||||
<div class="row">
|
||||
<!-- Sidebar -->
|
||||
<div class="accordion span4">
|
||||
{% if templates.sidebar.order %}
|
||||
<div class="accordion {% if templates.tab.order %}span4{% else %}span12{% endif %}">
|
||||
{% for key in templates.sidebar.order %}
|
||||
{% set entry, data = templates.sidebar.entries[key] %}
|
||||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
|
|
@ -67,9 +68,11 @@
|
|||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- /ko -->{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Tabs -->
|
||||
<div class="span8 tabbable">
|
||||
{% if templates.tab.order %}
|
||||
<div class="tabbable {% if templates.sidebar.order %}span8{% else %}span12{% endif %}">
|
||||
<ul class="nav nav-tabs" id="tabs">
|
||||
{% for key in templates.tab.order %}
|
||||
{% set entry, data = templates.tab.entries[key] %}
|
||||
|
|
@ -100,6 +103,7 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<ul class="pull-left muted">
|
||||
|
|
|
|||
|
|
@ -28,4 +28,5 @@
|
|||
|
||||
var OCTOPRINT_VIEWMODELS = [];
|
||||
var ADDITIONAL_VIEWMODELS = [];
|
||||
var OCTOPRINT_ADDITIONAL_BINDINGS = [];
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue