On Jul 23, 11:29 pm, Nick Craig-Wood <n...@craig-wood.com> wrote: > > The syntax would be something like: > > > def work(): > > > showstatus("building") > > r = yield runshell("make") > > showstatus("installing") > > r = yield runshell("make install") > > showstatus("Success") > > > mygui.startwork(work) > > # returns immediately, runs work() gradually in the background. > > > The catch is that showstatus() would need to be run in the mainloop, > > so running the whole thing in a thread is a no-go. > > > I imagine runshell() would be implemented in terms of QProcess, or > > subprocess.Popen/os.system and a worker thread. > > > Anyone done this already, or do I have to roll my own? > > You might want to look at twisted, in particular > > http://twistedmatrix.com/trac/wiki/DeferredGenerator
Indeed, DeferredGenerator looks pretty much what I'm interested in, thanks for the pointer. Unfortunately, it has the big Twisted dependency. That's probably not a showstopper, but Twisted requires a degree of buy-in when something smaller would do. -- http://mail.python.org/mailman/listinfo/python-list