[Qgis-user] Access to iface in processing alg

Nyall Dawson nyall.dawson at gmail.com
Mon Jul 9 17:56:39 PDT 2018


On Tue, 10 Jul 2018 at 05:15, Jean-Baptiste Desbas <jb.desbas at gmail.com> wrote:
>
>
> Hi,
>
> I just want to display a messageBar instead of displaying it un the processing output console (feedback.pushInfo) It's ni big deal but i was just confused.

As Matthias has said -- don't do this! Apart from the crashes, it will
also break use of your algorithms from standalone scripts, where iface
is not available. It also means the output is not properly logged, so
users who want to save the log from model execution for later
reference won't have these messages included.

> Do toi have any tips of use case of the differents pushInfo, pushConsoleInfo, etc. ?

Basically you can stick to pushInfo and reportError. Use pushInfo for
informative messages, such as "Building spatial index" or "Found 56
matching features", and reportError for... errors... e.g. "Feature
does not have a point geometry, skipping".

Nyall



More information about the Qgis-user mailing list