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

Richard Duivenvoorde rdmailings at duif.net
Tue Feb 21 11:44:03 PST 2023


Hi Matteo,

Not very helpful for you, but what about creating an issue with the minimal code to crash?

And about Thread/Crash problems: I have been succesful with the tips of Nyall in: https://lists.osgeo.org/pipermail/qgis-developer/2023-February/065525.html to create a QgsTask which either crashed or gave warnings...

One thing I've seen recently is that some Processing algs with me give these "...is run from a different thread than the object  lives in ..."-warnings.
And my feeling is that if some code is fetching references to the QGIS application instance, it shows this warning.

Good luck solving your issue

Regards,

Richard



On 2/21/23 16:41, matteo via QGIS-Developer wrote:
> Hi devs,
> 
> I'm raising this email again because I don't know if this a bug/limitation/correct behavior.
> 
> I also think that the problem is from a thread point of view, at least by the crash that I have.
> 
> Knowing that a processing algorithm, as suggested by Germàn, can be created with:
> 
> processing.createAlgorithmDialog("my_provider:my_algorithm", params)
> 
> within a plugin, if the algorithm **id** is passed as first argument, QGIS is crashing, while it seems working on a standalone script in the QGIS code editor.
> 
> Is this a limitation?
> 
> Cheers and thanks for any suggestion!
> 
> Matteo
> 
> On 8/1/22 15:23, matteo wrote:
>> 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



More information about the QGIS-Developer mailing list