ConfigFile

class lib.config.ini.ConfigFile(plugin_group: str, ini_path: str | None = None)

Bases: object

Handles the interfacing between saved faceswap .ini configs and internal Config objects

Parameters:
  • plugin_group (str) – The plugin group that is requesting a config file

  • ini_path (str | None) – Optional path to a .ini config file. None for default location. Default: None

Methods Summary

format_help(helptext[, is_section])

Format comments for insertion into a config ini file

load()

Load values from the saved config ini file into our Config object

on_load(app_config)

Check whether there has been any change between the current application config and the loaded ini config.

save()

Save a config file

update_from_app(app_config)

Update the config.ini file to those values that are currently in Faceswap's app config

Methods Documentation

format_help(helptext: str, is_section: bool = False) str

Format comments for insertion into a config ini file

Parameters:
  • helptext (str) – The help text to be formatted

  • is_section (bool) – True if the help text pertains to a section. False if it pertains to an option. Default: True

Return type:

The formatted help text

load() None

Load values from the saved config ini file into our Config object

Return type:

None

on_load(app_config: dict[str, ConfigSection]) None

Check whether there has been any change between the current application config and the loaded ini config. If so, update the relevant object(s) appropriately. This check will also create new config.ini files if they do not pre-exist

Parameters:

app_config (dict[str, ConfigSection]) – The latest configuration settings from the application. Section name is key

Return type:

None

save() None

Save a config file

Return type:

None

update_from_app(app_config: dict[str, ConfigSection]) None

Update the config.ini file to those values that are currently in Faceswap’s app config

Parameters:

app_config (dict[str, ConfigSection]) – The latest configuration settings from the application. Section name is key

Return type:

None

format_help(helptext: str, is_section: bool = False) str

Format comments for insertion into a config ini file

Parameters:
  • helptext (str) – The help text to be formatted

  • is_section (bool) – True if the help text pertains to a section. False if it pertains to an option. Default: True

Return type:

The formatted help text

load() None

Load values from the saved config ini file into our Config object

Return type:

None

on_load(app_config: dict[str, ConfigSection]) None

Check whether there has been any change between the current application config and the loaded ini config. If so, update the relevant object(s) appropriately. This check will also create new config.ini files if they do not pre-exist

Parameters:

app_config (dict[str, ConfigSection]) – The latest configuration settings from the application. Section name is key

Return type:

None

save() None

Save a config file

Return type:

None

update_from_app(app_config: dict[str, ConfigSection]) None

Update the config.ini file to those values that are currently in Faceswap’s app config

Parameters:

app_config (dict[str, ConfigSection]) – The latest configuration settings from the application. Section name is key

Return type:

None