Class: QgsProcessingRegistry¶
Registry for various processing components, including providers, algorithms and various parameters and outputs.
QgsProcessingRegistry is not usually directly created, but
rather accessed through QgsApplication.processingRegistry().
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Constructor
Methods
Adds a new alias to an existing algorithm. |
|
Register a new parameter type for processing. |
|
Add a processing provider to the registry. |
|
Finds an algorithm by its ID. |
|
Returns basic algorithm information for the algorithm with matching ID. |
|
Returns a list of all available algorithms from registered providers. |
|
Creates a new instance of an algorithm by its ID. |
|
Returns the default style registry, responsible for styling layers generated by Processing tools. |
|
Handles the results from running an algorithm. |
|
Returns |
|
Returns |
|
Returns the post-processor to use for all map layers generated by Processing algorithms. |
|
Returns the parameter type registered for id. |
|
Returns a list with all known parameter types. |
|
Returns a matching provider by provider ID. |
|
Gets list of available providers. |
|
Unregister a custom parameter type from processing. |
|
Removes a provider implementation from the registry (the provider object is deleted). |
Signals
Emitted when a new parameter type has been added to the registry. |
|
Emitted when a parameter type has been removed from the registry and is about to be deleted. |
|
Emitted when a provider has been added to the registry. |
|
Emitted when a provider is removed from the registry |
- class qgis.core.QgsProcessingRegistry[source]¶
Bases:
QObject- __init__(parent: QObject | None = None)¶
Constructor for QgsProcessingRegistry.
- Parameters:
parent (QObject|None = None)
- addAlgorithmAlias(self, aliasId: str | None, actualId: str | None)[source]¶
Adds a new alias to an existing algorithm.
This allows algorithms to be referred to by a different provider ID and algorithm name to their actual underlying provider and algorithm name. It provides a mechanism to allow algorithms to be moved between providers without breaking existing scripts or plugins.
The
aliasIdargument specifies the “fake” algorithm id (eg “fake_provider:fake_alg”) by which the algorithm can be referred to, and theactualIdargument specifies the real algorithm ID for the algorithm.Added in version 3.10.
- Parameters:
aliasId (str|None)
actualId (str|None)
- addParameterType(self, type: QgsProcessingParameterType | None) bool[source]¶
Register a new parameter type for processing. Ownership is transferred to the registry. Will emit parameterTypeAdded.
See also
Added in version 3.2.
- Parameters:
type (QgsProcessingParameterType|None)
- Return type:
bool
- addProvider(self, provider: QgsProcessingProvider | None) bool[source]¶
Add a processing provider to the registry. Ownership of the provider is transferred to the registry, and the provider’s parent will be set to the registry. Returns
Falseif the provider could not be added (eg if a provider with a duplicate ID already exists in the registry). Adding a provider to the registry automatically triggers the providersQgsProcessingProvider.load()method to populate the provider with algorithms.See also
- Parameters:
provider (QgsProcessingProvider|None)
- Return type:
bool
- algorithmById(self, id: str | None) QgsProcessingAlgorithm | None[source]¶
Finds an algorithm by its ID. If no matching algorithm is found,
Noneis returned.See also
See also
- Parameters:
id (str|None)
- Return type:
- algorithmInformation(self, id: str | None) QgsProcessingAlgorithmInformation[source]¶
Returns basic algorithm information for the algorithm with matching ID.
This method uses an internal cache to ensure that information is quickly returned and is suitable for calling many times.
Added in version 3.32.
- Parameters:
id (str|None)
- Return type:
- algorithms(self) list[QgsProcessingAlgorithm]¶
Returns a list of all available algorithms from registered providers.
See also
- Return type:
list[QgsProcessingAlgorithm]
- createAlgorithmById(self, id: str | None, configuration: dict[str | None, Any] = {}) QgsProcessingAlgorithm | None[source]¶
Creates a new instance of an algorithm by its ID. If no matching algorithm is found,
Noneis returned. Callers take responsibility for deleting the returned object.The
configurationargument allows passing of a map of configuration settings to the algorithm, allowing it to dynamically adjust its initialized parameters and outputs according to this configuration. This is generally used only for algorithms in a model, allowing them to adjust their behavior at run time according to some user configuration.See also
See also
- Parameters:
id (str|None)
configuration (dict[str|None, Any] = {})
- Return type:
- defaultStyleRegistry(self) QgsProcessingDefaultStyleRegistry | None¶
Returns the default style registry, responsible for styling layers generated by Processing tools.
Added in version 4.4.
- Return type:
- handleAlgorithmResults(self, algorithm: QgsProcessingAlgorithm | None, context: QgsProcessingContext, parameters: dict[str | None, Any], feedback: QgsProcessingFeedback | None = None) bool[source]¶
Handles the results from running an algorithm.
Returns
Trueif all results could be successfully loaded. Internally calls theQgsProcessingResultsHandlerset bysetResultsHandler().Warning
This is not considered stable API, and is exposed to Python for internal use only.
Added in version 4.4.
- Parameters:
algorithm (QgsProcessingAlgorithm|None)
context (QgsProcessingContext)
parameters (dict[str|None, Any])
feedback (QgsProcessingFeedback|None = None)
- Return type:
bool
- isCompatibleDefinition(self, targetDefinition: QgsProcessingParameterDefinition | None, candidateDefinition: QgsProcessingParameterDefinition | None) bool[source]¶
Returns
Trueif thetargetDefinitionacceptscandidateDefinitionas compatible Processing parameter types for parameter type oftargetDefinition.Example¶
vectorLayerParam = QgsProcessingParameterVectorLayer( "dummyname" ) boolParam = QgsProcessingParameterBoolean( "dummyname" ) # Parameter source and parameter target are compatible QgsApplication.processingRegistry().isCompatibleDefinition( vectorLayerParam, vectorLayerParam ) # -> return True QgsApplication.processingRegistry().isCompatibleDefinition( boolParam, vectorLayerParam ) # -> return True # Parameter source and parameter target are incompatible QgsApplication.processingRegistry().isCompatibleDefinition( vectorLayerParam, boolParam ) # -> return False
Added in version 4.4.
- param targetDefinition:
- type targetDefinition:
QgsProcessingParameterDefinition|None
- param candidateDefinition:
- type candidateDefinition:
QgsProcessingParameterDefinition|None
- rtype:
bool
- isCompatibleOutput(self, targetDefinition: QgsProcessingParameterDefinition | None, candidateOutput: QgsProcessingOutputDefinition | None) bool[source]¶
Returns
Trueif thetargetDefinitionacceptscandidateOutputas compatible Processing output types for parameter type oftargetDefinition.### Example
vectorLayerParam = QgsProcessingParameterVectorLayer( "dummyname" ) boolOutput = QgsProcessingOutputBoolean( "dummyname" ) stringOutput = QgsProcessingOutputString( "dummyname" ) vectorLayerOutput = QgsProcessingOutputVectorLayer( "dummyname" ) # Output source and parameter target are compatible QgsApplication.processingRegistry().isCompatibleOutput( vectorLayerParam, stringOutput ) # -> return True QgsApplication.processingRegistry().isCompatibleOutput( vectorLayerParam, vectorLayerOutput ) # -> return True # Output source and parameter target are incompatible QgsApplication.processingRegistry().isCompatibleOutput( vectorLayerParam, boolOutput ) # -> return False
Added in version 4.4.
- Parameters:
targetDefinition (QgsProcessingParameterDefinition|None)
candidateOutput (QgsProcessingOutputDefinition|None)
- Return type:
bool
- layerPostProcessor(self) QgsProcessingLayerPostProcessor | None¶
Returns the post-processor to use for all map layers generated by Processing algorithms.
See also
setLayerPostProcessor()Added in version 4.4.
- Return type:
- parameterType(self, id: str | None) QgsProcessingParameterType | None[source]¶
Returns the parameter type registered for
id.Added in version 3.2.
- Parameters:
id (str|None)
- Return type:
- signal parameterTypeAdded(type: QgsProcessingParameterType)[source]¶
Emitted when a new parameter type has been added to the registry.
Added in version 3.2.
- Parameters:
type (QgsProcessingParameterType)
- signal parameterTypeRemoved(type: QgsProcessingParameterType)[source]¶
Emitted when a parameter type has been removed from the registry and is about to be deleted.
Added in version 3.2.
- Parameters:
type (QgsProcessingParameterType)
- parameterTypes(self) list[QgsProcessingParameterType]¶
Returns a list with all known parameter types.
Added in version 3.2.
- Return type:
- signal providerAdded(id: str)[source]¶
Emitted when a provider has been added to the registry.
- Parameters:
id (str)
- providerById(self, id: str | None) QgsProcessingProvider | None[source]¶
Returns a matching provider by provider ID.
- Parameters:
id (str|None)
- Return type:
- signal providerRemoved(id: str)[source]¶
Emitted when a provider is removed from the registry
- Parameters:
id (str)
- providers(self) list[QgsProcessingProvider]¶
Gets list of available providers.
- Return type:
list[QgsProcessingProvider]
- removeParameterType(self, type: QgsProcessingParameterType | None)[source]¶
Unregister a custom parameter type from processing. The type will be deleted. Will emit parameterTypeRemoved.
See also
Added in version 3.2.
- Parameters:
type (QgsProcessingParameterType|None)
- removeProvider(self, provider: QgsProcessingProvider | None) bool[source]¶
Removes a provider implementation from the registry (the provider object is deleted). Returns
Falseif the provider could not be removed (eg provider does not exist in the registry).See also
removeProvider(self, providerId: str|None) -> bool Removes a provider implementation from the registry (the provider object is deleted). Returns
Falseif the provider could not be removed (eg provider does not exist in the registry).See also
- Parameters:
provider (QgsProcessingProvider|None)
- Return type:
bool