diff --git a/CHANGELOG.md b/CHANGELOG.md index 795511d0..7a7afa5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index a3258eb0..df71be1e 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -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 diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 786ce971..b560ab81 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -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": { diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index f1c79de6..ed33b1c9 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -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; } diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index dfd96d96..404a293d 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -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; }; diff --git a/src/octoprint/templates/index.jinja2 b/src/octoprint/templates/index.jinja2 index e9d7b9e9..d7b85295 100644 --- a/src/octoprint/templates/index.jinja2 +++ b/src/octoprint/templates/index.jinja2 @@ -38,7 +38,8 @@
-
+ {% if templates.sidebar.order %} +
{% for key in templates.sidebar.order %} {% set entry, data = templates.sidebar.entries[key] %} {% if "custom_bindings" not in data or data["custom_bindings"] %}{% endif %} @@ -67,9 +68,11 @@ {% if "custom_bindings" not in data or data["custom_bindings"] %}{% endif %} {% endfor %}
+ {% endif %} -
+ {% if templates.tab.order %} +
+ {% endif %}