##// 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 425 var DOMWidgetView = WidgetView.extend({
428 426 initialize: function (parameters) {
429 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 597 var widget = {
601 598 'WidgetModel': WidgetModel,
@@ -100,7 +100,7 b' class Widget(LoggingConfigurable):'
100 100 #-------------------------------------------------------------------------
101 101 _model_name = Unicode('WidgetModel', help="""Name of the backbone model
102 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 104 to use to represent the widget.""", sync=True)
105 105 comm = Instance('IPython.kernel.comm.Comm')
106 106
@@ -368,10 +368,10 b' class Widget(LoggingConfigurable):'
368 368
369 369 def _ipython_display_(self, **kwargs):
370 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
372 # initial state is sent.
373 self._send({"method": "display"})
374 self._handle_displayed(**kwargs)
371 # Show view.
372 if self._view_name is not None:
373 self._send({"method": "display"})
374 self._handle_displayed(**kwargs)
375 375
376 376 def _send(self, msg):
377 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