version 1:
class worker(QtCore.QThread):
    trigger = QtCore.pyqtSignal(FunctionType,list,dict)


    def timer(self):
        import time
        print '1 sec'
        reactor.callLater(1,self.timer)


    def RCall(self,func,args,keys):
        print 'good'
        import time
        time.sleep(5)
        func(*args,**keys)
        
    def run(self):
        self.trigger.connect(self.RCall)
        self.MCall(mainWin.msgg)
        reactor.run(installSignalHandlers=0)


    def MCall(self, fun, *args, **keys):
        self.trigger.emit(fun,args,keys)



the version works , but what i confused is that the signal block the mainthread 
rather than the new thread.


version 2:


def RCall(func,args,keys):
    print 'good'
    import time
    time.sleep(5)
    func(*args,**keys)



class worker(QtCore.QThread):
    trigger = QtCore.pyqtSignal(FunctionType,list,dict)


    def timer(self):
        import time
        print '1 sec'
        reactor.callLater(1,self.timer)
        
    def run(self):
        self.trigger.connect(RCall)
        self.MCall(mainWin.msgg)
        reactor.run(installSignalHandlers=0)


    def MCall(self, fun, *args, **keys):
        self.trigger.emit(fun,args,keys)


the version DON'T WORK...  without any error, but the slot never triggered


version 3:


def RCall(func,args,keys):
    print 'good'
    import time
    time.sleep(5)
    func(*args,**keys)



class worker(QtCore.QThread):
    trigger = QtCore.pyqtSignal(FunctionType,list,dict)


    def timer(self):
        import time
        print '1 sec'
        reactor.callLater(1,self.timer)
        
    def run(self):
        self.MCall(mainWin.msgg)
        reactor.run(installSignalHandlers=0)


    def MCall(self, fun, *args, **keys):
        self.trigger.emit(fun,args,keys)




thread = worker()
thread.trigger.connect(RCall)


this version work perfectly.


now , What trouble me most is who will be the receiver of pyqtSignal exactly???
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to