<div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div><div>I have the same needs and I can't find any of these methods in the docs, neither in <a href="https://qgis.org/api/">https://qgis.org/api/</a> nor <a href="https://qgis.org/pyqgis/master/">https://qgis.org/pyqgis/master/</a></div><div>Am I missing something?<br></div><div><br></div><div>Regards,</div><div>Harrissou</div><div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 27 janv. 2020 à 07:34, Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, 25 Jan 2020 at 01:43, Enrico Ferreguti <<a href="mailto:enricofer@gmail.com" target="_blank">enricofer@gmail.com</a>> wrote:<br>
><br>
> Hi QGIS developers,<br>
><br>
> I would like to programmatically show a processing algoritm dialog from python. I gived a look to processing toolbox and I found that this is possible importing and instantiating the class AlgorithmDialog [gui/processingToolbox.py][1]<br>
><br>
> from processing.gui.AlgorithmDialog import AlgorithmDialog<br>
> from qgis.core import QgsApplication<br>
><br>
> alg = QgsApplication.processingRegistry().algorithmById('qgis:extractbyattribute')<br>
> dlg = AlgorithmDialog(alg, False, iface.mainWindow())<br>
> dlg.show()<br>
> dlg.exec_()<br>
><br>
> This opens algorithm dialog and let me perform processing computations but once closed the dialog window QGIS become instable and crash without any message interacting with the user interface.<br>
><br>
> What am I doing wrong? Is there a method to do this in other way?<br>
<br>
Yep - there's a built in method which does this for you.<br>
<br>
You want either<br>
<br>
from qgis.processing import createAlgorithmDialog<br>
dlg = createAlgorithmDialog('qgis:extractbyattribute', parameters={})<br>
dlg.exec_()<br>
<br>
OR<br>
<br>
from qgis.processing import execAlgorithmDialog<br>
results = execAlgorithmDialog('qgis:extractbyattribute', parameters={})<br>
<br>
(check the docs for each for the full details)<br>
<br>
In general, try to avoid any "from processing.* " imports -- those are<br>
all internal details and not considered stable API. Anything in<br>
"qgis.processing" IS stable and is public API, designed for external<br>
use.<br>
<br>
Nyall<br>
<br>
<br>
><br>
> I just posted the question on StackExchange: <a href="https://gis.stackexchange.com/questions/348542/open-qgis-prococessing-algorithm-dialog-with-python" rel="noreferrer" target="_blank">https://gis.stackexchange.com/questions/348542/open-qgis-prococessing-algorithm-dialog-with-python</a><br>
><br>
> Thanks in advance.<br>
> Enrico Ferreguti.<br>
><br>
> [1]: <a href="https://github.com/qgis/QGIS/blob/276a31439eb95f9cdb1053a6ae2dba3f19fbcece/python/plugins/processing/gui/ProcessingToolbox.py#L262" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/blob/276a31439eb95f9cdb1053a6ae2dba3f19fbcece/python/plugins/processing/gui/ProcessingToolbox.py#L262</a><br>
> _______________________________________________<br>
> QGIS-Developer mailing list<br>
> <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div></div>