| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Status update: I'm working on nbconvert support. Investigating using require.js's optimizer. |
Sorry, something went wrong.
|
Status update: r.js optimization success. Both embeded and external widget JS works with nbconvert output. |
Sorry, something went wrong.
|
Status update: The last commit adds a new fab js command. |
Sorry, something went wrong.
|
Status update: Widgets will now reconnect on page refresh. |
Sorry, something went wrong.
|
So if there is a kernel running, and you refresh the page, it will reconnect with the currently-running kernel? Could there be missed messages? What happens if there were missed messages? |
Sorry, something went wrong.
Hi @jasongrout ! Very glad you came to check-in on this. I was going to ping you for your feedback after making another review pass- I don't want to break any of your single cell server stuff and I value your feedback with the widget stuff because it has helped a lot so far! Yeah, that's how it's intended to work. Messages shouldn't be lost- I've added a closure that is created if the underlying socket hasn't been created yet. If that's the case, the closure(s) get called when the sockets are reconnected. If the kernel is new, i.e. a kernel restart, I don't attempt to create any widgets in the back-end. So if you save your notebook with widgets, close ipython, start ipython, and open the same notebook, the widgets will display (with "disabled" = true) but any messages at that point will be discarded (an error will appear in the sys console saying that comm id blah blah doesn't exist). |
Sorry, something went wrong.
|
closure here - https://github.com/ipython/ipython/pull/5900/files#diff-d66a08bcdaaf950c48f42fb08f5bc189L155 |
Sorry, something went wrong.
|
Thanks; I've been keeping a close watch on this, though I haven't been looking at the code. I hope to soon, though. |
Sorry, something went wrong.
|
@ellisonbg when it's convenient, could you post the text from our in person review here? |
Sorry, something went wrong.
|
notebook.js
codecell.js
On Thu, Jun 5, 2014 at 4:55 PM, Jonathan Frederic notifications@github.com
Brian E. Granger |
Sorry, something went wrong.
|
It would probably make sense to not disable widgets when the comm is closed, but notify the user via a broken link icon or something like this. Indeed, in the case when certain widget models are linked on the JavaScript side (Using things like @jasongrout 's link widget), it would make sense to keep the widgets active to maintain this interaction even if the comm is closed. |
Sorry, something went wrong.
|
I talked to @SylvainCorlay in person and I agree, I shouldn't use disabled for the reason he mentions above. How about using http://fontawesome.io/icon/chain-broken/ to symbolize the link is broken? |
Sorry, something went wrong.
|
This PR will wait for the PR's @SylvainCorlay mentions. I'll rebase this after they are merged and then I'll implement a comm_alive trait or something similar and use the link icon to denote whether or not the widget is running in a detached state. |
Sorry, something went wrong.
There was a problem hiding this comment.
Re-add this line
Sorry, something went wrong.
There was a problem hiding this comment.
In case where view is not a DOMWidgetView, one should probably not make the widget area visible. Calling view.trigger('displayed') after this line should do the job right?
Sorry, something went wrong.
There was a problem hiding this comment.
How about instead of depending on the class hierarchy to determine visibility, just appending view.el if view.el is not null? (or not falsey?)
Sorry, something went wrong.
There was a problem hiding this comment.
Because backbone always has an element...
Sorry, something went wrong.
There was a problem hiding this comment.
backbone views initially set an element, but if I change it, is it ever changed back? What if, in my constructor, I set the this.el to null?
Sorry, something went wrong.
There was a problem hiding this comment.
That would be another method.
In any case, view.trigger('displayed') should be added after the element is appended to the DOM because other things depend on this event, and the line thiswidget_area.show() should probably be removed.
Sorry, something went wrong.
|
There are still a few things to be done here, in addition to the comments above:
|
Sorry, something went wrong.
There was a problem hiding this comment.
It's generally not a good idea to call methods like this on import. A better place is probably in the init stages of the interactive shell object (e.g. init_comm, which already exists).
Sorry, something went wrong.
|
Following the hangout of yesterday on this matter with @ellisonbg @minrk @takluyver @jdfreder and @jasongrout . One of the reservations of @minrk against the persistence of model states in the notebook file format is that it seems to imply that we would need future versions of IPython's widgets to be compatible with these models. However, the "nbconverted" notebook embeds the optimized version of the JavaScript code, meaning that it will always be usable regardless of the changes in IPython's code. Readablility of the file only depends on the ability of future browsers to execute today's JavaScript. We would only be sensible to changes in IPython code when loading a notebook ipynb file with a different version of ipython. In doing so, there would not be incremental backward incompatibility due to the persistence. (Backward incompatibility is already introduced when changing the Python API of widgets anyway.) |
Sorry, something went wrong.
|
This PR is probably going to be broken into small bites as described in the For 3.0 section of the widget Trello: https://trello.com/b/5Xaj8Z7j/widgets |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Widgets are persisted to a widgets key in the notebook json and widgets key in the cell json for now. Works with page refresh and kernel restart. Widgets are disabled when the comm connection is lost. Persistence also works with nbconvert html output. When the page is refreshed, the Widgets attempt to reconnect to their counterparts in the back-end.
The default nbconvert html output dumps the necessary JS file into the same folder as the output:
nbc notebook.ipynb --to html
To embed the necessary Javascript into your nbconvert output (no extra files):
nbc notebook.ipynb --to html --InlineHTMLPreprocessor.inline_js=True
Enabling these behaviors in nbconvert requires the developers to install r.js via npm and fun fab js in the html directory whenever changes are made to the widget framework.