forked from openlp/openlp
changed variable names
This commit is contained in:
parent
49d61c2e59
commit
52830ee6ee
@ -204,14 +204,14 @@ class Settings(QtCore.QSettings):
|
|||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extend_default_settings(defaultValues):
|
def extend_default_settings(default_values):
|
||||||
"""
|
"""
|
||||||
Static method to merge the given ``defaultValues`` with the ``Settings.__default_settings__``.
|
Static method to merge the given ``default_values`` with the ``Settings.__default_settings__``.
|
||||||
|
|
||||||
``defaultValues``
|
``default_values``
|
||||||
A dict with setting keys and their default values.
|
A dict with setting keys and their default values.
|
||||||
"""
|
"""
|
||||||
Settings.__default_settings__ = dict(defaultValues.items() + Settings.__default_settings__.items())
|
Settings.__default_settings__ = dict(default_values.items() + Settings.__default_settings__.items())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def setFilename(iniFile):
|
def setFilename(iniFile):
|
||||||
@ -241,13 +241,13 @@ class Settings(QtCore.QSettings):
|
|||||||
try:
|
try:
|
||||||
# if group() is empty the group has been specified together with the key.
|
# if group() is empty the group has been specified together with the key.
|
||||||
if self.group():
|
if self.group():
|
||||||
defaultValue = Settings.__default_settings__[self.group() + u'/' + key]
|
default_value = Settings.__default_settings__[self.group() + u'/' + key]
|
||||||
else:
|
else:
|
||||||
defaultValue = Settings.__default_settings__[key]
|
default_value = Settings.__default_settings__[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print u'KeyError: %s' % key
|
print u'KeyError: %s' % key
|
||||||
return None
|
return None
|
||||||
setting = super(Settings, self).value(key, defaultValue)
|
setting = super(Settings, self).value(key, default_value)
|
||||||
# On OS X (and probably on other platforms too) empty value from QSettings is represented as type
|
# On OS X (and probably on other platforms too) empty value from QSettings is represented as type
|
||||||
# PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type.
|
# PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type.
|
||||||
if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
|
if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
|
||||||
@ -256,18 +256,18 @@ class Settings(QtCore.QSettings):
|
|||||||
if setting is None:
|
if setting is None:
|
||||||
# An empty string saved to the settings results in a None type being returned.
|
# An empty string saved to the settings results in a None type being returned.
|
||||||
# Convert it to empty unicode string.
|
# Convert it to empty unicode string.
|
||||||
if isinstance(defaultValue, unicode):
|
if isinstance(default_value, unicode):
|
||||||
return u''
|
return u''
|
||||||
# An empty list saved to the settings results in a None type being returned.
|
# An empty list saved to the settings results in a None type being returned.
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
# Convert the setting to the correct type.
|
# Convert the setting to the correct type.
|
||||||
if isinstance(defaultValue, bool):
|
if isinstance(default_value, bool):
|
||||||
if isinstance(setting, bool):
|
if isinstance(setting, bool):
|
||||||
return setting
|
return setting
|
||||||
# Sometimes setting is string instead of a boolean.
|
# Sometimes setting is string instead of a boolean.
|
||||||
return setting == u'true'
|
return setting == u'true'
|
||||||
if isinstance(defaultValue, int):
|
if isinstance(default_value, int):
|
||||||
return int(setting)
|
return int(setting)
|
||||||
return setting
|
return setting
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user