Skip to content
Permalink
Browse files
Can't monkey patch from core into gui classes
  • Loading branch information
nyalldawson committed Jul 12, 2021
1 parent d0beaae commit d44412ddb8adb11ad541ccee533ab9954e5b669a
@@ -414,20 +414,11 @@
Qgis.FilePathType.__doc__ = 'File path types.\n\n.. versionadded:: 3.22\n\n' + '* ``Absolute``: ' + Qgis.FilePathType.Absolute.__doc__ + '\n' + '* ``Relative``: ' + Qgis.FilePathType.Relative.__doc__
# --
Qgis.FilePathType.baseClass = Qgis
QgsSublayersDialog.PromptMode = Qgis.SublayerPromptMode
# monkey patching scoped based enum
QgsSublayersDialog.PromptAlways = Qgis.SublayerPromptMode.AlwaysAsk
QgsSublayersDialog.PromptAlways.is_monkey_patched = True
QgsSublayersDialog.PromptAlways.__doc__ = "Always ask users to select from available sublayers, if sublayers are present"
QgsSublayersDialog.PromptIfNeeded = Qgis.SublayerPromptMode.AskExcludingRasterBands
QgsSublayersDialog.PromptIfNeeded.is_monkey_patched = True
QgsSublayersDialog.PromptIfNeeded.__doc__ = "Ask users to select from available sublayers, unless only raster bands are present"
QgsSublayersDialog.PromptNever = Qgis.SublayerPromptMode.NeverAskSkip
QgsSublayersDialog.PromptNever.is_monkey_patched = True
QgsSublayersDialog.PromptNever.__doc__ = "Never ask users to select sublayers, instead don't load anything"
QgsSublayersDialog.PromptLoadAll = Qgis.SublayerPromptMode.NeverAskLoadAll
QgsSublayersDialog.PromptLoadAll.is_monkey_patched = True
QgsSublayersDialog.PromptLoadAll.__doc__ = "Never ask users to select sublayers, instead automatically load all available sublayers"
Qgis.SublayerPromptMode.__doc__ = 'Specifies how to handle layer sources with multiple sublayers.\n\n.. versionadded:: 3.22\n\n' + '* ``PromptAlways``: ' + Qgis.SublayerPromptMode.AlwaysAsk.__doc__ + '\n' + '* ``PromptIfNeeded``: ' + Qgis.SublayerPromptMode.AskExcludingRasterBands.__doc__ + '\n' + '* ``PromptNever``: ' + Qgis.SublayerPromptMode.NeverAskSkip.__doc__ + '\n' + '* ``PromptLoadAll``: ' + Qgis.SublayerPromptMode.NeverAskLoadAll.__doc__
Qgis.SublayerPromptMode.AlwaysAsk.__doc__ = "Always ask users to select from available sublayers, if sublayers are present"
Qgis.SublayerPromptMode.AskExcludingRasterBands.__doc__ = "Ask users to select from available sublayers, unless only raster bands are present"
Qgis.SublayerPromptMode.NeverAskSkip.__doc__ = "Never ask users to select sublayers, instead don't load anything"
Qgis.SublayerPromptMode.NeverAskLoadAll.__doc__ = "Never ask users to select sublayers, instead automatically load all available sublayers"
Qgis.SublayerPromptMode.__doc__ = 'Specifies how to handle layer sources with multiple sublayers.\n\n.. versionadded:: 3.22\n\n' + '* ``AlwaysAsk``: ' + Qgis.SublayerPromptMode.AlwaysAsk.__doc__ + '\n' + '* ``AskExcludingRasterBands``: ' + Qgis.SublayerPromptMode.AskExcludingRasterBands.__doc__ + '\n' + '* ``NeverAskSkip``: ' + Qgis.SublayerPromptMode.NeverAskSkip.__doc__ + '\n' + '* ``NeverAskLoadAll``: ' + Qgis.SublayerPromptMode.NeverAskLoadAll.__doc__
# --
Qgis.SublayerPromptMode.baseClass = Qgis
@@ -311,7 +311,7 @@ The development version
};

enum class SublayerPromptMode
{
{
AlwaysAsk,
AskExcludingRasterBands,
NeverAskSkip,
@@ -21,6 +21,36 @@ class QgsSublayersDialog : QDialog
%End
public:

enum PromptMode
%Docstring
Prompt behavior of the QgsSublayersDialog

.. deprecated::
Use Qgis.SublayerPromptMode instead
%End
{

PromptAlways,
%Docstring
always ask if there are existing sublayers
%End

PromptIfNeeded,
%Docstring
always ask if there are existing sublayers, but skip if there are bands for rasters
%End

PromptNever,
%Docstring
never prompt, will not load anything
%End

PromptLoadAll
%Docstring
never prompt, but load all sublayers
%End
};

enum ProviderType
{
Ogr,
@@ -468,12 +468,12 @@ class CORE_EXPORT Qgis
*
* \since QGIS 3.22
*/
enum class SublayerPromptMode SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsSublayersDialog, PromptMode ) : int
{
AlwaysAsk SIP_MONKEYPATCH_COMPAT_NAME( PromptAlways ), //!< Always ask users to select from available sublayers, if sublayers are present
AskExcludingRasterBands SIP_MONKEYPATCH_COMPAT_NAME( PromptIfNeeded ), //!< Ask users to select from available sublayers, unless only raster bands are present
NeverAskSkip SIP_MONKEYPATCH_COMPAT_NAME( PromptNever ), //!< Never ask users to select sublayers, instead don't load anything
NeverAskLoadAll SIP_MONKEYPATCH_COMPAT_NAME( PromptLoadAll ), //!< Never ask users to select sublayers, instead automatically load all available sublayers
enum class SublayerPromptMode : int
{
AlwaysAsk, //!< Always ask users to select from available sublayers, if sublayers are present
AskExcludingRasterBands, //!< Ask users to select from available sublayers, unless only raster bands are present
NeverAskSkip, //!< Never ask users to select sublayers, instead don't load anything
NeverAskLoadAll, //!< Never ask users to select sublayers, instead automatically load all available sublayers
};
Q_ENUM( SublayerPromptMode )

@@ -32,6 +32,35 @@ class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDi
Q_OBJECT
public:

/**
* Prompt behavior of the QgsSublayersDialog
* \deprecated Use Qgis::SublayerPromptMode instead
*/
Q_DECL_DEPRECATED enum PromptMode
{

/**
* always ask if there are existing sublayers
*/
PromptAlways,

/**
* always ask if there are existing sublayers, but skip if there are bands for rasters
*/
PromptIfNeeded,

/**
* never prompt, will not load anything
*/
PromptNever,

/**
* never prompt, but load all sublayers
*/
PromptLoadAll
};
Q_ENUM( PromptMode )

enum ProviderType
{
Ogr,

0 comments on commit d44412d

Please sign in to comment.