Mikhail Titov <mlt-0UDz38MK/[email protected]> writes: > Mikhail Titov <mlt-0UDz38MK/[email protected]> > writes: > >> It seems that the thread I create in my plug-in is mostly dormant unless >> I have something like time.sleep(alot) running in Python console. Is it >> normal? I even tried to start QThread with QThread.HighPriority with the >> same result:( > > I'm not sure whether it is buffered IO or actually dormant thread > causing all the troubles. > > The ugly workaround just to make it ticking is to set up 5 seconds > QTimer in main GUI thread after auxiliary thread is started and use > time.sleep(10) and QCoreApplication.instance().processEvents() in > timeout handling slot. The GUI does block during that thus rendering > entire idea unusable.
I forgot that QTimer uses ms while sleep uses seconds. 2 seconds QTimer and time.sleep(.1) in handling slot _without_ processEvents() make everything work just fine. >> The module itself runs just fine when started outside of QGIS. >> >> Am I not supposed to create threads in python plug-ins? I thought it >> would be better rather than trying to dig around QCoreApplication to >> process events so GUI is not frozen. > > The bottom line is to create C++ plug-ins for multi-threaded tasks :( Apparently this statement is not quite correct. -- Mikhail _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
