      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:
              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))
          logger.debug("Built settings menu")
  
  
  class FileMenu(tk.Menu):  # pylint:disable=too-many-ancestors
      """ File menu items and functions """
 
</s> remove     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

 </s> add  </s> remove                 command=lambda n=name, c=config: popup_config(n, c))
 </s> add                 command=lambda n=name: open_popup(name=n)) </s> remove def popup_config(name, configuration):
    """ Open the settings for the requested configuration file and close any already active
    pop-ups.
 </s> add class _State():
    """ Holds the existing config files and the current state of the popup window. """
    def __init__(self):
        self._popup = None
        # The GUI Config cannot be scanned until GUI is launched, so this is populated
        # on the first call to load the settings
        self._configs = dict() </s> remove POPUP = dict()
 </s> add _POPUP = []
_CONFIG_FILES = []
_CONFIGS = dict() </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
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
      def build(self):
          """ Add the settings menu to the menu bar """
          # pylint: disable=cell-var-from-loop
          logger.debug("Building settings menu")
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
        self.add_command(label="Configure Settings...",
                         underline=0,
                         command=open_popup)
          logger.debug("Built settings menu")
  
  
  class FileMenu(tk.Menu):  # pylint:disable=too-many-ancestors
      """ File menu items and functions """
keep keep keep keep 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