Class: QgsProcessingParameterFileDestination¶
-
class
qgis.core.
QgsProcessingParameterFileDestination
(name: str, description: str = '', fileFilter: str = '', defaultValue: Any = None, optional: bool = False, createByDefault: bool = True)¶ Bases:
QgsProcessingDestinationParameter
Constructor for QgsProcessingParameterFileDestination.
If
createByDefault
isFalse
and the parameter isoptional
, then this destination output will not be created by default.QgsProcessingParameterFileDestination(
QgsProcessingParameterFileDestination
)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.
- Parameters
name (str) –
description (str = '') –
fileFilter (str = '') –
defaultValue (Any = None) –
optional (bool = False) –
createByDefault –
-
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
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
-
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)
New 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