Ville Vainio <vivai...@gmail.com> wrote:
>  Has anyone implementing something like what the subject line
>  indicates?
> 
>  The idea:
> 
>  To run functions that execute a series of system commands without
>  blocking the ui, *and* without adding state machine logic.
> 
>  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

-- 
Nick Craig-Wood <n...@craig-wood.com> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to