Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE][processing] New modeler parameter widget
A new widget which handles parameter values for child algorithms within a model. Instead of the previous approach of requiring individual widget wrappers to handle creation of a suitable model widget, we do all this automatically for them. This widget uses a stacked widget with a toolbutton to select the parameter's source, instead of the previous combo box approach (which didn't scale well for large models). I.e. users select first whether the value is taken from a static value, a model input, or an output from a different child algorithm. The widget then changes appearance and behavior based on this choice. Additionally, a new option is present for all parameters of using a "precalculated expression". This expression is evaluated once before the child algorithm is executed and used during the execution of that algorithm.
- Loading branch information
1 parent
644ef6a
commit a717b85
Showing
21 changed files
with
1,157 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
python/gui/auto_generated/processing/qgsprocessinggui.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessinggui.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsProcessingGui | ||
{ | ||
%Docstring | ||
|
||
Contains general functions and values related to Processing GUI components. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprocessinggui.h" | ||
%End | ||
public: | ||
|
||
enum WidgetType | ||
{ | ||
Standard, | ||
Batch, | ||
Modeler, | ||
}; | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessinggui.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
python/gui/auto_generated/processing/qgsprocessingmodelerwidget.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessingmodelerwidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
class QgsProcessingModelerParameterWidget : QWidget | ||
{ | ||
%Docstring | ||
|
||
A widget for customising the value of Processing algorithm parameter inside | ||
a Processing model. | ||
|
||
The widget provides choice of the linked source for values for the parameter | ||
inside the model. E.g. parameters can be a static value, an evaluated | ||
expression results, the output from another child algorithm, or an input | ||
parameter for the model itself. | ||
|
||
Individual modeler parameter widgets are not usually created directly, instead they are | ||
constructed through the central registry, via calls to | ||
QgsGui.processingGuiRegistry()->createModelerParameterWidget(). | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprocessingmodelerwidget.h" | ||
%End | ||
public: | ||
|
||
QgsProcessingModelerParameterWidget( QgsProcessingModelAlgorithm *model, | ||
const QString &childId, | ||
const QgsProcessingParameterDefinition *parameter, | ||
const QgsProcessingContext &context, | ||
QWidget *parent /TransferThis/ = 0 ); | ||
%Docstring | ||
Constructor for QgsProcessingModelerParameterWidget, for the specified | ||
``parameter`` definition within the given ``model``. | ||
|
||
The ID of the child algorithm within the model must be specified via the ``childId`` | ||
argument. This value corresponds to the :py:func:`QgsProcessingModelChildAlgorithm.childId()` | ||
string, which uniquely identifies which child algorithm the parameter is associated | ||
with inside the given ``model``. | ||
|
||
A Processing ``context`` must also be specified, which allows the widget | ||
to resolve parameter values which are context dependent. The context must | ||
last for the lifetime of the widget. | ||
%End | ||
|
||
~QgsProcessingModelerParameterWidget(); | ||
|
||
void populateSources( const QStringList &compatibleParameterTypes, | ||
const QStringList &compatibleOutputTypes, | ||
const QList< int > &compatibleDataTypes ); | ||
%Docstring | ||
Populates the widget with available sources for the parameter's value, e.g. | ||
adding the available child algorithm outputs and model input parameter | ||
choices. | ||
|
||
In order to determine the available source, the ``compatibleParameterTypes``, | ||
``compatibleOutputTypes`` arguments are used. These lists correspond to the | ||
various available values for QgsProcessingParameterDefinition.type() (for | ||
``compatibleParameterTypes``) and the values for :py:func:`QgsProcessingOutputDefinition.type()` | ||
(for ``compatibleOutputTypes``). | ||
|
||
The ``compatibleDataTypes`` list corresponds to the compatible data types | ||
from QgsProcessing.SourceType. | ||
%End | ||
|
||
const QgsProcessingParameterDefinition *parameterDefinition() const; | ||
%Docstring | ||
Returns the parameter definition associated with this wrapper. | ||
%End | ||
|
||
QLabel *createLabel() /Factory/; | ||
%Docstring | ||
Creates a label for use identifying the associated parameter. | ||
|
||
The caller takes ownership of the returned value. | ||
%End | ||
|
||
virtual void setWidgetValue( const QgsProcessingModelChildParameterSource &value ); | ||
%Docstring | ||
Sets the current ``value`` for the parameter. | ||
|
||
.. seealso:: :py:func:`value` | ||
%End | ||
|
||
virtual QgsProcessingModelChildParameterSource value() const; | ||
%Docstring | ||
Returns the current value of the parameter. | ||
|
||
.. seealso:: :py:func:`setWidgetValue` | ||
%End | ||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessingmodelerwidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.