Config

class npc.BaseConfig(plugin)

Base class for plugin configuration

This class is used to define the configuration of a plugin. It automatically generates the settings and metasettings for the plugin given the fields defined as class attributes.

Parameters:

plugin (npc.BasePlugin) – The plugin instance that the configuration is attached to.

model_plugin

The plugin instance that the configuration is attached to.

Type:

npc.BasePlugin

__getattribute__(name)

Get the value of a setting or the attribute

__setattr__(name, value)

Set the value of a setting or the attribute

This will automatically persist the changes to the Nicotine+ global configuration.

model_settings()

Convert the model to settings

Returns:

The settings dict generated from the model.

Return type:

npc.types.Settings

model_metasettings()

Convert the model to metasettings

Returns:

The metasettings dict generated from the model.

Return type:

npc.types.MetaSettings

apply()

Persist the changes to the Nicotine+ global configuration

Warning

You must call this method to persist the changes to the global configuration.

Returns:

The names of the settings that were changed.

Return type:

list of str