Class: QgsProcessingDestinationParameter¶
- class qgis.core.QgsProcessingDestinationParameter(name: str, description: str = '', defaultValue: Any = None, optional: bool = False, createByDefault: bool = True)¶
Bases:
QgsProcessingParameterDefinition
,QgsFileFilterGenerator
Constructor for QgsProcessingDestinationParameter.
If
createByDefault
isFalse
and the parameter isoptional
, then the destination output will not be created by default.QgsProcessingDestinationParameter(
QgsProcessingDestinationParameter
)Base class for all parameter definitions which represent file or layer destinations, e.g. parameters which are used for the destination for layers output by an algorithm.
New in version 3.0:
Methods
- param outputType
Returns
True
if the destination should be created by default.- rtype
str
Returns the default file extension for destination file paths associated with this parameter.
- param map
Generates a temporary destination value for this parameter.
- rtype
bool
Tests whether a
value
is a supported value for this parameter.Original (source) provider which this parameter has been derived from.
Sets whether the destination should be created by default.
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.
Returns
True
if the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.Returns a new
QgsProcessingOutputDefinition
corresponding to the definition of the destination parameter.- rtype
Dict[str, Any]
- asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) str ¶
- Parameters
outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –
- Return type
str
- createByDefault(self) bool ¶
Returns
True
if the destination should be created by default. For optional parameters, a return value ofFalse
indicates that the destination should not be created by default.See also
- Return type
bool
- createFileFilter(self) str ¶
- Return type
str
- defaultFileExtension(self) str ¶
Returns the default file extension for destination file paths associated with this parameter.
- Return type
str
- fromVariantMap(self, map: Dict[str, Any]) bool ¶
- Parameters
map (Dict[str) –
- Return type
bool
- generateTemporaryDestination(self) str ¶
Generates a temporary destination value for this parameter. The returned value will be a file path or QGIS data provider URI suitable for temporary storage of created layers and files.
- Return type
str
- isDestination(self) bool ¶
- Return type
bool
- isSupportedOutputValue(self, value: Any, context: QgsProcessingContext) Tuple[bool, str] ¶
Tests whether a
value
is a supported value for this parameter.Will return
False
when avalue
with an unsupported file extension is specified. The default implementation callsQgsProcessingProvider.isSupportedOutputValue()
to test compatibility.- Parameters
value (Any) – value to test
context (QgsProcessingContext) – Processing context
- Return type
Tuple[bool, str]
- Returns
True
ifvalue
is supported.error: will be set to a descriptive error string
New in version 3.14.
- originalProvider(self) QgsProcessingProvider ¶
Original (source) provider which this parameter has been derived from. In the case of destination parameters which are part of model algorithms, this will reflect the child algorithm’s provider which actually generates the parameter, as opposed to the provider which this parameter belongs to (i.e. the model provider)
New in version 3.2.
- Return type
- setCreateByDefault(self, createByDefault: bool)¶
Sets whether the destination should be created by default. For optional parameters, a value of
False
indicates that the destination should not be created by default.See also
- Parameters
createByDefault (bool) –
- setSupportsNonFileBasedOutput(self, supportsNonFileBasedOutput: bool)¶
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.
See also
- Parameters
supportsNonFileBasedOutput (bool) –
- supportsNonFileBasedOutput(self) bool ¶
Returns
True
if the destination parameter supports non filed-based outputs, such as memory layers or direct database outputs.See also
- Return type
bool
- toOutputDefinition(self) QgsProcessingOutputDefinition ¶
Returns a new
QgsProcessingOutputDefinition
corresponding to the definition of the destination parameter.- Return type
- toVariantMap(self) Dict[str, Any] ¶
- Return type
Dict[str, Any]