[IPython-dev] Re: Some notebook thoughts
Robert Kern
rkern at ucsd.edu
Mon Jul 4 17:19:20 EDT 2005
Torsten Marek wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I read with great pleasure that XML has been taken instead of Python as the
> markup language for Notebook. It's not that the same goal could not be reached
> with Python, but XML gives you a whole lot of stuff for free when it comes to
> parsing.
>
> I added some user stories to the wiki and I'd like to elaborate on them more
> generally:
>
> When I thought about the notebook GUI, I doubted that any existing text editor
> widget might be flexible enough to be used for what I had in mind. There are
> "normal" text areas (In [xx]s and Out [xx]s), but there are a lot of other
> widgets (I just call them like that, but a fancy term like notebooklets might be
> better), for any kind of picture, tables, comments, rich texts, code fragment
> editors, pretty-printed data structures, other widgets, MathML ... you name it.
>
> For each widget type (and In and Out would also be widgets), there is a
> node-type in the markup file and a handler in the renderer (be it a static one
> to HTML, LaTeX, PDF, SVG or a GUI interface). The mininum interface would be
> handlers for In, Out and a handler for stuff from print statements.
>
> For a GUI that supports all kinds of widgets, a canvas widget like OGL (from Wx)
> or QCanvas (from Qt) might be a better choice. However, for a small
> implementation, Scintilla might be enough, as long as the underlying
> architecture is flexible enough.
>
> Am I making any sense with that or is that too far out in the woods?
A little too far into the woods, I think. :-)
I think that we can do everything that we need to do with a decent rich
text editor that shows images. Tables, comments, rich texts, code
fragment editors, and pretty-printed data structures are all text.
Pictures, SVG, embedded LaTeX formulae, MathML, movies, Kiva contexts,
etc. can all be shown as static pictures for display. Clicking on them
could activate editors or viewers in other windows. It doesn't have to
look gorgeous on-screen; it just has to be functional.
That said, Scintilla ultimately won't be the widget of choice. It
doesn't show images, and it really doesn't do HTML-like rich text well
either. It is really only suited for syntax highlighted source code
editors. For my personal use, that actually won't be too bad. If I can
write reST as my text between In/Out cells, using indentation to control
the nesting of those cells in the document, I will really be quite
happy. But we, as a whole, really do want to be able to show embedded
images and have real rich text.
It's the nesting of those cells within rich text that kills the idea of
implementing it all on a QCanvas or similar object. We *don't* want to
rewrite a rich text editor widget. One idea is to simply have a linear
arrangement of cells: Rich Text, In, In, Out, In, Rich Text, In, Out,
etc. each cell getting it's own widget layed out in, e.g. a
wx.ScrolledWindow. That model fails, however, when (In , In, Out, In)
are actually supposed to be three levels down:
<document>
<section>
<section>
<paragraph>
Stuff
<In>
<In>
<Out>
<In>
<paragraph>
More stuff.
The situation might be recoverable, but it's going to be easier on us if
we can shove everything into a single rich text editor widget.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the IPython-dev
mailing list