[PySide] Signal emitted on a worker thread not being received by main thread
William Dias
william.dias at gmail.com
Mon Apr 8 17:01:12 CEST 2013
Hi,
I am facing an intermittent problem with my PySide application. I have a
GUI that spawns several threads that are responsible for sending photos to
a web server. The threads are created as shown bellow:
photoConnectionThread = QThread()
photoConnectionObject = http_connection.PhotoConnection(self.filename)
photoConnectionObject.photoStatus.connect(self.photoStatus)
photoConnectionObject.moveToThread(photoConnectionThread)
photoConnectionThread.started.connect(photoConnectionObject.work)
photoConnectionThread.finished.connect(self.threadFinished)
photoConnectionThread.start()
My worker thread tries to upload a photo only once and then emits a signal
to the main thread so that the status can be updated in a database.
def work(self):
logger.info("photo object created on thread " + str(self.thread()))
status = sendPhoto(self.filename)
self.photoStatus.emit(self.filename, status)
QThread.sleep(5)
logger.info("exiting thread " + str(self.thread()))
self.thread().exit(0)
The problem is that, sporadically, the main thread does not receive the
signal and consequently doesn't get the status updated.
Does anybody have any idea why this is happening?
I am using:
Python 2.7
PySide 1.1.1
Windows 7
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130408/0509f7d5/attachment.html>
More information about the PySide
mailing list