diff --git a/IPython/html/static/notebook/js/widget.js b/IPython/html/static/notebook/js/widget.js index 80457bb40..6b3927c2a 100644 --- a/IPython/html/static/notebook/js/widget.js +++ b/IPython/html/static/notebook/js/widget.js @@ -22,7 +22,7 @@ // elsewhere. define(["components/underscore/underscore-min", "components/backbone/backbone-min", - ], function(){ + ], function(underscore, backbone){ //-------------------------------------------------------------------- @@ -480,6 +480,9 @@ define(["components/underscore/underscore-min", IPython.WidgetModel = WidgetModel; IPython.WidgetView = WidgetView; - IPython.widget_manager = new WidgetManager(); - + if (IPython.widget_manager==undefined || IPython.widget_manager==null) { + IPython.widget_manager = new WidgetManager(); + } + + return IPython.widget_manager; }); diff --git a/IPython/html/static/notebook/js/widgets/bool.js b/IPython/html/static/notebook/js/widgets/bool.js index 9a868256c..1f86b364c 100644 --- a/IPython/html/static/notebook/js/widgets/bool.js +++ b/IPython/html/static/notebook/js/widgets/bool.js @@ -14,10 +14,10 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var BoolWidgetModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('BoolWidgetModel', BoolWidgetModel); + widget_manager.register_widget_model('BoolWidgetModel', BoolWidgetModel); var CheckboxView = IPython.WidgetView.extend({ @@ -66,7 +66,7 @@ define(["notebook/js/widget"], function(){ }); - IPython.widget_manager.register_widget_view('CheckboxView', CheckboxView); + widget_manager.register_widget_view('CheckboxView', CheckboxView); var ToggleButtonView = IPython.WidgetView.extend({ @@ -119,6 +119,6 @@ define(["notebook/js/widget"], function(){ }, }); - IPython.widget_manager.register_widget_view('ToggleButtonView', ToggleButtonView); + widget_manager.register_widget_view('ToggleButtonView', ToggleButtonView); }); diff --git a/IPython/html/static/notebook/js/widgets/button.js b/IPython/html/static/notebook/js/widgets/button.js index bea17eb5d..ff9a9f66b 100644 --- a/IPython/html/static/notebook/js/widgets/button.js +++ b/IPython/html/static/notebook/js/widgets/button.js @@ -14,10 +14,10 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var ButtonWidgetModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('ButtonWidgetModel', ButtonWidgetModel); + widget_manager.register_widget_model('ButtonWidgetModel', ButtonWidgetModel); var ButtonView = IPython.WidgetView.extend({ @@ -51,6 +51,6 @@ define(["notebook/js/widget"], function(){ }); - IPython.widget_manager.register_widget_view('ButtonView', ButtonView); + widget_manager.register_widget_view('ButtonView', ButtonView); }); diff --git a/IPython/html/static/notebook/js/widgets/container.js b/IPython/html/static/notebook/js/widgets/container.js index 2d041af68..b89f57289 100644 --- a/IPython/html/static/notebook/js/widgets/container.js +++ b/IPython/html/static/notebook/js/widgets/container.js @@ -14,9 +14,9 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager) { var ContainerModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('ContainerWidgetModel', ContainerModel); + widget_manager.register_widget_model('ContainerWidgetModel', ContainerModel); var ContainerView = IPython.WidgetView.extend({ @@ -58,5 +58,5 @@ define(["notebook/js/widget"], function(){ }, }); - IPython.widget_manager.register_widget_view('ContainerView', ContainerView); + widget_manager.register_widget_view('ContainerView', ContainerView); }); \ No newline at end of file diff --git a/IPython/html/static/notebook/js/widgets/float.js b/IPython/html/static/notebook/js/widgets/float.js index d7ed1b065..86839b07e 100644 --- a/IPython/html/static/notebook/js/widgets/float.js +++ b/IPython/html/static/notebook/js/widgets/float.js @@ -14,7 +14,7 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var FloatWidgetModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('FloatWidgetModel', FloatWidgetModel); + widget_manager.register_widget_model('FloatWidgetModel', FloatWidgetModel); }); \ No newline at end of file diff --git a/IPython/html/static/notebook/js/widgets/int.js b/IPython/html/static/notebook/js/widgets/int.js index dae7a2f4e..46877ac0b 100644 --- a/IPython/html/static/notebook/js/widgets/int.js +++ b/IPython/html/static/notebook/js/widgets/int.js @@ -14,7 +14,7 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var IntWidgetModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('IntWidgetModel', IntWidgetModel); + widget_manager.register_widget_model('IntWidgetModel', IntWidgetModel); }); \ No newline at end of file diff --git a/IPython/html/static/notebook/js/widgets/multicontainer.js b/IPython/html/static/notebook/js/widgets/multicontainer.js index e678fbdbc..296d0169f 100644 --- a/IPython/html/static/notebook/js/widgets/multicontainer.js +++ b/IPython/html/static/notebook/js/widgets/multicontainer.js @@ -14,9 +14,9 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var MulticontainerModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('MulticontainerWidgetModel', MulticontainerModel); + widget_manager.register_widget_model('MulticontainerWidgetModel', MulticontainerModel); var AccordionView = IPython.WidgetView.extend({ @@ -97,7 +97,7 @@ define(["notebook/js/widget"], function(){ }, }); - IPython.widget_manager.register_widget_view('AccordionView', AccordionView); + widget_manager.register_widget_view('AccordionView', AccordionView); var TabView = IPython.WidgetView.extend({ @@ -174,5 +174,5 @@ define(["notebook/js/widget"], function(){ }, }); - IPython.widget_manager.register_widget_view('TabView', TabView); + widget_manager.register_widget_view('TabView', TabView); }); diff --git a/IPython/html/static/notebook/js/widgets/selection.js b/IPython/html/static/notebook/js/widgets/selection.js index e5ae5a385..77de43cd4 100644 --- a/IPython/html/static/notebook/js/widgets/selection.js +++ b/IPython/html/static/notebook/js/widgets/selection.js @@ -14,9 +14,9 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var SelectionWidgetModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('SelectionWidgetModel', SelectionWidgetModel); + widget_manager.register_widget_model('SelectionWidgetModel', SelectionWidgetModel); var DropdownView = IPython.WidgetView.extend({ @@ -106,7 +106,7 @@ define(["notebook/js/widget"], function(){ }); - IPython.widget_manager.register_widget_view('DropdownView', DropdownView); + widget_manager.register_widget_view('DropdownView', DropdownView); var RadioButtonsView = IPython.WidgetView.extend({ @@ -191,7 +191,7 @@ define(["notebook/js/widget"], function(){ }); - IPython.widget_manager.register_widget_view('RadioButtonsView', RadioButtonsView); + widget_manager.register_widget_view('RadioButtonsView', RadioButtonsView); var ToggleButtonsView = IPython.WidgetView.extend({ @@ -273,5 +273,5 @@ define(["notebook/js/widget"], function(){ }); - IPython.widget_manager.register_widget_view('ToggleButtonsView', ToggleButtonsView); + widget_manager.register_widget_view('ToggleButtonsView', ToggleButtonsView); }); diff --git a/IPython/html/static/notebook/js/widgets/string.js b/IPython/html/static/notebook/js/widgets/string.js index 2478b443c..d7c24823c 100644 --- a/IPython/html/static/notebook/js/widgets/string.js +++ b/IPython/html/static/notebook/js/widgets/string.js @@ -14,9 +14,9 @@ * @namespace IPython **/ -define(["notebook/js/widget"], function(){ +define(["notebook/js/widget"], function(widget_manager){ var StringWidgetModel = IPython.WidgetModel.extend({}); - IPython.widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel); + widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel); var LabelView = IPython.WidgetView.extend({ @@ -35,7 +35,7 @@ define(["notebook/js/widget"], function(){ }); - IPython.widget_manager.register_widget_view('LabelView', LabelView); + widget_manager.register_widget_view('LabelView', LabelView); var TextAreaView = IPython.WidgetView.extend({ @@ -89,7 +89,7 @@ define(["notebook/js/widget"], function(){ }, }); - IPython.widget_manager.register_widget_view('TextAreaView', TextAreaView); + widget_manager.register_widget_view('TextAreaView', TextAreaView); var TextBoxView = IPython.WidgetView.extend({ @@ -143,5 +143,5 @@ define(["notebook/js/widget"], function(){ }, }); - IPython.widget_manager.register_widget_view('TextBoxView', TextBoxView); + widget_manager.register_widget_view('TextBoxView', TextBoxView); });