def handle_plugin_loaded(name, plugin): if plugin.instance and hasattr(plugin.instance, "__plugin_settings_overlay__"): plugin.needs_restart = True # plugin has a settings overlay, inject it overlay_definition = getattr(plugin.instance, "__plugin_settings_overlay__") if isinstance(overlay_definition, (tuple, list)): overlay_definition, order = overlay_definition else: order = None overlay = settings.load_overlay(overlay_definition) if "plugins" in overlay and "_disabled" in overlay["plugins"]: disabled_plugins = overlay["plugins"]["_disabled"] del overlay["plugins"]["_disabled"] disabled_from_overlays[name] = (disabled_plugins, order) settings_overlays[name] = overlay logger.debug("Found settings overlay on plugin {}".format(name))
def handle_plugin_loaded(name, plugin): if hasattr(plugin.instance, "__plugin_settings_overlay__"): plugin.needs_restart = True # plugin has a settings overlay, inject it overlay_definition = getattr(plugin.instance, "__plugin_settings_overlay__") if isinstance(overlay_definition, (tuple, list)): overlay_definition, order = overlay_definition else: order = None overlay = settings.load_overlay(overlay_definition) if "plugins" in overlay and "_disabled" in overlay["plugins"]: disabled_plugins = overlay["plugins"]["_disabled"] del overlay["plugins"]["_disabled"] disabled_from_overlays[name] = (disabled_plugins, order) settings_overlays[name] = overlay logger.debug("Found settings overlay on plugin {}".format(name))