-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Allow widgets to be constructed from Javascript #6664
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
Conversation
4385e16 to
6e7c109
Compare
|
Based on #6665 |
7d28287 to
281801e
Compare
|
@SylvainCorlay This https://github.com/ipython/ipython/pull/6664/files#diff-df42e22f1f926715f5932969a809e9f8R103 line is where you'd add logic to use the python registry you've made in your other PR. |
c4138dd to
6e66012
Compare
|
For an example, see this notebook: http://nbviewer.ipython.org/gist/jdfreder/aee9b2079fc41ddbb81d |
|
This is really cool. Works nicely for me. Indeed, it would be nice if it used the backend registry. |
|
Should I rebase the backend registry on this and add the functionality? |
|
I think you should wait to see which gets merged first. I'm fine rebasing on top of yours. |
6e66012 to
cf7f734
Compare
|
rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= null or delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both work in this context; however, I changed it to the later since your comment suggests that you prefer I use delete.
|
@minrk I addressed your review comments |
|
@minrk @takluyver @ellisonbg @SylvainCorlay @jasongrout @Carreau anyone want to review this some more? |
IPython/kernel/comm/manager.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't want to silently eat them. Log it?
|
@minrk comments addressed and a test has been added |
IPython/html/widgets/widget.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comms already have a primary bool that indicates whether they are the one that opens or is opened. Perhaps that should be relied upon here, rather than a duplicate flag that indicates the same information.
widget = widget_class(comm=comm)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. It turns out neither the open_comm or primary flags were needed here. 😄 Will ping back when removed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is failing the tests on Python 3, because .values() returns an unordered view. You have a couple of options: list(Widget.widgets.values())[0], or next(iter(Widget.widgets.values())).
|
@takluyver @minrk comments addressed , thanks! |
IPython/html/widgets/widget.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call this something more specific than target_name in the comm_open message, since it will now have content.target_name and content.data.target_name. How about widget_class?
|
@takluyver comments addressed |
|
Still having trouble with the JS tests on Travis: |
Also added initial state push callback.
Also added a test!
d4ae3b6 to
adfd377
Compare
adfd377 to
3dffe4a
Compare
Allow widgets to be constructed from Javascript
|
Thanks -not pinging- Thomas! |
Allow widgets to be constructed from Javascript
Also fixes a bug in the comm manager.