mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-31 13:40:29 +08:00
Set default view to None and never display widget with no view
This commit is contained in:
parent
fb336de4ed
commit
a9fca81e95
@ -422,8 +422,6 @@ define(["widgets/js/manager",
|
||||
});
|
||||
|
||||
|
||||
widgetmanager.WidgetManager.register_widget_view('WidgetView', WidgetView);
|
||||
|
||||
var DOMWidgetView = WidgetView.extend({
|
||||
initialize: function (parameters) {
|
||||
// Public constructor
|
||||
@ -595,7 +593,6 @@ define(["widgets/js/manager",
|
||||
},
|
||||
});
|
||||
|
||||
widgetmanager.WidgetManager.register_widget_view('DOMWidgetView', DOMWidgetView);
|
||||
|
||||
var widget = {
|
||||
'WidgetModel': WidgetModel,
|
||||
|
@ -100,7 +100,7 @@ class Widget(LoggingConfigurable):
|
||||
#-------------------------------------------------------------------------
|
||||
_model_name = Unicode('WidgetModel', help="""Name of the backbone model
|
||||
registered in the front-end to create and sync this widget with.""")
|
||||
_view_name = Unicode('WidgetView', help="""Default view registered in the front-end
|
||||
_view_name = Unicode(None, allow_none=True, help="""Default view registered in the front-end
|
||||
to use to represent the widget.""", sync=True)
|
||||
comm = Instance('IPython.kernel.comm.Comm')
|
||||
|
||||
@ -368,10 +368,10 @@ class Widget(LoggingConfigurable):
|
||||
|
||||
def _ipython_display_(self, **kwargs):
|
||||
"""Called when `IPython.display.display` is called on the widget."""
|
||||
# Show view. By sending a display message, the comm is opened and the
|
||||
# initial state is sent.
|
||||
self._send({"method": "display"})
|
||||
self._handle_displayed(**kwargs)
|
||||
# Show view.
|
||||
if self._view_name is not None:
|
||||
self._send({"method": "display"})
|
||||
self._handle_displayed(**kwargs)
|
||||
|
||||
def _send(self, msg):
|
||||
"""Sends a message to the model in the front-end."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user