Skip to content

Commit

Permalink
follow-up rename QgsSettingsTreeElement to QgsSettingsTreeNode
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and nyalldawson committed Jan 30, 2023
1 parent 994da50 commit 7d62899
Show file tree
Hide file tree
Showing 24 changed files with 233 additions and 234 deletions.
2 changes: 1 addition & 1 deletion python/core/additions/qgssettingsentry.py
Expand Up @@ -54,7 +54,7 @@ def __init__(self, key, pluginName, defaultValue, description=str(), options=Qgi
self.__enumFlagClass = defaultValue.__class__

if type(pluginName) == str:
parent = QgsSettings.createPluginTreeElement(pluginName)
parent = QgsSettings.createPluginTreeNode(pluginName)
else:
parent = pluginName
super().__init__(key, parent, defaultValueStr, description, options)
Expand Down
8 changes: 4 additions & 4 deletions python/core/auto_additions/qgssettingstreenode.py
@@ -1,14 +1,14 @@
# The following has been generated automatically from src/core/settings/qgssettingstreenode.h
# monkey patching scoped based enum
QgsSettingsTreeNode.Type.Root.__doc__ = "Root Element"
QgsSettingsTreeNode.Type.Standard.__doc__ = "Normal Element"
QgsSettingsTreeNode.Type.Root.__doc__ = "Root Node"
QgsSettingsTreeNode.Type.Standard.__doc__ = "Normal Node"
QgsSettingsTreeNode.Type.NamedList.__doc__ = ""
QgsSettingsTreeNode.Type.__doc__ = 'Type of tree element\n\n' + '* ``Root``: ' + QgsSettingsTreeNode.Type.Root.__doc__ + '\n' + '* ``Standard``: ' + QgsSettingsTreeNode.Type.Standard.__doc__ + '\n' + '* ``NamedList``: ' + QgsSettingsTreeNode.Type.NamedList.__doc__
QgsSettingsTreeNode.Type.__doc__ = 'Type of tree node\n\n' + '* ``Root``: ' + QgsSettingsTreeNode.Type.Root.__doc__ + '\n' + '* ``Standard``: ' + QgsSettingsTreeNode.Type.Standard.__doc__ + '\n' + '* ``NamedList``: ' + QgsSettingsTreeNode.Type.NamedList.__doc__
# --
QgsSettingsTreeNode.Type.baseClass = QgsSettingsTreeNode
# monkey patching scoped based enum
QgsSettingsTreeNode.Option.NamedListSelectedItemSetting.__doc__ = "Creates a setting to store which is the current item"
QgsSettingsTreeNode.Option.__doc__ = 'Options for named list elements\n\n' + '* ``NamedListSelectedItemSetting``: ' + QgsSettingsTreeNode.Option.NamedListSelectedItemSetting.__doc__
QgsSettingsTreeNode.Option.__doc__ = 'Options for named list nodes\n\n' + '* ``NamedListSelectedItemSetting``: ' + QgsSettingsTreeNode.Option.NamedListSelectedItemSetting.__doc__
# --
QgsSettingsTreeNode.Option.baseClass = QgsSettingsTreeNode
QgsSettingsTreeNode.Options.baseClass = QgsSettingsTreeNode
Expand Down
8 changes: 4 additions & 4 deletions python/core/auto_generated/settings/qgssettings.sip.in
Expand Up @@ -66,17 +66,17 @@ static bool setGlobalSettingsPath( QString path );
};


static QgsSettingsTreeNode *createPluginTreeElement( const QString &pluginName );
static QgsSettingsTreeNode *createPluginTreeNode( const QString &pluginName );
%Docstring
Creates a settings tree element for the given ``pluginName``
Creates a settings tree node for the given ``pluginName``

.. versionadded:: 3.30
%End


static void unregisterPluginTreeElement( const QString &pluginName );
static void unregisterPluginTreeNode( const QString &pluginName );
%Docstring
Unregisters the tree element for the given plugin
Unregisters the tree node for the given plugin

.. versionadded:: 3.30
%End
Expand Down
16 changes: 8 additions & 8 deletions python/core/auto_generated/settings/qgssettingsentryimpl.sip.in
Expand Up @@ -81,7 +81,7 @@ This constructor is intended to be used from plugins.
:param options: specifies the options for the settings entry.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryVariant( QgsSettingsEntryVariant( *a0, QgsSettings::createPluginTreeElement( *a1 ), *a2, *a3, *a4 ) );
sipCpp = new sipQgsSettingsEntryVariant( QgsSettingsEntryVariant( *a0, QgsSettings::createPluginTreeNode( *a1 ), *a2, *a3, *a4 ) );
%End


Expand Down Expand Up @@ -188,7 +188,7 @@ This constructor is intended to be used from plugins.
:param options: specifies the options for the settings entry.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryString( QgsSettingsEntryString( *a0, QgsSettings::createPluginTreeElement( *a1 ), *a2, *a3, *a4 ) );
sipCpp = new sipQgsSettingsEntryString( QgsSettingsEntryString( *a0, QgsSettings::createPluginTreeNode( *a1 ), *a2, *a3, *a4 ) );
%End

virtual Qgis::SettingsType settingsType() const;
Expand Down Expand Up @@ -279,7 +279,7 @@ This constructor is intended to be used from plugins.
:param options: specifies the options for the settings entry.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryStringList( QgsSettingsEntryStringList( *a0, QgsSettings::createPluginTreeElement( *a1 ), *a2, *a3, *a4 ) );
sipCpp = new sipQgsSettingsEntryStringList( QgsSettingsEntryStringList( *a0, QgsSettings::createPluginTreeNode( *a1 ), *a2, *a3, *a4 ) );
%End

virtual Qgis::SettingsType settingsType() const;
Expand Down Expand Up @@ -357,7 +357,7 @@ This constructor is intended to be used from plugins.
:param options: specifies the options for the settings entry.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryBool( QgsSettingsEntryBool( *a0, QgsSettings::createPluginTreeElement( *a1 ), a2, *a3, *a4 ) );
sipCpp = new sipQgsSettingsEntryBool( QgsSettingsEntryBool( *a0, QgsSettings::createPluginTreeNode( *a1 ), a2, *a3, *a4 ) );
%End


Expand Down Expand Up @@ -448,7 +448,7 @@ This constructor is intended to be used from plugins.
:param maxValue: specifies the maximal value.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryInteger( QgsSettingsEntryInteger( *a0, QgsSettings::createPluginTreeElement( *a1 ), a2, *a3, *a4, a5, a6 ) );
sipCpp = new sipQgsSettingsEntryInteger( QgsSettingsEntryInteger( *a0, QgsSettings::createPluginTreeNode( *a1 ), a2, *a3, *a4, a5, a6 ) );
%End

virtual Qgis::SettingsType settingsType() const;
Expand Down Expand Up @@ -558,7 +558,7 @@ This constructor is intended to be used from plugins.
:param displayDecimals: specifies a hint for the gui about how much decimals to show
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryDouble( QgsSettingsEntryDouble( *a0, QgsSettings::createPluginTreeElement( *a1 ), a2, *a3, *a4, a5, a6, a7 ) );
sipCpp = new sipQgsSettingsEntryDouble( QgsSettingsEntryDouble( *a0, QgsSettings::createPluginTreeNode( *a1 ), a2, *a3, *a4, a5, a6, a7 ) );
%End


Expand Down Expand Up @@ -667,7 +667,7 @@ This constructor is intended to be used from plugins.
:param options: specifies the options for the settings entry.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryColor( QgsSettingsEntryColor( *a0, QgsSettings::createPluginTreeElement( *a1 ), *a2, *a3, *a4, a5 ) );
sipCpp = new sipQgsSettingsEntryColor( QgsSettingsEntryColor( *a0, QgsSettings::createPluginTreeNode( *a1 ), *a2, *a3, *a4, a5 ) );
%End

virtual Qgis::SettingsType settingsType() const;
Expand Down Expand Up @@ -757,7 +757,7 @@ This constructor is intended to be used from plugins.
:param options: specifies the options for the settings entry.
%End
%MethodCode
sipCpp = new sipQgsSettingsEntryVariantMap( QgsSettingsEntryVariantMap( *a0, QgsSettings::createPluginTreeElement( *a1 ), *a2, *a3, *a4 ) );
sipCpp = new sipQgsSettingsEntryVariantMap( QgsSettingsEntryVariantMap( *a0, QgsSettings::createPluginTreeNode( *a1 ), *a2, *a3, *a4 ) );
%End

virtual Qgis::SettingsType settingsType() const;
Expand Down
Expand Up @@ -61,15 +61,15 @@ to automatically register a settings entry on its creation when a parent is prov
virtual ~QgsSettingsTreeNode();


QgsSettingsTreeNode *createChildElement( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
QgsSettingsTreeNode *createChildNode( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
%Docstring
Creates a normal tree element
It will return the existing child element if it exists at the given key

:raises QgsSettingsException: if a setting exists with the same key
%End

QgsSettingsTreeNamedListNode *createNamedListElement( const QString &key, const QgsSettingsTreeNode::Options &options = QgsSettingsTreeNode::Options() ) throw( QgsSettingsException ) /KeepReference/;
QgsSettingsTreeNamedListNode *createNamedListNode( const QString &key, const QgsSettingsTreeNode::Options &options = QgsSettingsTreeNode::Options() ) throw( QgsSettingsException ) /KeepReference/;
%Docstring
Creates a named list tree element.
This is useful to register groups of settings for several named items (for instance credentials for several named services)
Expand Down Expand Up @@ -177,7 +177,7 @@ Registers a child elements

This is not available in Python bindings. Use method createElement on an existing tree element.

.. seealso:: :py:func:`QgsSettings.createPluginTreeElement`
.. seealso:: :py:func:`QgsSettings.createPluginTreeNode`
%End
QgsSettingsTreeNode( const QgsSettingsTreeNode &other );
};
Expand Down Expand Up @@ -272,9 +272,9 @@ Init the elements with the specific ``options``

.. note::

This is not available in Python bindings. Use method createNamedListElement on an existing tree element.
This is not available in Python bindings. Use method createNamedListNode on an existing tree element.

.. seealso:: :py:func:`QgsSettings.createPluginTreeElement`
.. seealso:: :py:func:`QgsSettings.createPluginTreeNode`
%End
QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other );
};
Expand Down
64 changes: 32 additions & 32 deletions python/core/auto_generated/settings/qgssettingstreenode.sip.in
Expand Up @@ -14,11 +14,11 @@
class QgsSettingsTreeNode
{
%Docstring(signature="appended")
:py:class:`QgsSettingsTreeNode` is a tree element for the settings registry
:py:class:`QgsSettingsTreeNode` is a tree node for the settings registry
to help organizing and introspecting the registry.
It is either a root element, a normal element or
It is either a root node, a normal node or
a named list (to store a group of settings under a dynamic named key).
The root element holds a pointer to a registry (might be null)
The root node holds a pointer to a registry (might be null)
to automatically register a settings entry on its creation when a parent is provided.

.. seealso:: :py:class:`QgsSettingsEntryBase`
Expand Down Expand Up @@ -61,24 +61,24 @@ to automatically register a settings entry on its creation when a parent is prov
virtual ~QgsSettingsTreeNode();


QgsSettingsTreeNode *createChildElement( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
QgsSettingsTreeNode *createChildNode( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
%Docstring
Creates a normal tree element
It will return the existing child element if it exists at the given key
Creates a normal tree node
It will return the existing child node if it exists at the given key

:raises QgsSettingsException: if a setting exists with the same key
%End

QgsSettingsTreeNamedListNode *createNamedListElement( const QString &key, const QgsSettingsTreeNode::Options &options = QgsSettingsTreeNode::Options() ) throw( QgsSettingsException ) /KeepReference/;
QgsSettingsTreeNamedListNode *createNamedListNode( const QString &key, const QgsSettingsTreeNode::Options &options = QgsSettingsTreeNode::Options() ) throw( QgsSettingsException ) /KeepReference/;
%Docstring
Creates a named list tree element.
Creates a named list tree node.
This is useful to register groups of settings for several named items (for instance credentials for several named services)
%End


Type type() const;
%Docstring
Returns the type of element
Returns the type of node
%End

void registerChildSetting( const QgsSettingsEntryBase *setting, const QString &key ) throw( QgsSettingsException );
Expand Down Expand Up @@ -108,19 +108,19 @@ Unregisters the child setting
:param parentsNamedItems: the list of named items in the parent named list (if any)
%End

void unregisterChildElement( QgsSettingsTreeNode *element );
void unregisterChildNode( QgsSettingsTreeNode *node );
%Docstring
Unregisters the child tree ``element``
Unregisters the child tree ``node``
%End

QList<QgsSettingsTreeNode *> childrenElements() const;
QList<QgsSettingsTreeNode *> childrenNodes() const;
%Docstring
Returns the children elements
Returns the children nodes
%End

QgsSettingsTreeNode *childElement( const QString &key );
QgsSettingsTreeNode *childNode( const QString &key );
%Docstring
Returns the existing child element if it exists at the given ``key``
Returns the existing child node if it exists at the given ``key``
%End

QList<const QgsSettingsEntryBase *> childrenSettings() const;
Expand All @@ -135,22 +135,22 @@ Returns the existing child settings if it exists at the given ``key``

QgsSettingsTreeNode *parent() const;
%Docstring
Returns the parent of the element or None if it does not exists
Returns the parent of the node or None if it does not exists
%End

QString key() const;
%Docstring
Returns the key of the element (without its parents)
Returns the key of the node (without its parents)
%End

QString completeKey() const;
%Docstring
Returns the complete key of the element (including its parents)
Returns the complete key of the node (including its parents)
%End

int namedElementsCount() const;
int namedNodesCount() const;
%Docstring
Returns the number of named elements in the complete key
Returns the number of named nodes in the complete key
%End

SIP_PYOBJECT __repr__();
Expand All @@ -162,9 +162,9 @@ Returns the number of named elements in the complete key
%End

protected:
void registerChildElement( QgsSettingsTreeNode *element );
void registerChildNode( QgsSettingsTreeNode *node );
%Docstring
Registers a child elements
Registers a child nodes
%End


Expand All @@ -175,9 +175,9 @@ Registers a child elements

.. note::

This is not available in Python bindings. Use method createElement on an existing tree element.
This is not available in Python bindings. Use method createNode on an existing tree node.

.. seealso:: :py:func:`QgsSettings.createPluginTreeElement`
.. seealso:: :py:func:`QgsSettings.createPluginTreeNode`
%End
QgsSettingsTreeNode( const QgsSettingsTreeNode &other );
};
Expand All @@ -187,9 +187,9 @@ Registers a child elements
class QgsSettingsTreeNamedListNode : QgsSettingsTreeNode
{
%Docstring(signature="appended")
:py:class:`QgsSettingsTreeNamedListNode` is a named list tree element for the settings registry
:py:class:`QgsSettingsTreeNamedListNode` is a named list tree node for the settings registry
to help organizing and introspecting the registry.
the named list element is used to store a group of settings under a dynamically named key.
the named list node is used to store a group of settings under a dynamically named key.

.. seealso:: :py:class:`QgsSettingsTreeNode`

Expand Down Expand Up @@ -228,7 +228,7 @@ Returns the list of items

void setSelectedItem( const QString &item, const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
%Docstring
Sets the selected named item from the named list element
Sets the selected named item from the named list node

:param item: the item to set as selected
:param parentsNamedItems: the list of named items in the parent named list (if any)
Expand All @@ -238,7 +238,7 @@ Sets the selected named item from the named list element

QString selectedItem( const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
%Docstring
Returns the selected named item from the named list element
Returns the selected named item from the named list node

:param parentsNamedItems: the list of named items in the parent named list (if any)

Expand All @@ -247,7 +247,7 @@ Returns the selected named item from the named list element

void deleteItem( const QString &item, const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
%Docstring
Deletes a named item from the named list element
Deletes a named item from the named list node

:param item: the item to delete
:param parentsNamedItems: the list of named items in the parent named list (if any)
Expand All @@ -263,7 +263,7 @@ Returns the setting used to store the selected item
protected:
void initNamedList( const QgsSettingsTreeNode::Options &options );
%Docstring
Init the elements with the specific ``options``
Init the nodes with the specific ``options``
%End

private:
Expand All @@ -272,9 +272,9 @@ Init the elements with the specific ``options``

.. note::

This is not available in Python bindings. Use method createNamedListElement on an existing tree element.
This is not available in Python bindings. Use method createNamedListNode on an existing tree node.

.. seealso:: :py:func:`QgsSettings.createPluginTreeElement`
.. seealso:: :py:func:`QgsSettings.createPluginTreeNode`
%End
QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other );
};
Expand Down
2 changes: 1 addition & 1 deletion python/pyplugin_installer/installer.py
Expand Up @@ -578,7 +578,7 @@ def installFromZipFile(self, filePath):
if not os.path.isfile(filePath):
return

QgsSettings.createPluginTreeElement("_plugin_manager").childSetting("last-zip-directory").setValue(QFileInfo(filePath).absoluteDir().absolutePath())
QgsSettings.createPluginTreeNode("_plugin_manager").childSetting("last-zip-directory").setValue(QFileInfo(filePath).absoluteDir().absolutePath())

pluginName = None
with zipfile.ZipFile(filePath, 'r') as zf:
Expand Down

0 comments on commit 7d62899

Please sign in to comment.