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:
QgsProcessingParameterDefinition
,QgsFileFilterGenerator
Constructor for QgsProcessingParameterFile.
The
extension
argument allows for specifying a file extension associated with the parameter (e.g. “html”). UsefileFilter
for a more flexible approach which allows for multiple file extensions. Only one ofextension
orfileFilter
should be specified, if both are specified thenfileFilter
takes precedence.QgsProcessingParameterFile(
QgsProcessingParameterFile
)An input file or folder parameter for processing algorithms.
New in version 3.0:
Methods
- param outputType
- rtype
str
Returns the parameter behavior (e.g.
- param input
- rtype
QgsProcessingParameterDefinition
- rtype
str
Returns any specified file extension for the parameter.
Returns the file filter string for file destinations compatible with this parameter.
Creates a new parameter using the definition from a script code.
- param map
Sets the parameter
behavior
(e.g.Sets a file
extension
for the parameter.Sets the file
filter
string for file destinations compatible with this parameter.- rtype
Dict[str, Any]
- rtype
str
Returns the type name for the parameter class.
Attributes
- class Behavior¶
Bases:
int
- File = 0¶
- Folder = 1¶
- asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) str ¶
- Parameters
outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –
- Return type
str
- asScriptCode(self) str ¶
- Return type
str
- behavior(self) QgsProcessingParameterFile.Behavior ¶
Returns the parameter behavior (e.g. File or Folder).
See also
- Return type
- 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
- extension(self) str ¶
Returns any specified file extension for the parameter.
Note
See
fileFilter()
for a more flexible approach.See also
- Return type
str
- fileFilter(self) str ¶
Returns the file filter string for file destinations compatible with this parameter.
See also
See also
New in version 3.10.
- 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
- 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
- Parameters
behavior (QgsProcessingParameterFile.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
- Parameters
extension (str) –
- 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
See also
New in version 3.10.
- Parameters
filter (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