Class: QgsProcessingParameterFile¶
An input file or folder parameter for processing algorithms.
Class Hierarchy¶
Base classes¶
Base class for the definition of processing parameters. |
|
Abstract interface for classes which generate a file filter string. |
Enums
alias of |
Methods
Returns the parameter behavior (e.g. File or Folder). |
|
Returns any specified file extension for the parameter. |
|
Returns the file filter string for file destinations compatible with this parameter. |
|
Sets the parameter behavior (e.g. File or Folder). |
|
Sets a file extension for the parameter. |
|
Sets the file filter string for file destinations compatible with this parameter. |
Static Methods
Creates a new parameter using the definition from a script code. |
|
Returns the type name for the parameter class. |
- class qgis.core.QgsProcessingParameterFile[source]¶
Bases:
QgsProcessingParameterDefinition,QgsFileFilterGenerator- __init__(name: str | None, description: str | None = '', behavior: Qgis.ProcessingFileParameterBehavior = Qgis.ProcessingFileParameterBehavior.File, extension: str | None = '', defaultValue: Any = None, optional: bool = False, fileFilter: str | None = '')
Constructor for QgsProcessingParameterFile.
The
extensionargument allows for specifying a file extension associated with the parameter (e.g. “html”). UsefileFilterfor a more flexible approach which allows for multiple file extensions. Only one ofextensionorfileFiltershould be specified, if both are specified thenfileFiltertakes precedence.- Parameters:
name (Optional[str])
description (Optional[str] = '')
behavior (Qgis.ProcessingFileParameterBehavior = Qgis.ProcessingFileParameterBehavior.File)
extension (Optional[str] = '')
defaultValue (Any = None)
optional (bool = False)
fileFilter (Optional[str] = '')
- __init__(a0: QgsProcessingParameterFile)
- Parameters:
- Behavior¶
alias of
ProcessingFileParameterBehavior
- behavior(self) Qgis.ProcessingFileParameterBehavior[source]¶
Returns the parameter behavior (e.g. File or Folder).
See also
- Return type:
- extension(self) str[source]¶
Returns any specified file extension for the parameter.
Note
See
fileFilter()for a more flexible approach.See also
- Return type:
str
- fileFilter(self) str[source]¶
Returns the file filter string for file destinations compatible with this parameter.
See also
See also
Added in version 3.10.
- Return type:
str
- static fromScriptCode(name: str | None, description: str | None, isOptional: bool, definition: str | None, behavior: Qgis.ProcessingFileParameterBehavior = Qgis.ProcessingFileParameterBehavior.File) QgsProcessingParameterFile | None[source]¶
Creates a new parameter using the definition from a script code.
- Parameters:
name (Optional[str])
description (Optional[str])
isOptional (bool)
definition (Optional[str])
behavior (Qgis.ProcessingFileParameterBehavior = Qgis.ProcessingFileParameterBehavior.File)
- Return type:
Optional[QgsProcessingParameterFile]
- setBehavior(self, behavior: Qgis.ProcessingFileParameterBehavior)[source]¶
Sets the parameter
behavior(e.g. File or Folder).See also
- Parameters:
behavior (Qgis.ProcessingFileParameterBehavior)
- setExtension(self, extension: str | None)[source]¶
Sets a file
extensionfor the parameter.Calling this method resets any existing
fileFilter().Note
See
setFileFilter()for a more flexible approach.See also
- Parameters:
extension (Optional[str])
- setFileFilter(self, filter: str | None)[source]¶
Sets the file
filterstring for file destinations compatible with this parameter.Calling this method resets any existing
extension()setting.See also
See also
Added in version 3.10.
- Parameters:
filter (Optional[str])