Class: QgsProcessingParameterFile

class qgis.core.QgsProcessingParameterFile(name: str, description: str = '', behavior: QgsProcessingParameterFile.Behavior = QgsProcessingParameterFile.File, extension: str = '', defaultValue: Any = None, optional: bool = False, fileFilter: str = '')

Bases: qgis._core.QgsProcessingParameterDefinition

Constructor for QgsProcessingParameterFile.

The extension argument allows for specifying a file extension associated with the parameter (e.g. “html”). Use fileFilter for a more flexible approach which allows for multiple file extensions. Only one of extension or fileFilter should be specified, if both are specified then fileFilter takes precedence.

QgsProcessingParameterFile(QgsProcessingParameterFile)

An input file or folder parameter for processing algorithms.

New in version 3.0: Enums

Methods

asPythonString

asScriptCode

behavior

Returns the parameter behavior (e.g.

checkValueIsAcceptable

clone

extension

Returns any specified file extension for the parameter.

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

setBehavior

Sets the parameter behavior (e.g.

setExtension

Sets a file extension for the parameter.

setFileFilter

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

toVariantMap

type

typeName

Returns the type name for the parameter class.

Signals

Attributes

File

Folder

class Behavior

Bases: int

File = 0
Folder = 1
asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) → str
asScriptCode(self) → str
behavior(self) → QgsProcessingParameterFile.Behavior

Returns the parameter behavior (e.g. File or Folder).

See also

setBehavior()

checkValueIsAcceptable(self, input: Any, context: QgsProcessingContext = None) → bool
clone(self) → QgsProcessingParameterDefinition
extension(self) → str

Returns any specified file extension for the parameter.

Note

See fileFilter() for a more flexible approach.

See also

setExtension()

fileFilter(self) → str

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

See also

setFileFilter()

See also

extension()

New in version 3.10.

fromScriptCode(name: str, description: str, isOptional: bool, definition: str, behavior: QgsProcessingParameterFile.Behavior = QgsProcessingParameterFile.File) → QgsProcessingParameterFile

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

fromVariantMap(self, map: Dict[str, Any]) → bool
setBehavior(self, behavior: QgsProcessingParameterFile.Behavior)

Sets the parameter behavior (e.g. File or Folder).

See also

behavior()

setExtension(self, extension: str)

Sets a file extension for the parameter.

Calling this method resets any existing fileFilter().

Note

See setFileFilter() for a more flexible approach.

See also

extension()

setFileFilter(self, filter: str)

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

Calling this method resets any existing extension() setting.

See also

fileFilter()

See also

setExtension()

New in version 3.10.

toVariantMap(self) → Dict[str, Any]
type(self) → str
typeName() → str

Returns the type name for the parameter class.