[PyQt] QxtSignalWaiter port

Jason Hihn jason at eyemaginations.com
Tue Jul 24 20:32:55 BST 2007

I was trying to get QxtSignalWaiter
(http://qtnode.net/wiki?title=QxtSignalWaiter) ported so I can use QHttp
with a synchronous process. 


The problem I am having is wait2()'s while never ends before the timeout,
meaning self.ready is always false, so it waits for the entire duration. 


My invocation:

self.w=SignalWaiter.QxtSignalWaiter(self.http, 'done(bool)')




My implementation follows:

from PyQt4.Qt import * 


class QxtSignalWaiter(QObject):

            def __init__(self, sender, signal):

                        apply(QObject.__init__, (self, ) + ())

                        self.connect(sender, SIGNAL(signal), self,


            def wait1(self, sender, signal, msec):

                        '''Returns True if the signal was caught, returns
False if the wait timed out'''

                        w=QxtSignalWaiter(sender, signal)

                        return w.wait2(msec)


            def wait2(self, msec):

                        ''' Returns True if the signal was caught, returns
False if the wait timed out'''

                        if(msec < -1): 

                                    return False


                        if(msec != -1): 

                                    self.timerID = self.startTimer(msec)


                        self.ready = self.timeout = False

                        while(self.ready==False and self.timeout==False):




                        return self.ready or self.timeout


            def signalCaught(self):

                        print 'signalCaught'

                        self.ready = True


            def timerEvent(self, event):


                        self.timeout = True





Jason Hihn

Director of Software Engineering
Eyemaginations, Inc.

600 Washington Ave, Suite #100
Towson, MD 21204
Domestic: 877.321.5481 ext. 8617
International: 410.321.5481 ext. 8617
Fax: 410.616.8657
jason at eyemaginations.com

The information transmitted within this email document or fax is intended
only for 

the person(s) or entity to which it is specifically addressed and may

confidential and/or privileged material of Eyemaginations. Any re-creation,

distribution, retransmission, dissemination or other use of, or taking of
any action 

in reliance upon, this information by persons or entities other than the

parties is completely prohibited. If you have received this email in error,

contact the sender or author and permanently delete and destroy the email

any computer which houses its contents. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070724/34eb70fb/attachment.html

More information about the PyQt mailing list