diff --git a/plotly/package_data/graphWidget.js b/plotly/package_data/graphWidget.js index 4395d6e2b1a..151ceff2445 100644 --- a/plotly/package_data/graphWidget.js +++ b/plotly/package_data/graphWidget.js @@ -5,17 +5,8 @@ window.genUID = function() { }); }; -var IPYTHON_VERSION = '3'; -require(["widgets/js/widget", "widgets/js/manager"], function (widget, manager) { - if (!('DOMWidgetView' in widget)) { - - // we're in IPython2, things moved a bit from 2 --> 3. - // construct the expected IPython3 widget API - IPYTHON_VERSION = '2'; - manager = {WidgetManager: widget}; - widget = {DOMWidgetView: IPython.DOMWidgetView}; - } +define('graphWidget', ["@jupyter-widgets/base"], function (widget) { var GraphView = widget.DOMWidgetView.extend({ render: function(){ @@ -159,7 +150,9 @@ require(["widgets/js/widget", "widgets/js/manager"], function (widget, manager) }); // Register the GraphView with the widget manager. - manager.WidgetManager.register_widget_view('GraphView', GraphView); + return { + GraphView: GraphView + } }); diff --git a/plotly/widgets/graph_widget.py b/plotly/widgets/graph_widget.py index f7eb0a86084..451adf223bd 100644 --- a/plotly/widgets/graph_widget.py +++ b/plotly/widgets/graph_widget.py @@ -9,8 +9,8 @@ from requests.compat import json as _json # TODO: protected imports? -from IPython.html import widgets -from IPython.utils.traitlets import Unicode +import ipywidgets as widgets +from traitlets import Unicode from IPython.display import Javascript, display import plotly.plotly.plotly as py @@ -33,6 +33,7 @@ class GraphWidget(widgets.DOMWidget): Notebooks. """ _view_name = Unicode('GraphView', sync=True) + _view_module = Unicode('graphWidget', sync=True) _message = Unicode(sync=True) _graph_url = Unicode(sync=True) _new_url = Unicode(sync=True)