[IPython-dev] Printing support enabled
Sat Oct 9 18:45:38 CDT 2010
On Sat, Oct 9, 2010 at 4:29 PM, Mark Voorhies <email@example.com> wrote:
> 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 or
> linking SVGs would be prettier, but runs into more browser compatibility
> 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!
More information about the IPython-dev