[Qgis-developer] Fwd: Threads in sextante

Giuseppe Sucameli brush.tyler at gmail.com
Sat May 12 10:12:56 PDT 2012

Hi Etienne,

On Sat, May 12, 2012 at 6:47 PM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
> I always thought that gdaltools and ftools should be non-blocking
> (unless I am mistaken, they are currently blocking the rest of the
> app), especially if the operation takes a long time.

GdalTools is non-blocking (uses QProcess to execute commands)
and its dialogs are non-modal, so more operations can run
concurrently and users can open all the gdaltools dialogs they need.

> This might have issues though with
> 1) progress report - can this be done by the executing thread?

That's missing in GdalTools.

Generally speaking, every time the execution thread emits the
progress signal the main thread (GUI thread) updates the progressbar.

Focused to GdalTools, it should get progress percent from the
QProcess output but unfortunately a lot of other info goes to
the process output.

> 2) what happens when the operation finishes

The execution thread emits a signal and the main thread
display a message according to the signal (error, finished).

> Ideally, there should be a way to cancel an operation, if it takes too
> long (e.g. escape key when the operation window has focus)

Stopping/killing the execution thread should be enough.
GdalTools asks for confirmation and then does it.

> Also, this could enable several similar operations to be done in
> parallel - as long as they are not working on the same output files.

That must be taken care from the framework: an operation that needs
as input outputs generated by other operations must be started only
after the required outputs are ready...
... and the key is to use signals, again.


> Etienne
> On Fri, May 11, 2012 at 3:25 AM, Paolo Cavallini <cavallini at faunalia.it> wrote:
>> Il 10/05/2012 23:15, Martin Dobias ha scritto:
>>> What should be the benefit of multithreading here? To run algorithms
>>> outside from main thread so that GUI does not get blocked?
>> IMHO this is the main reason; I think the way GDALTools work is fine for the user.
>> All the best.
>> --
>> Paolo Cavallini - Faunalia
>> www.faunalia.eu
>> Full contact details at www.faunalia.eu/pc
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

Giuseppe Sucameli

More information about the Qgis-developer mailing list