Settings

Central storage of application and user settings

xl.settings.MANAGER

Singleton instance of the SettingsManager

xl.settings.get_option(name, default)
xl.settings.set_option(option, value)

Set an option (in section/key syntax) to the specified value

Parameters:
  • option (string) – the full path to an option
  • value (any) – the value the option should be assigned
class xl.settings.SettingsManager(location=None, default_location=None)

Bases: ConfigParser.RawConfigParser

Manages Exaile’s settings

Sets up the settings manager. Expects a location to a file where settings will be stored. Also sets up periodic saves to disk.

Parameters:
  • location (str or None) – the location to save the settings to, settings will never be stored if this is None
  • default_location – the default location to initialize settings from
get_option(option, default=None)

Get the value of an option (in section/key syntax), returning default if the key does not exist yet

Parameters:
  • option (string) – the full path to an option
  • default (any) – a default value to use as fallback
Returns:

the option value or default

Return type:

any

has_option(option)

Returns information about the existence of a particular option

Parameters:option (string) – the option path
Returns:whether the option exists or not
Return type:bool
remove_option(option)

Removes an option (in section/key syntax), thus will not be saved anymore

Parameters:option (string) – the option path
save()

Save the settings to disk

set_option(option, value)

Set an option (in section/key syntax) to the specified value

Parameters:
  • option (string) – the full path to an option
  • value (any) – the value the option should be assigned