Hi all,

this may be a pure python question or QT related, I'm not sure:
I am having trouble with a decorated function not reporting back to the main thread to drive progress bars etc. When I remove the decorator and use the respective code directly in the function in question it all works fine.

My code looks sort of like this (heavily simplified):

   class ThreadManager(object):
        def __init__(self, parent):
            self.worker = Worker()
            self.workerThread = QtCore.QThread(parent)
            self.worker.moveToThread(self.workerThread)

        def start(self):
            self.workerThread.start()

   class Worker(QtCore.QObject):
        def myMethod(self):
                someClassInstance.doHeavyLifting()



In my main code I connect signals from *someClassInstance* that indicate progress during the heavy lifting, so that they drive progress bars in the UI.
So far so good.

Now I am wanting to use a decorator on *myMethod(self)*, i.e.:

   class Worker(QtCore.QObject):

        @testDec
        def myMethod(self):
                someClassInstance.doHeavyLifting()



where testDec looks like this:

   def testDec(fn):
        def addTest(self):
            print 'inside decorator', self
            fn(self)
        return addTest


The moment I do that, the threaded process does not report back to the main thread, so the progress bars sit at 0% until the process returns, then jump to 100%

What am I missing?

Cheers,
frank


--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing <http://ohufx.com/compositing.html> | *workflow customisation and consulting <http://ohufx.com/customising.html>* *

_______________________________________________
PySide mailing list
PySide@qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to