-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New display system #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New display system #243
Conversation
Amazing stuff! A couple of little points about docstrings:
|
Thanks for having a look. I just pushed fixes for these things. |
This looks really great. I've looked over some of it, and I have a few notes: core/display.pyin def display: core/displayhook.pydef compute_format_data: displaypub.pyin publish there is a zmqshell.pyZMQDisplayPublisher replace: |
Min, thanks for the comments. I have fixed these things. The display functions should remain functions as they are designed to be imported and used by users. I think this is a better approach than 1) polluting their namespace by default or 2) requiring them to do get_ipython first. I think we should probably move get_ipython to this model as well. I haven't fixed the session stuff, but will once your branch is merged and I rebase on top of that. |
Okay, that makes sense. You don't have to wait for my work to merge before making the change to the send pattern. The only changes I made have to do with being able to send a message twice, and tweaking the form of recv. That way, there's no reason for you to rebase, just use session.send(socket,...) instead of msg = session.msg(...)+socket.send_json(msg) in new sends, like you added in DisplayPublisher. |
This looks great, excellent work! Please go ahead and merge, once a few things (most fairly minor) are taken care of:
format_dict = self.shell.display_formatter.format(result) return format_dict can be changed to just return self.shell.display_formatter.format(result) no need to create a variable just to return it. Again, fabulous work. Thanks!! |
* Backend and frontend implementations. * plain text, html and svg handlers in the Qt console.
* New publish_display_data function. * backend_inline is using publish_display_data. * Documentation added.
* Top-level display function. * The follow MIME types are supports: text/plain, text/html, text/latex, image/png, image/svg+xml, application/json. * All display data is published to all frontends. * Currently the qtconsole handles text/plain, text/html and image/svg+xml data.
* Full PNG handling in the rich frontend. * Sympy printer now can render to latex->png.
* Moved the pprint attribute to PlainTextFormatter. * Added DisplayFormatter.plain_text_only for disabling all but the plain text formatting. This is now used by doctest_mode. * Remove result_display hook. * Fixed doctest_mode magic. * Refactored inline matplotlib backend to use new display system. * Added display formatter for matplotlib.figure.Figure objects. so the display system will show the svg for them. * Added display and display_png to the user's namespace in pylab. * Cleaned up pylabtools.py
* Added space after Out[] prompt and before png data to improve look. * Translating "operatorname" to "" when rendering latex using mathtext.
* InteractiveShell.instance() is only called one in core.display. * Fixed docstrings in displayhook. * displaypub is using print().
* getfigs added to replicate figure finding of pastefig. This function is auto-loaded in pylad mode. * display* functions now take *args to allow the display of multiple objects. * Updated %guiref magic to reflect display system.
I wrote a getfigs function that does what you want and display now takes *args. I fixed everything else as well and have merged. Thanks for the reviews everyone! |
Just to add - from a Python 3 point of view, it's not a big deal whether you use print_function. 2to3 doesn't seem to have any trouble converting print statements to functions. Of course, it can handle it as a function as well, but don't lose too much sleep over converting them manually. |
Hi,
This series of commits is a refactor and enhancement of the display system in IPython. This takes the idea of "display" present in sys.displayhook and generalizes it to handle different MIME types. The new display system has two parts:
There are two situations that trigger the display machinery to be triggered:
I have added display functions for matplotlib.figure.Figure which enables the displayhook and the display function to produce nice SVG output when fed a figure instance. In addition, the sympy profile can not pretty print and latex->png sympy expressions.
I will also post some nice qtconsole outputs that show examples of all of this.