3

I would like to programmatically show a processing algorithm 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

from processing.gui.AlgorithmDialog import AlgorithmDialog
from qgis.core import QgsApplication
alg = QgsApplication.processingRegistry().algorithmById('qgis:extractbyattribute')
dlg = AlgorithmDialog(alg, False, iface.mainWindow())
dlg.show()
dlg.exec_()

This opens algorithm dialog and let me perform processing computations but once closed the dialog window QGIS become unstable and crash without any message interacting with the user interface.

What am I doing wrong? Is there a method to do this in other way?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Jan 24, 2020 at 15:37

1 Answer 1

6

You have another function for doing this:

from processing import execAlgorithmDialog
params = {} # A dictionary to load some default value in the dialog
execAlgorithmDialog('qgis:extractbyattribute', params)
answered Jan 24, 2020 at 16:05
2
  • Great. Very handy solution. Commented Jan 24, 2020 at 23:28
  • 1
    the method returns the results dict so you can perform further action like styling renaming etc.. 'results = execAlgorithmDialog('qgis:extractbyattribute', params)' Commented Jan 29, 2020 at 11:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.