This change makes it easier to subclass `Grass7AlgorithProvider` which
allows e.g. to expose GRASS Addons as QGIS plugins.
Disclaimer: `Grass7AlgorithProvider` is a private API and it may change
without warning. 3rd parties that rely on this should expect
that their code will break in future releases.
For more info please check the comments at #30252
Nevertheless, it currently is possible to subclass with something like this:
class CustomGrassBasedProvider(Grass7AlgorithmProvider):
# Set descriptionFolder to our own description directory
descriptionFolder = os.path.join(os.path.dirname(__file__), 'description')
# 3rd party plugins don't need an activation/deactivation setting
activateSetting = None
# define the rest of the methods that are needed (e.g. name(), id() etc)
# ...
Fixes#30241
Continues #9202
After @Nyalldawson suggestion [1], we've implemented a Processing plugin
that exposes a GRASS Addon [2]. In order to do this we had to subclass
`Grass7AlgorithmProvider` and override `createAlgsList()`.
`createAlgsList()` had to be overriden in order to change the
"description folder" location.
Nyall wrote:
> And if you do it right (and only import existing
> processing grass code, minimising the copy/paste of this code), then
> your provider will automatically inherit any future fixes and
> features added to the main grass provider.
With this commit we convert the `descriptionFolder` to a class attribute
and in this way, subclasses of `Grass7AlgorithmProvider` will no longer
have to override `createAlgsList()` and will be able to continue inheriting
future enhancements.
References:
1. https://lists.osgeo.org/pipermail/qgis-developer/2019-February/056155.html
2. 948820b1c0/estimap_recreation_provider.py (L40-59)
And require that showing help is opt-in. Apart from a handful
of built-in providers, most providers will not have help pages
available within the QGIS documentation (including model and
script algorithms). Accordingly, we should hide the help button
by default and only show it for these selected providers.
Note that 3rd party algorithms can still specify custom helpUrl
urls, in which case the button WILL be shown.
* A new createopt textbox has been added to the parameters dialog for algorithms which exports to raster files.
* A new metaopt textbox has also been added to the Algorithm parameters dialog.
* Raster file format is detected from output filename extension.
* GdalUtils has been improved to correctly detect raster formats supported for creation.
* QFileDialog for output rasters now display only file filters for supported output raster file formats.
Nothing particularly exciting here yet, but this commit
moves the definition of the provider base class to a c++
QgsProcessingProvider abstract base class.
As part of this some existing python methods were renamed
to make their use clearer and to fit with the QGIS c++
api conventions:
- getName was renamed to id
- getDescription was renamed to name
- getIcon was renamed to icon
These API breaks are documented