[QGIS-Developer] createAlgorithmDialog in Processing script (within plugin)

Germán Carrillo carrillo.german at gmail.com
Mon Aug 1 07:17:13 PDT 2022


Hi Matteo,

I've been successfully using *execAlgorithmDialog()* instead [0]:

*processing.execAlgorithmDialog("my_provider:my_algorithm", params)*

where, *params* is a dict with the pre-filled values you have. You can see
an example at [1].

Regards,

Germán
-----------
[0]
https://github.com/qgis/QGIS/blob/2d1aa68f0d044f2aced7ebeca8d2fa6b754ac970/python/plugins/processing/tools/general.py#L185
[1]
https://github.com/SwissTierrasColombia/LADM-COL-Add-on-Ambiente/blob/master/ladm_col_environment_add_on.py#L140


El lun, 1 ago 2022 a las 15:23, matteo via QGIS-Developer (<
qgis-developer at lists.osgeo.org>) escribió:

> Hi all,
>
> I've a set of custom processing scripts within a plugin (that is both
> "normal" and processing provider plugin).
>
> I'm trying to executing the dialog of these algorithm from one of the
> main plugin file. I found the processing.createAlgorithmDialog [0], but
> it is constantly crashing when I'm passing the instance of the algorithm:
>
> my_alg = MyCustomAlg()
> my_dialog = my_alg.createAlgorithmDialog(custom_dict)
>
> ## crash here
>
> Thinking it was a problem of the threads I also tried to overwrite the
> `flag` method in the algorithm by setting also
> QgsProcessingAlgorithm.FlagNoThreading but with the same results.
>
> I know I can run the processing algorithm with processing.run(....) but
> I need to open the dialog pre-filled with custom parameters and to get
> also some other outputs besides the standard ones (like the
> QgsFeatureSink path)
>
> Thanks for any suggestion
>
> Cheers
>
> Matteo
>
>
> [0]
>
> https://github.com/qgis/QGIS/blob/master/python/plugins/processing/tools/general.py#L155
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 
-----------
   |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
https://twitter.com/GeoTux2 <http://twitter.com/GeoTux2>

<http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220801/f0469d99/attachment.htm>


More information about the QGIS-Developer mailing list