          self.configs = self.scan_for_plugin_configs()
          self.build()
          logger.debug("Initialized %s", self.__class__.__name__)
  
      def scan_for_plugin_configs(self):
          """ Scan for config.ini file locations """
          global _CONFIGS, _CONFIG_FILES  # pylint:disable=global-statement
          root_path = os.path.abspath(os.path.dirname(sys.argv[0]))
          plugins_path = os.path.join(root_path, "plugins")
          logger.debug("Scanning path: '%s'", plugins_path)
          configs = dict()
          for dirpath, _, filenames in os.walk(plugins_path):
              if "_config.py" in filenames:
                  plugin_type = os.path.split(dirpath)[-1]
                  config = self.load_config(plugin_type)
                  configs[plugin_type] = config
          logger.debug("Configs loaded: %s", sorted(list(configs.keys())))
          keys = list(configs.keys())
          for key in ("extract", "train", "convert"):
              if key in keys:
                  _CONFIG_FILES.append(keys.pop(keys.index(key)))
          _CONFIG_FILES.extend([key for key in sorted(keys)])
          _CONFIGS = configs
          return configs
  
      @staticmethod
      def load_config(plugin_type):
          """ Load the config to generate config file if it doesn't exist and get filename """
          # Load config to generate default if doesn't exist
          mod = ".".join(("plugins", plugin_type, "_config"))
          module = import_module(mod)
          config = module.Config(None)
          logger.debug("Found '%s' config at '%s'", plugin_type, config.configfile)
          return config
  
      def build(self):
          """ Add the settings menu to the menu bar """
          # pylint: disable=cell-var-from-loop
          logger.debug("Building settings menu")
          for name in _CONFIG_FILES:
 
</s> remove     Parameters
    ----------
    name: str
        The name of the configuration file. Used for the pop-up title bar.
    configuration: :class:`~lib.config.FaceswapConfig`
        The configuration options for the requested pop-up window
    """
    logger.debug("name: %s, configuration: %s", name, configuration)
    if POPUP:
        p_key = list(POPUP.keys())[0]
        logger.debug("Closing open popup: '%s'", p_key)
        POPUP[p_key].destroy()
        del POPUP[p_key]
    window = _ConfigurePlugins(name, configuration)
    POPUP[name] = window
    logger.debug("Current pop-up: %s", POPUP)
 </s> add     def open_popup(self, name=None):
        """ Launch the popup, ensuring only one instance is ever open

        Parameters
        ----------
        name: str, Optional
            The name of the configuration file. Used for selecting the correct section if required.
            Set to ``None`` if no initial section should be selected. Default: ``None``
        """
        if not self._configs:
            self._scan_for_configs()
        logger.debug("name: %s", name)
        if self._popup is not None:
            logger.info("Popup already open. Returning: %s", _POPUP)
            return
        self._popup = _ConfigurePlugins(name, self._configs)

    def close_popup(self):
        """ Destroy the open popup and remove it from tracking. """
        if self._popup is None:
            logger.info("No popup to close. Returning")
            return
        self._popup.destroy()
        del self._popup
        self._popup = None

    def _scan_for_configs(self):
        """ Scan the plugin folders for configuration settings. Add in the GUI configuration also.

        Populates the attribute :attr:`_configs`.
        """
        root_path = os.path.abspath(os.path.dirname(sys.argv[0]))
        plugins_path = os.path.join(root_path, "plugins")
        logger.debug("Scanning path: '%s'", plugins_path)
        for dirpath, _, filenames in os.walk(plugins_path):
            if "_config.py" in filenames:
                plugin_type = os.path.split(dirpath)[-1]
                config = self._load_config(plugin_type)
                self._configs[plugin_type] = config
        self._configs["gui"] = get_config().user_config
        logger.debug("Configs loaded: %s", sorted(list(self._configs.keys())))

    @classmethod
    def _load_config(cls, plugin_type):
        """ Load the config from disk. If the file doesn't exist, then it will be generated.

        Parameters
        ----------
        plugin_type: str
            The plugin type (i.e. extract, train convert) that the config should be loaded for

        Returns
        -------
        :class:`lib.config.FaceswapConfig`
            The Configuration for the selected plugin
        """
        # Load config to generate default if doesn't exist
        mod = ".".join(("plugins", plugin_type, "_config"))
        module = import_module(mod)
        config = module.Config(None)
        logger.debug("Found '%s' config at '%s'", plugin_type, config.configfile)
        return config


_STATE = _State()
open_popup = _STATE.open_popup </s> remove         for name in _CONFIG_FILES:
            label = "Configure {} Plugins...".format(name.title())
            config = self.configs[name]
            self.add_command(
                label=label,
                underline=10,
                command=lambda n=name, c=config: popup_config(n, c))
        self.add_separator()
        conf = get_config().user_config
        self.add_command(
            label="GUI Settings...",
            underline=10,
            command=lambda n="GUI", c=conf: popup_config(n, c))
 </s> add         self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup) </s> remove         self.configs = self.scan_for_plugin_configs()
 </s> add  </s> remove         for name in _CONFIG_FILES:
            config = _CONFIGS[name]
 </s> add         for name in ("extract", "train", "convert"): </s> remove         options = {".".join((key, sect)) if sect != key else key: opts
                   for key, value in self._config_cpanel_dict.items()
                   for sect, opts in value.items()}
 </s> add         selection = self._tree.focus()
        category = selection.split("|")[0]
        config = self._configs[category]
        # Create a new config to pull through any defaults change
          self.configs = self.scan_for_plugin_configs()
          self.build()
          logger.debug("Initialized %s", self.__class__.__name__)
  































      def build(self):
          """ Add the settings menu to the menu bar """
          # pylint: disable=cell-var-from-loop
          logger.debug("Building settings menu")
          for name in _CONFIG_FILES:
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 GUI: Consolidate settings to single menu 
lib/gui/menu.py