[IPython-dev] Work on new Viz.Engine Fos
Fernando.Perez at berkeley.edu
Sun Oct 31 15:21:00 EDT 2010
these questions are best asked on the ipython-dev list, so that others
can both benefit from the discussion and contribute to it (often
others will be more knowledgeable than myself on specific topics).
I'm cc'ing the list here with the original question for full context.
There are two (well, three if you count the old 0.10.x threads-based
approach, but I'm ignoring that as we move forward and so should you,
if you value your sanity) models to consider in the 0.11.x development
- single-process, in-terminal ipython ("classic" ipython, if you
will): the gui handling is done by tying the gui event loop to calls
into PyOSInputHook. Relevant files:
# General support
# gtk specifics
# wx specifics
The details are toolkits-pecific, and you'll need to find what the
right steps are for pyglet, but the basic idea is always the same: tie
the toolkit's own event loop to sync with python's PyOSInputHoook,
which fires every time the terminal is ready to read user input.
- multi-process, zeromq-based ipython: in this case there's no
PyOSInputHook to fire, because there's no terminal waiting to read.
All inputs to the kernel arrive over the network from a different
process. In this case, a different approach is needed, based on the
same general idea: the toolkit's event loop is wired to operate on an
idle timer of some kind, the specifics being again toolkit-specific.
The details are in this file (see top-level docstring):
and for GTK this file has the particular class:
In summary, you'll want to figure out how to sync the pyglet event
loop in both scenarios: at the terminal with PyOS_InputHook and at the
multiprocess ipython with some kind of idle timer.
Let us know how it goes, and we'll be happy to include the generic
support in ipython proper so that we support pyglet in addition to the
major GUI toolkits.
On Thu, Oct 28, 2010 at 02:19, Stephan Gerhard <connectome at unidesign.ch> wrote:
> Hi Fernando,
> Hope you are doing fine!
> Eleftherios and me (you might remember me from HBM, the ConnectomeViewer
> guy ;) are currently working together on Fos, the new 3d scientific
> visualization engine for neuroimaging based on pyglet.
> We came across an issue that might be related to new developments of
> IPython and we wanted to make sure that we are going in the right
> direction. It is also about event loops, where you are more expert than
> both of us.
> We would like to be able to interact with the Fos viz window (derived
> pyglet.window.Window) from IPython without Fos blocking IPython. We
> looked into Sympy which seems to have solved this issue and we are
> trying to understand what they did.
> How could we benefit from the 2 processes model that IPython will
> implement? I read in an email that the event handling of IPython is
> going to change. How would this impact the solution that Sympy came up
> with for this problem?
> At some point, we might want to have a fos viz server running, and
> communicate with it over sockets to send geometry and commands. But I am
> not sure how this would fit in this picture. Probably zeromq might be
> helpful here. Do you know any good tutorial?
> Is there anything you can think of we should take care of?
> Well, many questions, but I hope this is fine for you :)
> Stephan & Eleftherios
More information about the IPython-dev