<div dir="ltr">Hi Erik<div><br></div><div>I think you could use an asyncio.Future for this purpose. You can yield from the Future, and set its result upon arrival of the signal. I've concocted an example program that should show what I mean; it creates a 2-second timer which is waited on asynchronously, once its timeout fires the program exits:<br>
<br></div><div><div>    import quamash</div><div>    import asyncio</div><div>    from PyQt5.QtWidgets import *</div><div>    from PyQt5.QtCore import *</div><div><br></div><div><br></div><div>    @asyncio.coroutine</div>
<div>    def _go():</div><div>        def on_timeout():</div><div>            print('Timeout')</div><div>            fut.set_result(True)</div><div><br></div><div>        fut = asyncio.Future()</div><div>        timer = QTimer()</div>
<div>        timer.setSingleShot(True)</div><div>        timer.setInterval(2000)</div><div>        timer.start()</div><div>        timer.timeout.connect(on_timeout)</div><div>        print('Yielding until signal...')</div>
<div>        yield from fut</div><div>        print('Continuing execution after yield from')</div><div><br></div><div>    with quamash.QEventLoop(app=QApplication([])) as loop:</div><div>        w = QMainWindow()</div>
<div>        w.show()</div><div>        loop.run_until_complete(_go())</div><div>    print('Coroutine has ended')</div></div><div><br></div><div>HTH,</div><div>Arve</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Aug 7, 2014 at 12:31 AM, Erik Hvatum <span dir="ltr"><<a href="mailto:ice.rikh@gmail.com" target="_blank">ice.rikh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class=""><div><div><div>Thank you :)<br><br></div>A quick question to help as I dig into 
this: how might one go about "yield from wait_for_a_qt_signal"?  That 
is, I want my coroutine to resume execution when some certain signal is 
emitted.  Perhaps this desire indicates that I'm going about things the 
wrong way...<br><br></div>-Erik<br><br></div></div>PS: forgot to reply to the list the first time around<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 5, 2014 at 12:34 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Quamash, in the unix branch (<a href="https://github.com/aknuds1/quamash/tree/unix" target="_blank">https://github.com/aknuds1/quamash/tree/unix</a>), now works perfectly for thread and subprocess execution on OS X, Linux and Windows, I'm pleased to say. Would love some feedback.<span><font color="#888888"><div>


<br></div><div>Arve</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 1, 2014 at 3:12 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Now, even subprocess execution works. At least on Windows/PyQt, haven't tested on other platforms.<span><font color="#888888"><div>


<br></div><div>Arve</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 30, 2014 at 4:03 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Erik, Tamás, feel free to try my <a href="https://github.com/aknuds1/quamash" target="_blank">Quamash fork</a>, it's currently quite functional, except that subprocess execution is somehow broken.<span><font color="#888888"><div>



<br>
</div><div>Arve</div></font></span><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 27, 2014 at 1:34 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>





<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My fork is now semi-functional with Python 3.4 and PyQt 5. I can at least perform simple asynchronous tasks within a Qt application, but lots remain to implement.<span><font color="#888888"><div>





<br><div>Arve</div></div></font></span></div><div class="gmail_extra">
<br><br><div class="gmail_quote"><div>On Fri, Jun 27, 2014 at 9:24 AM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br></div>
<div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I've created a fork on GitHub: <a href="https://github.com/aknuds1/quamash" target="_blank">https://github.com/aknuds1/quamash</a>. Do you know where to locate information on writing an asyncio event loop though? Not sure where to begin.<div>







<br></div><div>Thanks,</div><div>Arve</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 26, 2014 at 9:30 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks. I'm thinking I might try to modify his code, if it isn't too much work.<span><font color="#888888"><div>







<br></div><div>Arve</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 26, 2014 at 7:32 PM, Tamás Bajusz <span dir="ltr"><<a href="mailto:gbtami@gmail.com" target="_blank">gbtami@gmail.com</a>></span> wrote:<br>








<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Unfortunately, I know that github project only. (<a href="https://github.com/harvimt/quamash" target="_blank">https://github.com/harvimt/quamash</a>)<br>








</div>Try to contact him at <a href="mailto:mark.harviston%40gmail.com" target="_blank">mark.harviston@gmail.com<br>
</a></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 26, 2014 at 7:27 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>









<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Tamás, has Mark Harviston's implementation been updated to work with the latest Python (3.4)? I think I read somewhere that it's based on an outdated API.</div>









<span><font color="#888888"><div><br></div><div>Arve</div></font></span><div><div><div class="gmail_extra">
<br><div class="gmail_quote">On Thu, Jun 26, 2014 at 6:29 PM, Tamás Bajusz <span dir="ltr"><<a href="mailto:gbtami@gmail.com" target="_blank">gbtami@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">










<div dir="ltr"><a href="http://haypo-notes.readthedocs.org/asyncio.html#replacing-the-event-loop" target="_blank">http://haypo-notes.readthedocs.org/asyncio.html#replacing-the-event-loop</a></div><div class="gmail_extra">










<br><br><div class="gmail_quote"><div><div>
On Thu, Jun 26, 2014 at 5:20 PM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">










<div><div>
<div dir="ltr">Hi guys<div><br></div><div>I am looking to integrate Python 3.4 <a href="https://docs.python.org/3/library/asyncio.html" target="_blank">asyncio</a> with Qt's event loop (via PyQt 5), specifically in order to asynchronously monitor output (stdout/stderr) from a child process. Maybe this is somewhat off-topic for this list, but can someone tell me if such integration exists (and works)?</div>












<div><br></div><div>Thanks,</div><div>Arve</div></div>
<br></div></div>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div>