Skip to content

Commit

Permalink
[processing] Partial port of Multi Input parameter widget (standard a…
Browse files Browse the repository at this point in the history
…nd batch)
  • Loading branch information
nyalldawson committed Mar 30, 2020
1 parent 8bca818 commit a682405
Show file tree
Hide file tree
Showing 8 changed files with 921 additions and 15 deletions.
Expand Up @@ -72,6 +72,11 @@ Sets a callback function to use when encountering an invalid geometry and
QVariantList selectedOptions() const;
%Docstring
Returns the ordered list of selected options.
%End

QDialogButtonBox *buttonBox();
%Docstring
Returns the widget's button box.
%End

signals:
Expand All @@ -86,6 +91,14 @@ Emitted when the accept button is clicked.
Emitted when the selection changes in the widget.
%End

protected:

void addOption( const QVariant &value, const QString &title, bool selected, bool updateExistingTitle = false );
%Docstring
Adds a new option to the widget.
%End


};


Expand Down Expand Up @@ -157,6 +170,79 @@ Returns the ordered list of selected options.
};


class QgsProcessingMultipleInputPanelWidget : QgsProcessingMultipleSelectionPanelWidget
{
%Docstring
A panel widget for selection of multiple inputs from a fixed list of options.

.. note::

Not stable API

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsprocessingmultipleselectiondialog.h"
%End
public:

QgsProcessingMultipleInputPanelWidget( const QgsProcessingParameterMultipleLayers *parameter,
const QVariantList &selectedOptions = QVariantList(),
QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsProcessingMultipleInputPanelWidget.
%End

void setProject( QgsProject *project );
%Docstring
Sets the project associated with the widget.
%End

};


class QgsProcessingMultipleInputDialog : QDialog
{
%Docstring
A dialog for selection of multiple layer inputs.

.. note::

Not stable API

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsprocessingmultipleselectiondialog.h"
%End
public:

QgsProcessingMultipleInputDialog( const QgsProcessingParameterMultipleLayers *parameter,
const QVariantList &selectedOptions = QVariantList(),
QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = 0 );
%Docstring
Constructor for QgsProcessingMultipleInputDialog.

The ``selectedOptions`` list may contain extra options which are not present in ``availableOptions``,
in which case they will be also added as existing options within the dialog.
%End

QVariantList selectedOptions() const;
%Docstring
Returns the ordered list of selected options.
%End

void setProject( QgsProject *project );
%Docstring
Sets the project associated with the dialog.
%End

};



/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
9 changes: 9 additions & 0 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -1715,6 +1715,14 @@ class BandWidgetWrapper(WidgetWrapper):
NOT_SET = '[Not set]'

def __init__(self, param, dialog, row=0, col=0, **kwargs):
"""
.. deprecated:: 3.14
Do not use, will be removed in QGIS 4.0
"""

from warnings import warn
warn("BandWidgetWrapper is deprecated and will be removed in QGIS 4.0", DeprecationWarning)

super().__init__(param, dialog, row, col, **kwargs)
self.context = dataobjects.createContext()

Expand Down Expand Up @@ -1923,6 +1931,7 @@ def create_wrapper_from_class(param, dialog, row=0, col=0):
# deprecated, moved to c++
wrapper = FeatureSourceWidgetWrapper
elif param.type() == 'band':
# deprecated, moved to c++
wrapper = BandWidgetWrapper
elif param.type() == 'layer':
# deprecated, moved to c++
Expand Down
1 change: 1 addition & 0 deletions src/gui/processing/qgsprocessingguiregistry.cpp
Expand Up @@ -57,6 +57,7 @@ QgsProcessingGuiRegistry::QgsProcessingGuiRegistry()
addParameterWidgetFactory( new QgsProcessingRasterLayerWidgetWrapper() );
addParameterWidgetFactory( new QgsProcessingMeshLayerWidgetWrapper() );
addParameterWidgetFactory( new QgsProcessingBandWidgetWrapper() );
addParameterWidgetFactory( new QgsProcessingMultipleLayerWidgetWrapper() );
}

QgsProcessingGuiRegistry::~QgsProcessingGuiRegistry()
Expand Down

0 comments on commit a682405

Please sign in to comment.