Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
avoid API break in method signature
  • Loading branch information
3nids committed Jan 17, 2023
1 parent 3ec5b5d commit dd99bb0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/core/additions/qgssettingsentry.py
Expand Up @@ -29,16 +29,18 @@ class PyQgsSettingsEntryEnumFlag
since QGIS 3.20
"""

def __init__(self, key, parent, defaultValue, description=str(), options=Qgis.SettingsOptions()):
def __init__(self, key, pluginName, defaultValue, description=str(), options=Qgis.SettingsOptions()):
"""
Constructor for PyQgsSettingsEntryEnumFlag.
:param key: argument specifies the final part of the settings key.
:param parent: argument is either the plugin name or the settings tree parent element
:param pluginName: argument is either the plugin name or the settings tree parent element
:param defaultValue: argument specifies the default value for the settings entry.
:param description: argument specifies a description for the settings entry.
"""

# TODO QGIS 4: rename pluginName arg to parent

self.options = options
defaultValueStr = str()
self.__metaEnum = metaEnumFromValue(defaultValue)
Expand All @@ -51,8 +53,10 @@ def __init__(self, key, parent, defaultValue, description=str(), options=Qgis.Se
defaultValueStr = self.__metaEnum.valueToKey(defaultValue)
self.__enumFlagClass = defaultValue.__class__

if type(parent) == str:
parent = QgsSettings.createPluginTreeElement(parent)
if type(pluginName) == str:
parent = QgsSettings.createPluginTreeElement(pluginName)
else:
parent = pluginName
super().__init__(key, parent, defaultValueStr, description, options)

def value(self, dynamicKeyPart=None):
Expand Down

0 comments on commit dd99bb0

Please sign in to comment.