##// END OF EJS Templates
Set default view to None and never display widget with no view
Sylvain Corlay -
Show More
@@ -422,8 +422,6 b' define(["widgets/js/manager",'
422 });
422 });
423
423
424
424
425 widgetmanager.WidgetManager.register_widget_view('WidgetView', WidgetView);
426
427 var DOMWidgetView = WidgetView.extend({
425 var DOMWidgetView = WidgetView.extend({
428 initialize: function (parameters) {
426 initialize: function (parameters) {
429 // Public constructor
427 // Public constructor
@@ -595,7 +593,6 b' define(["widgets/js/manager",'
595 },
593 },
596 });
594 });
597
595
598 widgetmanager.WidgetManager.register_widget_view('DOMWidgetView', DOMWidgetView);
599
596
600 var widget = {
597 var widget = {
601 'WidgetModel': WidgetModel,
598 'WidgetModel': WidgetModel,
@@ -100,7 +100,7 b' class Widget(LoggingConfigurable):'
100 #-------------------------------------------------------------------------
100 #-------------------------------------------------------------------------
101 _model_name = Unicode('WidgetModel', help="""Name of the backbone model
101 _model_name = Unicode('WidgetModel', help="""Name of the backbone model
102 registered in the front-end to create and sync this widget with.""")
102 registered in the front-end to create and sync this widget with.""")
103 _view_name = Unicode('WidgetView', help="""Default view registered in the front-end
103 _view_name = Unicode(None, allow_none=True, help="""Default view registered in the front-end
104 to use to represent the widget.""", sync=True)
104 to use to represent the widget.""", sync=True)
105 comm = Instance('IPython.kernel.comm.Comm')
105 comm = Instance('IPython.kernel.comm.Comm')
106
106
@@ -368,10 +368,10 b' class Widget(LoggingConfigurable):'
368
368
369 def _ipython_display_(self, **kwargs):
369 def _ipython_display_(self, **kwargs):
370 """Called when `IPython.display.display` is called on the widget."""
370 """Called when `IPython.display.display` is called on the widget."""
371 # Show view. By sending a display message, the comm is opened and the
371 # Show view.
372 # initial state is sent.
372 if self._view_name is not None:
373 self._send({"method": "display"})
373 self._send({"method": "display"})
374 self._handle_displayed(**kwargs)
374 self._handle_displayed(**kwargs)
375
375
376 def _send(self, msg):
376 def _send(self, msg):
377 """Sends a message to the model in the front-end."""
377 """Sends a message to the model in the front-end."""
General Comments 0
You need to be logged in to leave comments. Login now