<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="PostalCode"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="State"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="Street"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="address"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Tahoma;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>I was trying to get QxtSignalWaiter (<a
href="http://qtnode.net/wiki?title=QxtSignalWaiter">http://qtnode.net/wiki?title=QxtSignalWaiter</a>)
ported so I can use QHttp with a synchronous process. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>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. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>My invocation:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>self.w=SignalWaiter.QxtSignalWaiter(self.http,
'done(bool)')<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>self.http.get(getdata)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>self.w.wait2(5000)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>My implementation follows:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>from PyQt4.Qt import * <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>class QxtSignalWaiter(QObject):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> def
__init__(self, sender, signal):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> apply(QObject.__init__,
(self, ) + ())<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.connect(sender,
SIGNAL(signal), self, SLOT('signalCaught'))<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> def
wait1(self, sender, signal, msec):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> '''Returns
True if the signal was caught, returns False if the wait timed out'''<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> w=QxtSignalWaiter(sender,
signal)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> return
w.wait2(msec)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> def
wait2(self, msec):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> '''
Returns True if the signal was caught, returns False if the wait timed out'''<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> if(msec
< -1): <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> return
False<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> if(msec
!= -1): <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.timerID
= self.startTimer(msec)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.ready
= self.timeout = False<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> while(self.ready==False
and self.timeout==False):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>
QCoreApplication.processEvents(QEventLoop.WaitForMoreEvents)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.killTimer(self.timerID)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> return
self.ready or self.timeout<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> def
signalCaught(self):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> print
'signalCaught'<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.ready
= True<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> def
timerEvent(self, event):<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.killTimer(self.timerID)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> self.timeout
= True<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>---</span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>Regards,<br>
<br>
Jason Hihn</span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>Director of Software Engineering<br>
Eyemaginations, Inc.<br>
<br>
<st1:Street w:st="on"><st1:address w:st="on">600 Washington Ave, Suite #100</st1:address></st1:Street><br>
<st1:place w:st="on"><st1:City w:st="on">Towson</st1:City>, <st1:State w:st="on">MD</st1:State>
<st1:PostalCode w:st="on">21204</st1:PostalCode></st1:place><br>
Domestic: 877.321.5481 ext. 8617<br>
International: 410.321.5481 ext. 8617<br>
Fax: 410.616.8657<br>
jason@eyemaginations.com<br>
www.eyemaginations.com<br>
www.3d-eye.com<br>
<br>
=================================================<br>
The information transmitted within this email document or fax is intended only
for </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>the person(s) or entity to which it
is specifically addressed and may contain </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>confidential and/or privileged
material of Eyemaginations. Any re-creation, review, </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>distribution, retransmission,
dissemination or other use of, or taking of any action </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>in reliance upon, this information
by persons or entities other than the intended </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>parties is completely prohibited.
If you have received this email in error, please </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>contact the sender or author and
permanently delete and destroy the email from </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>any computer which houses its
contents. </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>=================================================</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>