Class: QgsProcessingParameterFileDestination¶
- class qgis.core.QgsProcessingParameterFileDestination¶
Bases:
QgsProcessingDestinationParameter
A generic file based destination parameter, for specifying the destination path for a file (non-map layer) created by the algorithm.
In some circumstances it is desirable to avoid the usual file overwriting confirmation prompt when users select an existing destination file for this parameter type (e.g., for algorithms which append to an existing destination file instead of overwriting them.). This can be done by setting the widget wrapper metadata “dontconfirmoverwrite” option:
param = QgsProcessingParameterFileDestination( 'OUTPUT', 'Destination file') # don't show the file overwrite warning when users select a destination file: param.setMetadata( {'widget_wrapper': { 'dontconfirmoverwrite': True } })
QgsProcessingParameterFileDestination(name: str, description: str = ‘’, fileFilter: str = ‘’, defaultValue: Any = None, optional: bool = False, createByDefault: bool = True) Constructor for QgsProcessingParameterFileDestination.
If
createByDefault
isFalse
and the parameter isoptional
, then this destination output will not be created by default.QgsProcessingParameterFileDestination(
QgsProcessingParameterFileDestination
)Methods
- param outputType:
- param input:
- rtype:
QgsProcessingParameterDefinition
- rtype:
str
- rtype:
str
Default gui value for an algorithm parameter from settings
Returns the file filter string for file destinations compatible with this parameter.
Creates a new parameter using the definition from a script code.
- param map:
Original (source) provider which this parameter has been derived from.
Sets the file
filter
string for file destinations compatible with this parameter.- rtype:
QgsProcessingOutputDefinition
- rtype:
Dict[str, Any]
- rtype:
str
Returns the type name for the parameter class.
- param value:
- asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonOutputType.PythonQgsProcessingAlgorithmSubclass) str ¶
- Parameters:
outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonOutputType.PythonQgsProcessingAlgorithmSubclass)
- Return type:
str
- checkValueIsAcceptable(self, input: Any, context: QgsProcessingContext = None) bool ¶
- Parameters:
input (Any)
context (
QgsProcessingContext
= None)
- Return type:
bool
- clone(self) QgsProcessingParameterDefinition ¶
- Return type:
- createFileFilter(self) str ¶
- Return type:
str
- defaultFileExtension(self) str ¶
- Return type:
str
- defaultGuiValueFromSetting(self) Any ¶
Default gui value for an algorithm parameter from settings
- Returns:
default value from settings or invalid QVariant if there is no default value defined in the settings
Added in version 3.34.
- fileFilter(self) str ¶
Returns the file filter string for file destinations compatible with this parameter.
See also
- Return type:
str
- fromScriptCode(name: str, description: str, isOptional: bool, definition: str) QgsProcessingParameterFileDestination ¶
Creates a new parameter using the definition from a script code.
- Parameters:
name (str)
description (str)
isOptional (bool)
definition (str)
- Return type:
- fromVariantMap(self, map: Dict[str, Any]) bool ¶
- Parameters:
map (Dict[str)
- Return type:
bool
- 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)
Added in version 3.2.
- setFileFilter(self, filter: str)¶
Sets the file
filter
string for file destinations compatible with this parameter.See also
- Parameters:
filter (str)
- toOutputDefinition(self) QgsProcessingOutputDefinition ¶
- Return type:
- toVariantMap(self) Dict[str, Any] ¶
- Return type:
Dict[str, Any]
- type(self) str ¶
- Return type:
str
- typeName() str ¶
Returns the type name for the parameter class.
- Return type:
str
- valueAsPythonString(self, value: Any, context: QgsProcessingContext) str ¶
- Parameters:
value (Any)
context (QgsProcessingContext)
- Return type:
str