-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
need standardized display
function for non-text data (e.g. arbitrary MIME types)
#3817
Comments
Images already act like Dicts (they are "arrays with properties"), so we may be most of the way there. With more detail on the specific behavior you're looking for, I can discuss more concretely. |
The data might have several representations, keyed by MIME types. For example, |
It would be best if we also had some way to query what output is currently supported. |
Let me propose the following. We add a new abstract type,
Also:
|
+1 I have a crude version of this in compose. A dictionary maps mime types to functions, so how a graphic is displayed can change depending on the context. It would be great if this was standardized in julia. One issue that might come up: there may be cases where a pushed display can display a particular mime type, but you would rather it didn't. Is there a nice way to push a display, while ignoring some mime types? |
Suppose I start a fresh Julia session, and say |
@dcjones, it would be simple to write a @timholy, in a fresh Julia session at the command line I'm not sure if we would have any display handlers registered, so |
We also probably want to make it easier to write base64-encoded strings, since I don't think we have a function for this now. Probably via a |
Suppose I've already said My point is much more about the return value: having How about a counterproposal: it returns |
@timholy, If you know you want to display using As long as you are running the Julia IPython kernel locally (on the same host/account as the notebook), then you are free to pop up windows and use event loops exactly like you are now; the I don't like your counterproposal because (a) I don't like losing type-stability and (b) returning "anything else" seems totally useless unless you know what display backend is being called, and if you know that then you might as well call that display backend directly. |
OK, maybe I don't understand the scope of what you're proposing. This is not about a new generic Basically, if it doesn't hinder or interact with |
@timholy, (And, if you want, ImageView can also define a |
Sounds as if we're fine. And sure, I'll be happy to add whatever for IPython notebook integration. |
I had a long discussion with the IPython guys (thanks @fperez), and they convinced me that my proposal is not really right. The
My feeling is that (Note that to query whether a given |
A few comments:
On the last point, I initially felt you got that backwards, but I find it growing on me. I guess the idea is that if you want mess with "handles," then you might as well have the user separate the initial display into two steps, display creation (which gives you one handle to the window/canvas/whatever) and rendering (which returns a handle to the actual object(s) being viewed in the display). |
@timholy, As to whether Basically, the logic here is that the user wants a way to say display this object in the richest format supported by this device and this type, and the information about what formats can be displayed belongs with the device (via |
On Thursday, July 25, 2013 03:57:45 PM Steven G. Johnson wrote:
I understand that. My point is that one can think of "repl_foo" as doing the But whatever. Just trying to be helpful. |
Looks like I can avoid the need for keyword args entirely, so no longer an issue. |
I've refined these ideas and implemented them in our Julia IPython kernel. See:
I made a few minor polishes to the above proposal. Following @JeffBezanson's suggestion, I use There are no more |
If people like this approach, I'm hoping to get something like this merged into And packages like ping @StefanKarpinski |
I will probably put back in the notion of a default display stack, rather than a single default display, so that you can easily push a display that only handles a small number of types and rely on other displays for the rest. My main other concern at this point is making it easier to add new MIME types, but I think this can be done by adding a lower-level interface without losing the simplicity of adding and using |
We need some kind of standardized
display(data)
API, wheredata
is aDict
mapping MIME types to data, for Julia programs to request output of non-text data.This is essential for good IPython support, but we can also support other display mechanisms (e.g. popping up Tk windows to display images).
@fperez, your experience would be helpful here.
The text was updated successfully, but these errors were encountered: