Skip to content

Conversation

@jdfreder
Copy link
Contributor

@jdfreder jdfreder commented Oct 9, 2014

Also fixes a bug in the comm manager.

@jdfreder
Copy link
Contributor Author

jdfreder commented Oct 9, 2014

Based on #6665

@jdfreder
Copy link
Contributor Author

jdfreder commented Oct 9, 2014

@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.

@jdfreder jdfreder force-pushed the symmetric_widg branch 2 times, most recently from c4138dd to 6e66012 Compare October 9, 2014 20:49
@jdfreder
Copy link
Contributor Author

jdfreder commented Oct 9, 2014

For an example, see this notebook: http://nbviewer.ipython.org/gist/jdfreder/aee9b2079fc41ddbb81d

@SylvainCorlay
Copy link
Member

This is really cool. Works nicely for me. Indeed, it would be nice if it used the backend registry.

@SylvainCorlay
Copy link
Member

Should I rebase the backend registry on this and add the functionality?

@jdfreder
Copy link
Contributor Author

jdfreder commented Oct 9, 2014

I think you should wait to see which gets merged first. I'm fine rebasing on top of yours.

@jdfreder
Copy link
Contributor Author

rebased

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

= null or delete?

Copy link
Contributor Author

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.

@jdfreder
Copy link
Contributor Author

@minrk I addressed your review comments

@jdfreder
Copy link
Contributor Author

@minrk @takluyver @ellisonbg @SylvainCorlay @jasongrout @Carreau anyone want to review this some more?

@jdfreder jdfreder added this to the 3.0 milestone Oct 22, 2014
Copy link
Member

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?

@jdfreder
Copy link
Contributor Author

@minrk comments addressed and a test has been added

Copy link
Member

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)

Copy link
Contributor Author

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...

@jdfreder jdfreder mentioned this pull request Oct 24, 2014
2 tasks
Copy link
Member

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())).

@jdfreder
Copy link
Contributor Author

@takluyver @minrk comments addressed , thanks!

Copy link
Member

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?

@jdfreder
Copy link
Contributor Author

@takluyver comments addressed

@takluyver
Copy link
Member

Still having trouble with the JS tests on Travis:

In /home/travis/virtualenv/python3.4.1/lib/python3.4/site-packages/IPython/html/tests/widgets/manager.js:0

fail: Error running cell:

---------------------------------------------------------------------------

IndexError Traceback (most recent call last)

<ipython-input-1-df61df64d794> in <module>()

1 from IPython.html.widgets import Widget

----> 2 widget = list(Widget.widgets.values())[0]

3 print(widget.model_id)

IndexError: list index out of range

In /home/travis/virtualenv/python3.4.1/lib/python3.4/site-packages/IPython/html/tests/widgets/manager.js:0

uncaughtError: TypeError: 'undefined' is not an object (evaluating 'this.get_output_cell(index).text.trim')

@jdfreder jdfreder force-pushed the symmetric_widg branch 3 times, most recently from d4ae3b6 to adfd377 Compare October 29, 2014 00:44
takluyver added a commit that referenced this pull request Oct 29, 2014
Allow widgets to be constructed from Javascript
@takluyver takluyver merged commit 8955317 into ipython:master Oct 29, 2014
@jdfreder
Copy link
Contributor Author

Thanks -not pinging- Thomas!

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Allow widgets to be constructed from Javascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants