From c7e602d34205842eff6680bf0a012bb4ed2494ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Jul 2015 20:21:07 +0200 Subject: [PATCH] Only inject wizard templates if plugin reports they are required --- src/octoprint/server/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 342d415d..7b0e049e 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -12,7 +12,8 @@ from flask import request, g, url_for, make_response, render_template, send_from import octoprint.plugin -from octoprint.server import app, userManager, pluginManager, gettext, debug, LOCALES, VERSION, DISPLAY_VERSION, UI_API_KEY +from octoprint.server import app, userManager, pluginManager, gettext, \ + debug, LOCALES, VERSION, DISPLAY_VERSION, UI_API_KEY from octoprint.settings import settings from . import util @@ -192,10 +193,13 @@ def index(): for implementation in template_plugins: name = implementation._identifier plugin_names.add(name) + wizard_required = False try: vars = implementation.get_template_vars() configs = implementation.get_template_configs() + if isinstance(implementation, octoprint.plugin.WizardPlugin): + wizard_required = implementation.is_wizard_required() except: _logger.exception("Error while retrieving template data for plugin {}, ignoring it".format(name)) continue @@ -210,6 +214,9 @@ def index(): includes = _process_template_configs(name, implementation, configs, template_rules) + if not wizard_required: + includes["wizard"] = list() + for t in template_types: for include in includes[t]: if t == "navbar" or t == "generic":