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'.<br>
<br>If you prefer, I can implement this some time in the next week or so, but feel free to take a stab at it.<br><br>Evan<br><br><div class="gmail_quote">On Sat, Oct 9, 2010 at 4:45 PM, Fernando Perez <span dir="ltr"><<a href="http://fperez.net">fperez.net</a>@<a href="http://gmail.com">gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">On Sat, Oct 9, 2010 at 4:29 PM, Mark Voorhies <<a href="mailto:mark.voorhies@ucsf.edu">mark.voorhies@ucsf.edu</a>> wrote:<br>

><br>
> I think this would be easy. QTextEdit.toHtml() can dump the iPython<br>
> console as HTML, preserving mark-up.  The tricky bit is the images,<br>
> which get dumped like this:<br>
><br>
> <img src="867583393794" /><br>
><br>
> I'm assuming the number is Qt's internal ID for the image -- anyone<br>
> know how to map that back to the SVG/PNG objects in iPython?<br>
><br>
> Given the image references, should be easy to either embed PNG or SVG<br>
> or do something like Firefox's "Web Page, complete" (obviously, embedding or<br>
> linking SVGs would be prettier, but runs into more browser compatibility<br>
> issues).<br>
><br>
> If I can figure out how to resolve the IDs, I'll take a crack at this.<br>
<br>
Great, thanks!  You may want to look inside the payload handler that<br>
places the inline svgs.  That handler could perhaps get the qt id at<br>
that point, and store it in a dict member of the main object.  Upon<br>
saving, the dict would then easily be used to get back the reference<br>
to the image object, hence being able to write it out to disk in a<br>
foo_files/ directory like firefox does (or embedded in the html for<br>
single-file printouts, even better).<br>
<br>
Looking forward to your contributions!<br>
<div><div></div><div class="h5"><br>
Cheers,<br>
<br>
f<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></div></blockquote></div><br>