Esempio n. 1
0
    def _set_config(self,
                    configfile: Optional[str],
                    config: Optional[FaceswapConfig]) -> dict:
        """ Set the correct configuration for the plugin based on whether a config file
        or pre-loaded config has been passed in.

        Parameters
        ----------
        configfile: str
            Location of custom configuration ``ini`` file. If ``None`` then use the
            default config location
        config: :class:`lib.config.FaceswapConfig`
            Pre-loaded :class:`lib.config.FaceswapConfig`. If passed, then this will be
            used over any configuration on disk. If ``None`` then it is ignored.

        Returns
        -------
        dict
            The configuration in dictionary form for the given from
            :attr:`lib.config.FaceswapConfig.config_dict`
        """
        section = ".".join(self.__module__.split(".")[-2:])
        if config is None:
            retval = Config(section, configfile=configfile).config_dict
        else:
            config.section = section
            retval = config.config_dict
            config.section = None
        logger.debug("Config: %s", retval)
        return retval
Esempio n. 2
0
def get_config(plugin_name: str, configfile: Optional[str] = None) -> dict:
    """ Obtain the configuration settings for the writer plugin.

    Parameters
    ----------
    plugin_name: str
        The name of the convert plugin to return configuration settings for
    configfile: str, optional
        The full path to a custom configuration ini file. If ``None`` is passed
        then the file is loaded from the default location. Default: ``None``.

    Returns
    -------
    dict
        The requested configuration dictionary
    """
    return Config(plugin_name, configfile=configfile).config_dict
Esempio n. 3
0
def _get_config(plugin_name, configfile=None):
    """ Return the :attr:`lib.config.FaceswapConfig.config_dict` for the requested plugin.

    Parameters
    ----------
    plugin_name: str
        The name of the plugin to retrieve the config for
    configfile: str, optional
        Optional location of custom configuration ``ini`` file. If ``None`` then use the default
        config location. Default: ``None``

    Returns
    -------
    dict
        The configuration in dictionary form for the given plugin_name from
         :attr:`lib.config.FaceswapConfig.config_dict`
    """
    return Config(plugin_name, configfile=configfile).config_dict
Esempio n. 4
0
def get_config(plugin_name):
    """ Return the config for the requested model """
    return Config(plugin_name).config_dict
Esempio n. 5
0
 def __init__(self):
     self.config = Config(None)
     self.config_dicts = self.get_config_dicts()  # Holds currently saved config
     self.tk_vars = dict()