Only inject wizard templates if plugin reports they are required

This commit is contained in:
Gina Häußge 2015-07-14 20:21:07 +02:00
parent 03c2439efe
commit c7e602d342

View file

@ -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":