<HTML>
<HEAD>
<TITLE>Re: [PyQt] QThread, suggestions.</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I’m not sure why you would want to do this. You could just set up a QTimer to poll the Process to see if it was completed. The Qtimer func could then emit a finished signal. You could poll every second or so. You could even poll for percent complete if you have that information.<BR>
<BR>
Much easier than using a thread.<BR>
<BR>
Brian<BR>
<BR>
<BR>
On 1/29/09 10:34 AM, "Matt Smith" <<a href="melkor@orangepalantir.org">melkor@orangepalantir.org</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>It looks like I could just replace the QThread with a<BR>
multiprocess.Process except for the fact the QThread is a QObject which<BR>
uses signals and slots.<BR>
<BR>
If I want to use the same techniques I would have to start a Process in<BR>
a QThread to get similar behavior; a signal when finished. I suppose<BR>
the performance would be better if approached correctly.<BR>
<BR>
<BR>
thanks<BR>
mbs<BR>
<BR>
On Thu, 2009-01-29 at 04:45 -0800, Brian Kelley wrote:<BR>
> If you happen to be using python 2.6, multiprocessing is your friend.<BR>
><BR>
> <a href="http://docs.python.org/dev/library/multiprocessing.html">http://docs.python.org/dev/library/multiprocessing.html</a><BR>
><BR>
> It is very easy to use and because it runs in a separate process,<BR>
> there is no global interpreter lock. Way, way, way better than<BR>
> threading for a lot of cases. If it crashes, the main program doesn’t<BR>
> go down.<BR>
><BR>
> Brian<BR>
><BR>
><BR>
> On 1/27/09 2:01 PM, "Matt Smith" <<a href="melkor@orangepalantir.org">melkor@orangepalantir.org</a>> wrote:<BR>
><BR>
> In java they have the "SwingWorker" class and I thought of a<BR>
> way to<BR>
> implement something similar in python. Here is the code:<BR>
><BR>
> <a href="http://paste.pocoo.org/show/101578/">http://paste.pocoo.org/show/101578/</a><BR>
><BR>
> I use this for starting long running processes. Here is an<BR>
> example of<BR>
> how I have used it.<BR>
><BR>
> <a href="http://orangepalantir.org/files/threadworker.py">http://orangepalantir.org/files/threadworker.py</a><BR>
><BR>
> I was curious for some input, It seems threads are often<BR>
> abused and I<BR>
> don't want to be doing too much abusing.<BR>
><BR>
> mbs<BR>
><BR>
> _______________________________________________<BR>
> PyQt mailing list <a href="PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><BR>
> <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><BR>
><BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>