Class: QgsProcessingParameterEnum

class qgis.core.QgsProcessingParameterEnum(name: str, description: str = '', options: Iterable[str] = [], allowMultiple: bool = False, defaultValue: Any = None, optional: bool = False)

Bases: QgsProcessingParameterDefinition

Constructor for QgsProcessingParameterEnum.

QgsProcessingParameterEnum(QgsProcessingParameterEnum)

An enum based parameter for processing algorithms, allowing for selection from predefined values.

New in version 3.0.

Parameters
  • name (str) –

  • description (str = '') –

  • options (Iterable[str] = []) –

  • allowMultiple (bool = False) –

  • defaultValue (Any = None) –

  • optional

allowMultiple(self) → bool

Returns True if the parameter allows multiple selected values.

Return type

bool

asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) → str
Parameters

outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –

Return type

str

asScriptCode(self) → str
Return type

str

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

bool

clone(self) → QgsProcessingParameterDefinition
Return type

QgsProcessingParameterDefinition

fromScriptCode(name: str, description: str, isOptional: bool, definition: str) → QgsProcessingParameterEnum

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

Parameters
  • name (str) –

  • description (str) –

  • isOptional (bool) –

  • definition (str) –

Return type

QgsProcessingParameterEnum

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

map (Dict[str) –

Return type

bool

options(self) → List[str]

Returns the list of acceptable options for the parameter.

See also

setOptions()

Return type

List[str]

setAllowMultiple(self, allowMultiple: bool)

Sets whether the parameter allows multiple selected values.

See also

allowMultiple()

Parameters

allowMultiple (bool) –

setOptions(self, options: Iterable[str])

Sets the list of acceptable options for the parameter.

See also

options()

Parameters

options (Iterable[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

valueAsPythonString(self, value: Any, context: QgsProcessingContext) → str
Parameters
Return type

str