Class: QgsProcessingParameterWidgetFactoryInterface¶
An interface for Processing widget wrapper factories.
Widget wrapper factories allow creation of
QgsAbstractProcessingParameterWidgetWrapper
objects. They
are centrally managed by QgsProcessingGuiRegistry
. Usually,
individual factories are not directly utilized, rather the
QgsGui.processingGuiRegistry()
->:py:func:createParameterWidgetWrapper() <qgis.gui.QgsProcessingParameterWidgetFactoryInterface.createParameterWidgetWrapper>
method is used to create widget wrappers.
Added in version 3.4.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: createWidgetWrapper()
, parameterType()
Abstract Methods
Creates a new widget wrapper for the specified parameter definition. |
|
Returns the type string for the parameter type the factory is associated with. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsProcessingParameterWidgetFactoryInterface. See the FAQ for more details.
Returns a list of compatible Processing data types for inputs for this widget for the specified parameter. |
|
Returns a list of compatible Processing output types for inputs for this parameter. |
|
Returns a list of compatible Processing parameter types for inputs for this parameter. |
|
Creates a new modeler parameter widget for the given parameter. |
|
Creates a new parameter definition widget allowing for configuration of an instance of the parameter type handled by this factory. |
|
Returns the default source type to use for the widget for the specified parameter. |
|
Returns the expected expression format string for expression results for the parameter within model child algorithms. |
- class qgis.gui.QgsProcessingParameterWidgetFactoryInterface[source]¶
Bases:
object
- virtual compatibleDataTypes(self, parameter: QgsProcessingParameterDefinition | None) List[int] ¶
Returns a list of compatible Processing data types for inputs for this widget for the specified
parameter
.In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values from
QgsProcessing
.SourceType.Subclasses should return a list of all
QgsProcessing
.SourceType values which can be used as values for the parameter.See also
See also
- Parameters:
parameter (Optional[QgsProcessingParameterDefinition])
- Return type:
List[int]
- virtual compatibleOutputTypes(self) List[str] [source]¶
Returns a list of compatible Processing output types for inputs for this parameter.
In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values for
QgsProcessingOutputDefinition.type()
.Subclasses should return a list of all
QgsProcessingOutputDefinition.type()
values which can be used as values for the parameter.See also
See also
- Return type:
List[str]
- virtual compatibleParameterTypes(self) List[str] [source]¶
Returns a list of compatible Processing parameter types for inputs for this parameter.
In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values for
QgsProcessingParameterDefinition.type()
.Subclasses should return a list of all
QgsProcessingParameterDefinition.type()
values which can be used as input values for the parameter.See also
See also
- Return type:
List[str]
- virtual createModelerWidgetWrapper(self, model: QgsProcessingModelAlgorithm | None, childId: str | None, parameter: QgsProcessingParameterDefinition | None, context: QgsProcessingContext) QgsProcessingModelerParameterWidget | None [source]¶
Creates a new modeler parameter widget for the given
parameter
. This widget allows configuration of the parameter’s value when used inside a Processingmodel
.The ID of the child algorithm within the model must be specified via the
childId
argument. This value corresponds to theQgsProcessingModelChildAlgorithm.childId()
string, which uniquely identifies which child algorithm the parameter is associated with inside the givenmodel
.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.See also
- Parameters:
model (Optional[QgsProcessingModelAlgorithm])
childId (Optional[str])
parameter (Optional[QgsProcessingParameterDefinition])
context (QgsProcessingContext)
- Return type:
Optional[QgsProcessingModelerParameterWidget]
- virtual createParameterDefinitionWidget(self, context: QgsProcessingContext, widgetContext: QgsProcessingParameterWidgetContext, definition: QgsProcessingParameterDefinition | None = None, algorithm: QgsProcessingAlgorithm | None = None) QgsProcessingAbstractParameterDefinitionWidget | None [source]¶
Creates a new parameter definition widget allowing for configuration of an instance of the parameter type handled by this factory.
The
context
argument must specify a Processing context, which will be used by the widget to evaluate existingdefinition
properties such as default values. Similarly, thewidgetContext
argument specifies the wider GUI context in which the widget will be used.The optional
definition
argument may specify a parameter definition which should be reflected in the initial state of the returned widget. Subclasses must ensure that they correctly handle both the case when a initialdefinition
is passed, or whendefinition
isNone
(in which case sensible defaults should be shown in the returned widget).Additionally, the optional
algorithm
parameter may be used to specify the algorithm or model associated with the parameter.If a factory subclass returns
None
for this method (i.e. as the base class implementation does), it indicates that the parameter type cannot be configured via GUI. In this case the parameter type will not be configurable when users add it as an input to their graphical models.Added in version 3.10.
- Parameters:
context (QgsProcessingContext)
widgetContext (QgsProcessingParameterWidgetContext)
definition (Optional[QgsProcessingParameterDefinition] = None)
algorithm (Optional[QgsProcessingAlgorithm] = None)
- Return type:
- abstract createWidgetWrapper(self, parameter: QgsProcessingParameterDefinition | None, type: Qgis.ProcessingMode) QgsAbstractProcessingParameterWidgetWrapper | None [source]¶
Creates a new widget wrapper for the specified
parameter
definition.The
type
argument indicates the dialog type to create a wrapper for.See also
- Parameters:
parameter (Optional[QgsProcessingParameterDefinition])
type (Qgis.ProcessingMode)
- Return type:
- virtual defaultModelSource(self, parameter: QgsProcessingParameterDefinition | None) Qgis.ProcessingModelChildParameterSource [source]¶
Returns the default source type to use for the widget for the specified
parameter
.Added in version 3.24.
- Parameters:
parameter (Optional[QgsProcessingParameterDefinition])
- Return type:
- virtual modelerExpressionFormatString(self) str [source]¶
Returns the expected expression format string for expression results for the parameter within model child algorithms.
This is shown in modeler widget wrappers when using the “pre-calculated” expression mode, and should give helpful text to users to indicate the expected results from the expression.
This is purely a text format and no expression validation is made against it.
- Return type:
str