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 toIniFormat
, and the path to the Ini file is set usingset_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 setadvanced/slide limits
toSlideLimits.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 theSettings.__default_settings__
.Parameters: default_values – A dict with setting keys and their default values.
-
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.