From 6dd66759cd0249a41cc1d0a52b31ddd4ca379b31 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Mon, 25 Apr 2022 10:33:03 +0200 Subject: [PATCH] sipify --- .../core/auto_additions/qgsowsconnection.py | 10 +++ .../geonode/qgsgeonodeconnection.sip.in | 75 ++++++++++--------- .../auto_generated/qgsowsconnection.sip.in | 41 +++++++++- .../settings/qgssettingsentry.sip.in | 75 +++++++++++++++++-- .../settings/qgssettingsentryimpl.sip.in | 1 - .../settings/qgssettingsregistry.sip.in | 11 ++- .../qgsnewhttpconnection.sip.in | 2 +- 7 files changed, 167 insertions(+), 48 deletions(-) create mode 100644 python/core/auto_additions/qgsowsconnection.py diff --git a/python/core/auto_additions/qgsowsconnection.py b/python/core/auto_additions/qgsowsconnection.py new file mode 100644 index 00000000000..34f8ee675a1 --- /dev/null +++ b/python/core/auto_additions/qgsowsconnection.py @@ -0,0 +1,10 @@ +# The following has been generated automatically from src/core/qgsowsconnection.h +# monkey patching scoped based enum +QgsOwsConnection.DpiMode.All.__doc__ = "" +QgsOwsConnection.DpiMode.Off.__doc__ = "" +QgsOwsConnection.DpiMode.QGIS.__doc__ = "" +QgsOwsConnection.DpiMode.UMN.__doc__ = "" +QgsOwsConnection.DpiMode.GeoServer.__doc__ = "" +QgsOwsConnection.DpiMode.__doc__ = 'DpiMode enum\n\n.. versionadded:: 3.26\n\n' + '* ``All``: ' + QgsOwsConnection.DpiMode.All.__doc__ + '\n' + '* ``Off``: ' + QgsOwsConnection.DpiMode.Off.__doc__ + '\n' + '* ``QGIS``: ' + QgsOwsConnection.DpiMode.QGIS.__doc__ + '\n' + '* ``UMN``: ' + QgsOwsConnection.DpiMode.UMN.__doc__ + '\n' + '* ``GeoServer``: ' + QgsOwsConnection.DpiMode.GeoServer.__doc__ +# -- +QgsOwsConnection.DpiMode.baseClass = QgsOwsConnection diff --git a/python/core/auto_generated/geocms/geonode/qgsgeonodeconnection.sip.in b/python/core/auto_generated/geocms/geonode/qgsgeonodeconnection.sip.in index 27e520ed5df..51d751ba5f0 100644 --- a/python/core/auto_generated/geocms/geonode/qgsgeonodeconnection.sip.in +++ b/python/core/auto_generated/geocms/geonode/qgsgeonodeconnection.sip.in @@ -8,6 +8,46 @@ +class QgsGeoNodeConnectionUtils +{ +%Docstring(signature="appended") +Contains various utilities for managing the known collection of +GeoNode servers associated with a QGIS install. + +.. versionadded:: 3.0 +%End + +%TypeHeaderCode +#include "qgsgeonodeconnection.h" +%End + public: + + static QStringList connectionList(); +%Docstring +Returns a list of all known GeoNode connection names. +%End + + static void deleteConnection( const QString &name ); +%Docstring +Deletes the GeoNode connection with matching ``name``. +%End + + static QString pathGeoNodeConnection(); +%Docstring +Returns the base path for settings related to GeoNode connections. +%End + + static QString pathGeoNodeConnectionDetails() /Deprecated/; +%Docstring +Returns the base path for settings related to GeoNode connection details. + +.. deprecated:: QGIS 3.26 + use :py:func:`~QgsGeoNodeConnectionUtils.pathGeonNodeConnection` instead +%End + + static const QString sGeoNodeConnection; +}; + class QgsGeoNodeConnection { %Docstring(signature="appended") @@ -80,41 +120,6 @@ Adds uri parameters relating to the settings for a WCS layer on the connection t }; -class QgsGeoNodeConnectionUtils -{ -%Docstring(signature="appended") -Contains various utilities for managing the known collection of -GeoNode servers associated with a QGIS install. - -.. versionadded:: 3.0 -%End - -%TypeHeaderCode -#include "qgsgeonodeconnection.h" -%End - public: - - static QStringList connectionList(); -%Docstring -Returns a list of all known GeoNode connection names. -%End - - static void deleteConnection( const QString &name ); -%Docstring -Deletes the GeoNode connection with matching ``name``. -%End - - static QString pathGeoNodeConnection(); -%Docstring -Returns the base path for settings related to GeoNode connections. -%End - - static QString pathGeoNodeConnectionDetails(); -%Docstring -Returns the base path for settings related to GeoNode connection details. -%End - -}; /************************************************************************ diff --git a/python/core/auto_generated/qgsowsconnection.sip.in b/python/core/auto_generated/qgsowsconnection.sip.in index 936e311c0e2..da43b44824a 100644 --- a/python/core/auto_generated/qgsowsconnection.sip.in +++ b/python/core/auto_generated/qgsowsconnection.sip.in @@ -21,6 +21,21 @@ Connections management %End public: + enum class DpiMode + { + All, + Off, + QGIS, + UMN, + GeoServer, + }; + + + + + const QgsSettingsEntryGroup settingsServiceConnectionDetailsGroup; + const QgsSettingsEntryGroup settingsServiceConnectionCredentialsGroup; + QgsOwsConnection( const QString &service, const QString &connName ); %Docstring Constructor @@ -55,20 +70,42 @@ Returns a string representing the service type, e.g. "WMS". Returns the connection uri. %End - static QgsDataSourceUri &addWmsWcsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ); + static QgsDataSourceUri &addWmsWcsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ) /Deprecated/; %Docstring Adds uri parameters relating to the settings for a WMS or WCS connection to a :py:class:`QgsDataSourceUri` ``uri``. Connection settings are taken from the specified QSettings ``settingsKey``. .. versionadded:: 3.0 + +.. deprecated:: QGIS 3.26 + use addWmsWcsConnectionSettings with service and connection name parameters %End - static QgsDataSourceUri &addWfsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ); + static QgsDataSourceUri &addWmsWcsConnectionSettings( QgsDataSourceUri &uri, const QString &service, const QString &connName ); +%Docstring +Adds uri parameters relating to the settings for a WMS or WCS connection to a :py:class:`QgsDataSourceUri` ``uri``. +Connection settings are taken from the specified ``servcie`` and ``connName`` + +.. versionadded:: 3.26 +%End + + static QgsDataSourceUri &addWfsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ) /Deprecated/; %Docstring Adds uri parameters relating to the settings for a WFS connection to a :py:class:`QgsDataSourceUri` ``uri``. Connection settings are taken from the specified QSettings ``settingsKey``. .. versionadded:: 3.0 + +.. deprecated:: QGIS 3.26 + use addWfsConnectionSettings with service and connection name parameters +%End + + static QgsDataSourceUri &addWfsConnectionSettings( QgsDataSourceUri &uri, const QString &service, const QString &connName ); +%Docstring +Adds uri parameters relating to the settings for a WFS connection to a :py:class:`QgsDataSourceUri` ``uri``. +Connection settings are taken from the specified ``servcie`` and ``connName`` + +.. versionadded:: 3.26 %End static QStringList connectionList( const QString &service ); diff --git a/python/core/auto_generated/settings/qgssettingsentry.sip.in b/python/core/auto_generated/settings/qgssettingsentry.sip.in index 3bfaf448a4a..423b9f9400f 100644 --- a/python/core/auto_generated/settings/qgssettingsentry.sip.in +++ b/python/core/auto_generated/settings/qgssettingsentry.sip.in @@ -9,6 +9,67 @@ + + +class QgsSettingsEntryGroup +{ +%Docstring(signature="appended") +Creates a group of setting which have a common definition of base key + +.. versionadded:: 3.26 +%End + +%TypeHeaderCode +#include "qgssettingsentry.h" +%End + public: + QgsSettingsEntryGroup( const QList settings ); +%Docstring +Constructor +%End +%MethodCode + sipCpp = new QgsSettingsEntryGroup( *a0, false ); + sipIsErr = sipCpp->isValid() ? 0 : 1; + if ( sipIsErr ) + PyErr_SetString( PyExc_ValueError, QStringLiteral( "Settings do not share the same base definition key for this group. This will lead to unpredictable results." ).toUtf8().constData() ); +%End + + + bool isValid() const; +%Docstring +Returns if the group is valid (if settings share the same base key) +%End + + QString baseKey( const QStringList &dynamicKeyPartList = QStringList() ) const; +%Docstring +Returns the base key for the given ``dynamicKeyPartList`` +%End + + const QList settings() const; +%Docstring +Returns all the settings +%End + + void removeAllSettingsAtBaseKey( const QStringList &dynamicKeyPartList = QStringList() ) const; +%Docstring +Removes all the settings at the base key for the given ``dynamicKeyPartList`` +This means it might remove more settings than the ones registered in the group, use with caution +%End + + void removeAllChildrenSettings( const QString &dynamicKeyPart = QString() ) const; +%Docstring +Removes all the settings from this group +The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key. +%End + + void removeAllChildrenSettings( const QStringList &dynamicKeyPartList ) const; +%Docstring +Removes all the settings from this group +The ``dynamicKeyPartList`` argument specifies the dynamic part of the settings key. +%End + +}; + class QgsSettingsEntryBase { %Docstring(signature="appended") @@ -43,6 +104,13 @@ to validate set values and provide more accurate settings description for the gu %End public: + static QStringList dynamicKeyPartToList( const QString &dynamicKeyPart ); +%Docstring +Transforms a dynamic key part string to list + +.. versionadded:: 3.26 +%End + QgsSettingsEntryBase( const QString &key, const QString §ion, @@ -245,13 +313,6 @@ Returns the current value (or default) if there is no former value. Sets the settings value with a variant value. This should be called from any implementation as it takes care of actually calling QSettings -.. versionadded:: 3.26 -%End - - QStringList dynamicKeyPartToList( const QString &dynamicKeyPart ) const; -%Docstring -Transforms a dynamic key part string to list - .. versionadded:: 3.26 %End diff --git a/python/core/auto_generated/settings/qgssettingsentryimpl.sip.in b/python/core/auto_generated/settings/qgssettingsentryimpl.sip.in index 1d139a6e335..1fd5c4c1b73 100644 --- a/python/core/auto_generated/settings/qgssettingsentryimpl.sip.in +++ b/python/core/auto_generated/settings/qgssettingsentryimpl.sip.in @@ -73,7 +73,6 @@ The ``options`` arguments specifies the options for the settings entry. }; - typedef QgsSettingsEntryByReference QgsSettingsEntryByReferenceQStringBase; class QgsSettingsEntryString : QgsSettingsEntryByReferenceQStringBase diff --git a/python/core/auto_generated/settings/qgssettingsregistry.sip.in b/python/core/auto_generated/settings/qgssettingsregistry.sip.in index 8a9098dc134..6b022887300 100644 --- a/python/core/auto_generated/settings/qgssettingsregistry.sip.in +++ b/python/core/auto_generated/settings/qgssettingsregistry.sip.in @@ -60,9 +60,16 @@ Returns the list of registered child QgsSettingsRegistry. protected: - void addSettingsEntry( const QgsSettingsEntryBase *settingsEntry ); + bool addSettingsEntry( const QgsSettingsEntryBase *settingsEntry ); %Docstring -Add ``settingsEntry`` to the register. +Adds ``settingsEntry`` to the registry. +%End + + void addSettingsEntryGroup( const QgsSettingsEntryGroup *settingsGroup ); +%Docstring +Adds a group of setting to the registry + +.. versionadded:: 3.26 %End }; diff --git a/python/gui/auto_generated/qgsnewhttpconnection.sip.in b/python/gui/auto_generated/qgsnewhttpconnection.sip.in index 10b71e559a2..3e75bc008c2 100644 --- a/python/gui/auto_generated/qgsnewhttpconnection.sip.in +++ b/python/gui/auto_generated/qgsnewhttpconnection.sip.in @@ -43,7 +43,7 @@ information for an HTTP Server for WMS, etc. QgsNewHttpConnection( QWidget *parent /TransferThis/ = 0, QgsNewHttpConnection::ConnectionTypes types = ConnectionWms, - const QString &baseKey = "qgis/connections-wms/", + const QString &serviceName = "WMS", const QString &connectionName = QString(), QgsNewHttpConnection::Flags flags = QgsNewHttpConnection::Flags(), Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );