[IPython-dev] Printing support enabled
Sat Oct 9 20:39:20 CDT 2010
Fernando has the right idea. Look at the _process_execute_payload,
_add_image, and _get_image methods of RichIPythonWidget to see how QImages
and SVG data are indexed. Since the QTextDocument does not have a mechanism
for retrieving all of it's resources, the image IDs will have to be stored
manually in '_add_image'.
If you prefer, I can implement this some time in the next week or so, but
feel free to take a stab at it.
On Sat, Oct 9, 2010 at 4:45 PM, Fernando Perez <firstname.lastname@example.org> wrote:
> On Sat, Oct 9, 2010 at 4:29 PM, Mark Voorhies <email@example.com>
> > I think this would be easy. QTextEdit.toHtml() can dump the iPython
> > console as HTML, preserving mark-up. The tricky bit is the images,
> > which get dumped like this:
> > <img src="867583393794" />
> > I'm assuming the number is Qt's internal ID for the image -- anyone
> > know how to map that back to the SVG/PNG objects in iPython?
> > Given the image references, should be easy to either embed PNG or SVG
> > or do something like Firefox's "Web Page, complete" (obviously, embedding
> > linking SVGs would be prettier, but runs into more browser compatibility
> > issues).
> > If I can figure out how to resolve the IDs, I'll take a crack at this.
> Great, thanks! You may want to look inside the payload handler that
> places the inline svgs. That handler could perhaps get the qt id at
> that point, and store it in a dict member of the main object. Upon
> saving, the dict would then easily be used to get back the reference
> to the image object, hence being able to write it out to disk in a
> foo_files/ directory like firefox does (or embedded in the html for
> single-file printouts, even better).
> Looking forward to your contributions!
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev