##// END OF EJS Templates
Removed require.js scheme since it forces async event driven model,...
Jonathan Frederic -
Show More
@@ -15,12 +15,9
15 15 * @submodule widget
16 16 */
17 17
18
19 18 "use strict";
20 19
21 20 // Only run once on a notebook.
22 require(["components/underscore/underscore-min",
23 "components/backbone/backbone-min"], function () {
24 21 if (IPython.notebook.widget_manager == undefined) {
25 22
26 23 //-----------------------------------------------------------------------
@@ -253,5 +250,4 require(["components/underscore/underscore-min",
253 250
254 251 IPython.notebook.widget_manager = new WidgetManager(IPython.notebook.kernel.comm_manager);
255 252
256 }
257 });
253 };
@@ -1,4 +1,3
1 require(["notebook/js/widget"], function () {
2 1 var ContainerModel = IPython.WidgetModel.extend({});
3 2 IPython.notebook.widget_manager.register_widget_model('container_widget', ContainerModel);
4 3
@@ -16,4 +15,3 require(["notebook/js/widget"], function () {
16 15 });
17 16
18 17 IPython.notebook.widget_manager.register_widget_view('ContainerView', ContainerView);
19 }); No newline at end of file
@@ -1,4 +1,3
1 require(["notebook/js/widget"], function () {
2 1 var FloatRangeWidgetModel = IPython.WidgetModel.extend({});
3 2 IPython.notebook.widget_manager.register_widget_model('FloatRangeWidgetModel', FloatRangeWidgetModel);
4 3
@@ -118,4 +117,3 require(["notebook/js/widget"], function () {
118 117 });
119 118
120 119 IPython.notebook.widget_manager.register_widget_view('FloatTextView', FloatTextView);
121 }); No newline at end of file
@@ -1,4 +1,3
1 require(["notebook/js/widget"], function () {
2 1 var IntRangeWidgetModel = IPython.WidgetModel.extend({});
3 2 IPython.notebook.widget_manager.register_widget_model('IntRangeWidgetModel', IntRangeWidgetModel);
4 3
@@ -116,4 +115,3 require(["notebook/js/widget"], function () {
116 115 });
117 116
118 117 IPython.notebook.widget_manager.register_widget_view('IntTextView', IntTextView);
119 }); No newline at end of file
@@ -1,4 +1,3
1 require(["notebook/js/widget"], function () {
2 1 var SelectionWidgetModel = IPython.WidgetModel.extend({});
3 2 IPython.notebook.widget_manager.register_widget_model('SelectionWidgetModel', SelectionWidgetModel);
4 3
@@ -127,4 +126,3 require(["notebook/js/widget"], function () {
127 126 });
128 127
129 128 IPython.notebook.widget_manager.register_widget_view('RadioButtonView', RadioButtonView);
130 }); No newline at end of file
@@ -1,4 +1,3
1 require(["notebook/js/widget"], function () {
2 1 var StringWidgetModel = IPython.WidgetModel.extend({});
3 2 IPython.notebook.widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel);
4 3
@@ -73,5 +72,3 require(["notebook/js/widget"], function () {
73 72 });
74 73
75 74 IPython.notebook.widget_manager.register_widget_view('TextboxView', TextboxView);
76
77 }); No newline at end of file
@@ -71,6 +71,8
71 71 <script src="{{static_url("components/jquery/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script>
72 72 <script src="{{static_url("components/jquery-ui/ui/minified/jquery-ui.min.js") }}" type="text/javascript" charset="utf-8"></script>
73 73 <script src="{{static_url("components/bootstrap/bootstrap/js/bootstrap.min.js") }}" type="text/javascript" charset="utf-8"></script>
74 <script src="{{static_url("components/underscore/underscore-min.js") }}" type="text/javascript" charset="utf-8"></script>
75 <script src="{{static_url("components/backbone/backbone-min.js") }}" type="text/javascript" charset="utf-8"></script>
74 76 <script src="{{static_url("base/js/namespace.js") }}" type="text/javascript" charset="utf-8"></script>
75 77 <script src="{{static_url("base/js/page.js") }}" type="text/javascript" charset="utf-8"></script>
76 78 <script src="{{static_url("auth/js/loginwidget.js") }}" type="text/javascript" charset="utf-8"></script>
@@ -1,4 +1,4
1 from base import Widget, init_widget_js
1 from base import Widget
2 2
3 3 from container import ContainerWidget
4 4 from float_range import FloatRangeWidget
@@ -1,4 +1,3
1
2 1 from copy import copy
3 2 from glob import glob
4 3 import uuid
@@ -124,6 +123,7 class Widget(LoggingConfigurable):
124 123 view_name = self.default_view_name
125 124
126 125 # Require traitlet specified widget js
126 self._require_js('static/notebook/js/widget.js')
127 127 for requirement in self.js_requirements:
128 128 self._require_js(requirement)
129 129
@@ -165,11 +165,4 class Widget(LoggingConfigurable):
165 165 def _require_js(self, js_path):
166 166 # Since we are loading requirements that must be loaded before this call
167 167 # returns, preform async js load.
168 display(Javascript(data="""
169 $.ajax({
170 url: '{0}',
171 async: false,
172 dataType: "script",
173 timeout: 1000, // Wait a maximum of one second for the script to load.
174 });
175 """.format(js_path))) No newline at end of file
168 display(Javascript(data='$.ajax({url: "%s", async: false, dataType: "script", timeout: 1000});' % js_path))
@@ -7,6 +7,6 from IPython.utils.javascript import display_all_js
7 7 class ContainerWidget(Widget):
8 8 target_name = Unicode('container_widget')
9 9 default_view_name = Unicode('ContainerView')
10 js_requirements = List(["notebook/js/widgets/container.js"])
10 js_requirements = List(["static/notebook/js/widgets/container.js"])
11 11
12 12 _keys = []
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js
7 7 class FloatRangeWidget(Widget):
8 8 target_name = Unicode('FloatRangeWidgetModel')
9 9 default_view_name = Unicode('FloatSliderView')
10 js_requirements = List(["notebook/js/widgets/float_range.js"])
10 js_requirements = List(["static/notebook/js/widgets/float_range.js"])
11 11 _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation']
12 12
13 13 value = Float(0.0)
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js
7 7 class IntRangeWidget(Widget):
8 8 target_name = Unicode('IntRangeWidgetModel')
9 9 default_view_name = Unicode('IntSliderView')
10 js_requirements = List(["notebook/js/widgets/int_range.js"])
10 js_requirements = List(["static/notebook/js/widgets/int_range.js"])
11 11 _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation']
12 12
13 13 value = Int(0)
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js
7 7 class SelectionWidget(Widget):
8 8 target_name = Unicode('SelectionWidgetModel')
9 9 default_view_name = Unicode('DropdownView')
10 js_requirements = List(["notebook/js/widgets/selection.js"])
10 js_requirements = List(["static/notebook/js/widgets/selection.js"])
11 11 _keys = ['value', 'values', 'disabled']
12 12
13 13 value = Unicode()
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js
7 7 class StringWidget(Widget):
8 8 target_name = Unicode('StringWidgetModel')
9 9 default_view_name = Unicode('TextboxView')
10 js_requirements = List(["notebook/js/widgets/string.js"])
10 js_requirements = List(["static/notebook/js/widgets/string.js"])
11 11 _keys = ['value', 'row_count', 'disabled']
12 12
13 13 value = Unicode()
General Comments 0
You need to be logged in to leave comments. Login now