settings

This class contains the core default settings.

class openlp.core.common.settings.Settings(*args)[source]

Bases: PyQt5.QtCore.QSettings

Class to wrap QSettings.

  • Exposes all the methods of QSettings.
  • Adds functionality for OpenLP Portable. If the defaultFormat is set to IniFormat, and the path to the Ini file is set using set_filename, then the Settings constructor (without any arguments) will create a Settings object for accessing settings stored in that Ini file.
__default_settings__
This dict contains all core settings with their default values.
__obsolete_settings__

Each entry is structured in the following way:

('general/enable slide loop', 'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)])

The first entry is the old key; it will be removed.

The second entry is the new key; we will add it to the config. If this is just an empty string, we just remove the old key. The last entry is a list containing two-pair tuples. If the list is empty, no conversion is made. If the first value is callable i.e. a function, the function will be called with the old setting’s value. Otherwise each pair describes how to convert the old setting’s value:

(SlideLimits.Wrap, True)

This means, that if the value of general/enable slide loop is equal (==) True then we set advanced/slide limits to SlideLimits.Wrap. NOTE, this means that the rules have to cover all cases! So, if the type of the old value is bool, then there must be two rules.

static extend_default_settings(default_values)[source]

Static method to merge the given default_values with the Settings.__default_settings__.

Parameters:default_values – A dict with setting keys and their default values.
get_default_value(key)[source]

Get the default value of the given key

get_files_from_config(plugin)[source]

This removes the settings needed for old way we saved files (e. g. the image paths for the image plugin). A list of file paths are returned.

Note: Only a list of paths is returned; this does not convert anything!

param plugin:The Plugin object.The caller has to convert/save the list himself; o
remove_obsolete_settings()[source]

This method is only called to clean up the config. It removes old settings and it renames settings. See __obsolete_settings__ for more details.

static set_filename(ini_file)[source]

Sets the complete path to an Ini file to be used by Settings objects.

Does not affect existing Settings objects.

static set_up_default_values()[source]

This static method is called on start up. It is used to perform any operation on the __default_settings__ dict.

value(key)[source]

Returns the value for the given key. The returned value is of the same type as the default value in the Settings.__default_settings__ dict.

Parameters:key – The key to return the value from.
openlp.core.common.settings.media_players_conv(string)[source]

If phonon is in the setting string replace it with system :param string: String to convert :return: Converted string

openlp.core.common.settings.recent_files_conv(value)[source]

If the value is not a list convert it to a list :param value: Value to convert :return: value as a List