[IPython-dev] Status of IPython+GUI+Threads+PyOS_InputHook
Ville M. Vainio
Sat Feb 7 10:38:45 CST 2009
On Sat, Feb 7, 2009 at 6:00 PM, Brian Granger <email@example.com> wrote:
> 1. The IPython Core and any GUI event loop must be run in the same
> thread and that thread must be the main thread if IPython is to offer
> interactive GUI support.
Depends what you mean by "IPython core". The important thing is that
every line entered by the user gets run in the gui mainloop (which is
what the current threaded shells do).
> 2. PyOS_InputHook allows a function to be registered that will be
> called periodically (by readline) while input is being entered at the
> command line. This opens the door for GUI event loops to continue
> running while a command line IPython is waiting for input. This is
> only relevant for terminal based IPython shells though.
> Does Wx support this?
I don't know - probably not. On linux, wx is based on gtk so with
future gtk it could work.
> If not, can we implement this ourselves?
See above ;-).
> work. Has anyone figured this out? Is PyOS_InputHook relevent for
> non-teminal based IPython frontends?
It's not relevant at all. Since you control the event loop, there is
no "input blocking", so the hack that PyOS_InputHook is can be
> In other words: can we get rid of the messy threading code in
> IPython?!!! (please say yes)
Definitely yes, we can (and it's long overdue).
> 3. SIgnals. I know that one of the most subtle aspect of IPython is
> getting signals working in the multithreaded shells. How does this
> change if we move to using PyOS_InputHook rather than our current GUI
We just have to disable the crash handler, the event loop typically
deals with ctrl+C itself.
> 4. There is an IPython commit by Darren Dale saying that the
> PyOS_InputHook approach wasn't working fully, so it was disabled. Did
> we get to the bottom of this?
Wasn't it about pdb?
Ville M. Vainio
More information about the IPython-dev