Class: QgsProcessingParameterFile

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

Bases: QgsProcessingParameterDefinition

Constructor for QgsProcessingParameterFile.

QgsProcessingParameterFile(QgsProcessingParameterFile)

An input file or folder parameter for processing algorithms.

New in version 3.0.

Parameters
  • name (str) –

  • description (str = '') –

  • behavior (QgsProcessingParameterFile.Behavior = QgsProcessingParameterFile.File) –

  • extension (str = '') –

  • defaultValue (Any = None) –

  • optional

class Behavior

Bases: int

File = 0
Folder = 1
asScriptCode(self) → str
Return type

str

behavior(self) → QgsProcessingParameterFile.Behavior

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

See also

setBehavior()

Return type

QgsProcessingParameterFile.Behavior

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

bool

clone(self) → QgsProcessingParameterDefinition
Return type

QgsProcessingParameterDefinition

extension(self) → str

Returns any specified file extension for the parameter.

See also

setExtension()

Return type

str

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.

Parameters
  • name (str) –

  • description (str) –

  • isOptional (bool) –

  • definition (str) –

  • behavior (QgsProcessingParameterFile.Behavior = QgsProcessingParameterFile.File) –

Return type

QgsProcessingParameterFile

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

map (Dict[str) –

Return type

bool

setBehavior(self, behavior: QgsProcessingParameterFile.Behavior)

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

See also

behavior()

Parameters

behavior (QgsProcessingParameterFile.Behavior) –

setExtension(self, extension: str)

Sets a file extension for the parameter.

See also

extension()

Parameters

extension (str) –

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