qtconsole
qtconsole copied to clipboard
add an option to restore HTML support to qtconsole
Migrating issue from ipython/ipython/issues/10062
@ccordoba12 suggested to open a QDialog with a QWebView widget inside it to display HTML content in qtconsole?
Much of the desire for this is related to the HTML DataFrames in Pandas being human readable. see pandas-dev/pandas#14706
Thanks for migrating this issue. I have one problem with my own suggestion: we could end up opening a lot of Qdialog's and that could be messy for users.
@wmvanvliet, what do you think about this?
I think popping open dialogs for output would break the flow of using a console.
Longer term, we have suggested implementing a console in HTML & JS, and using Qt Webkit to embed this in Qt applications.
Ok, what if at the end of html output we show a link so that users can open these dialogs at will?
That is an interesting idea but I am not sure it would solve the issue which gave rise to my original ticket. If I understand you correctly you would need to click the link each time to show the object in HTML format. The reason I started looking into how to get this functionality back was specifically for DataFrames in Pandas. Analysts/scientists, such as myself, use the DataFrame output for an interactive and exploratory work-flow. The HTML DataFrames were much better formatted (in most cases) for this. If one would need to click a link each time there would be a significant level of annoyance relative to the original functionality. Would it be possible to set it up so that the user could set a white-list of objects which always automatically open the dialog? Users could then enable it for DataFrames and the rest would need a link clicked before shown.
Another idea is to show those links and a message saying how to open those dialogs automatically (else almost no one would activate this functionality).
@DrEhrfurchtgebietend, what do you think?
That seems even better to me. Assuming of course that the message in the Out[#] would not be so verbose that it annoys those who are not looking for that option.
Yep, that'd be the idea :-)
+1 for the link option for me. Lets keep the qtconsole a plain text console as much as possible.
A full HTML implementation of the console is already being worked on as part of JupyterLab I believe.
Maybe not worth it versus a jupyterlab console in a webengine widget, but using a qstackedlayout you can mix rich text and webengine widgets. Each input and output could be their own widget in the stack. Most of the widgets would just be the existing qtconsole richtext widgets, but when the output is HTML we could use webengine widgets.
The widgets in the stacks could even be limited in height and width so they could scroll content vertically and horizontally if the context need, like paging in some respects.
I was thinking to do something simpler: emit HTML content in a Qt signal that would be captured by apps embedding qtconsole widgets (like Spyder) and rendered in a Web viewer pane or widget.
I think that's how RStudio's Viewer pane works and it's really nice:
https://www.youtube.com/watch?v=wi2fUKqHtpM
I noticed this issue is still open. I am keen to render HTML objects without using Jupyter notebooks or lab either within the qtconsole or in a separate window. Is this still being considered?
Hey, am I in the right place here wondering why I can't do one of these in the qtconsole?
from IPython.display import display, HTML
display(HTML('<h1>Hello, world!</h1>'))
where the output is this:
<IPython.core.display.HTML object>
The actual thing I was trying to do was something like this
display(HTML(difflib.HtmlDiff().make_file(a, b)))
It sounds like the original reason for removing support in https://github.com/ipython/ipython/pull/5763 was "pandas felt that the HTML repr was bad". I agree with the comment in https://github.com/ipython/ipython/issues/10062
But we could have an off-by-default option to enable HTML in the QtConsole for users who prefer semi-supported HTML output to none at all.
although who does it harm to enable the HTML output for all by default? People who don't like it won't use it and I assume it's a niche thing to be working in a qtconsole and trying to view html.