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 }
})

New in version 3.0.

QgsProcessingParameterFileDestination(name: str, description: str = ‘’, fileFilter: str = ‘’, defaultValue: Any = None, optional: bool = False, createByDefault: bool = True) Constructor for QgsProcessingParameterFileDestination.

If createByDefault is False and the parameter is optional, then this destination output will not be created by default.

QgsProcessingParameterFileDestination(QgsProcessingParameterFileDestination)

Methods

asPythonString

param outputType

checkValueIsAcceptable

param input

clone

rtype

QgsProcessingParameterDefinition

createFileFilter

rtype

str

defaultFileExtension

rtype

str

fileFilter

Returns the file filter string for file destinations compatible with this parameter.

fromScriptCode

Creates a new parameter using the definition from a script code.

fromVariantMap

param map

setFileFilter

Sets the file filter string for file destinations compatible with this parameter.

toOutputDefinition

rtype

QgsProcessingOutputDefinition

toVariantMap

rtype

Dict[str, Any]

type

rtype

str

typeName

Returns the type name for the parameter class.

valueAsPythonString

param value

asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) str
Parameters

outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –

Return type

str

checkValueIsAcceptable(self, input: Any, context: QgsProcessingContext = None) bool
Parameters
Return type

bool

clone(self) QgsProcessingParameterDefinition
Return type

QgsProcessingParameterDefinition

createFileFilter(self) str
Return type

str

defaultFileExtension(self) str
Return type

str

fileFilter(self) str

Returns the file filter string for file destinations compatible with this parameter.

See also

setFileFilter()

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

QgsProcessingParameterFileDestination

fromVariantMap(self, map: Dict[str, Any]) bool
Parameters

map (Dict[str) –

Return type

bool

setFileFilter(self, filter: str)

Sets the file filter string for file destinations compatible with this parameter.

See also

fileFilter()

Parameters

filter (str) –

toOutputDefinition(self) QgsProcessingOutputDefinition
Return type

QgsProcessingOutputDefinition

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
Return type

str