[Qgis-developer] Use of PyQt QThread in QGIS Plugin

Martin Dobias wonder.sk at gmail.com
Mon Aug 15 04:07:16 EDT 2011


Hi Horst

On Sat, Aug 13, 2011 at 1:32 PM, Horst Düster <horst.duester at kappasys.ch> wrote:
> Hi
>
> I'm playing with use of PyQt QThreads in a plugin. But I'm not successful. I
> created a very simple plugin with the aim to understand the threading
> mechanisms of PyQt. The GUI collects number of iterations and the thread
> does nothing else than to iterate over this number. When I start the
> iteration process sometimes it works, but very slow.

What happens if it does not work? And how would you quantify the slowness?

> Sometimes the result
> will appear after closing and reopening the GUI.

This could be caused by the buffering mechanisms on standart output.
Maybe you will have more luck using standart error stream (stderr)
which should not be buffered - or by flushing the stream.

> I'm a little bit confused
> about these results. I appended the plugin. Maybe someone outside is able to
> help. I would appreciate an hint or help.

I have modified the code a bit so that I could run it without QGIS.
Everything worked as expected. I have attached the modified dialog
file - check out whether it will work better when run from outside
QGIS.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ThreadsDialog.py
Type: text/x-python
Size: 1344 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110815/778bfe3a/ThreadsDialog.py


More information about the Qgis-developer mailing list