Show More
@@ -15,12 +15,9 | |||||
15 | * @submodule widget |
|
15 | * @submodule widget | |
16 | */ |
|
16 | */ | |
17 |
|
17 | |||
18 |
|
||||
19 | "use strict"; |
|
18 | "use strict"; | |
20 |
|
19 | |||
21 | // Only run once on a notebook. |
|
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 | } |
|
253 | }; | |
257 | }); |
|
@@ -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 | <script src="{{static_url("components/jquery/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script> |
|
71 | <script src="{{static_url("components/jquery/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script> | |
72 | <script src="{{static_url("components/jquery-ui/ui/minified/jquery-ui.min.js") }}" type="text/javascript" charset="utf-8"></script> |
|
72 | <script src="{{static_url("components/jquery-ui/ui/minified/jquery-ui.min.js") }}" type="text/javascript" charset="utf-8"></script> | |
73 | <script src="{{static_url("components/bootstrap/bootstrap/js/bootstrap.min.js") }}" type="text/javascript" charset="utf-8"></script> |
|
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 | <script src="{{static_url("base/js/namespace.js") }}" type="text/javascript" charset="utf-8"></script> |
|
76 | <script src="{{static_url("base/js/namespace.js") }}" type="text/javascript" charset="utf-8"></script> | |
75 | <script src="{{static_url("base/js/page.js") }}" type="text/javascript" charset="utf-8"></script> |
|
77 | <script src="{{static_url("base/js/page.js") }}" type="text/javascript" charset="utf-8"></script> | |
76 | <script src="{{static_url("auth/js/loginwidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
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 |
|
1 | from base import Widget | |
2 |
|
2 | |||
3 | from container import ContainerWidget |
|
3 | from container import ContainerWidget | |
4 | from float_range import FloatRangeWidget |
|
4 | from float_range import FloatRangeWidget |
@@ -1,4 +1,3 | |||||
1 |
|
||||
2 |
|
|
1 | from copy import copy | |
3 | from glob import glob |
|
2 | from glob import glob | |
4 | import uuid |
|
3 | import uuid | |
@@ -124,6 +123,7 class Widget(LoggingConfigurable): | |||||
124 | view_name = self.default_view_name |
|
123 | view_name = self.default_view_name | |
125 |
|
124 | |||
126 | # Require traitlet specified widget js |
|
125 | # Require traitlet specified widget js | |
|
126 | self._require_js('static/notebook/js/widget.js') | |||
127 | for requirement in self.js_requirements: |
|
127 | for requirement in self.js_requirements: | |
128 | self._require_js(requirement) |
|
128 | self._require_js(requirement) | |
129 |
|
129 | |||
@@ -165,11 +165,4 class Widget(LoggingConfigurable): | |||||
165 | def _require_js(self, js_path): |
|
165 | def _require_js(self, js_path): | |
166 | # Since we are loading requirements that must be loaded before this call |
|
166 | # Since we are loading requirements that must be loaded before this call | |
167 | # returns, preform async js load. |
|
167 | # returns, preform async js load. | |
168 | display(Javascript(data=""" |
|
168 | display(Javascript(data='$.ajax({url: "%s", async: false, dataType: "script", timeout: 1000});' % js_path)) | |
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 |
|
@@ -7,6 +7,6 from IPython.utils.javascript import display_all_js | |||||
7 | class ContainerWidget(Widget): |
|
7 | class ContainerWidget(Widget): | |
8 | target_name = Unicode('container_widget') |
|
8 | target_name = Unicode('container_widget') | |
9 | default_view_name = Unicode('ContainerView') |
|
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 | _keys = [] |
|
12 | _keys = [] |
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js | |||||
7 | class FloatRangeWidget(Widget): |
|
7 | class FloatRangeWidget(Widget): | |
8 | target_name = Unicode('FloatRangeWidgetModel') |
|
8 | target_name = Unicode('FloatRangeWidgetModel') | |
9 | default_view_name = Unicode('FloatSliderView') |
|
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 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation'] |
|
11 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation'] | |
12 |
|
12 | |||
13 | value = Float(0.0) |
|
13 | value = Float(0.0) |
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js | |||||
7 | class IntRangeWidget(Widget): |
|
7 | class IntRangeWidget(Widget): | |
8 | target_name = Unicode('IntRangeWidgetModel') |
|
8 | target_name = Unicode('IntRangeWidgetModel') | |
9 | default_view_name = Unicode('IntSliderView') |
|
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 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation'] |
|
11 | _keys = ['value', 'step', 'max', 'min', 'disabled', 'orientation'] | |
12 |
|
12 | |||
13 | value = Int(0) |
|
13 | value = Int(0) |
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js | |||||
7 | class SelectionWidget(Widget): |
|
7 | class SelectionWidget(Widget): | |
8 | target_name = Unicode('SelectionWidgetModel') |
|
8 | target_name = Unicode('SelectionWidgetModel') | |
9 | default_view_name = Unicode('DropdownView') |
|
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 | _keys = ['value', 'values', 'disabled'] |
|
11 | _keys = ['value', 'values', 'disabled'] | |
12 |
|
12 | |||
13 | value = Unicode() |
|
13 | value = Unicode() |
@@ -7,7 +7,7 from IPython.utils.javascript import display_all_js | |||||
7 | class StringWidget(Widget): |
|
7 | class StringWidget(Widget): | |
8 | target_name = Unicode('StringWidgetModel') |
|
8 | target_name = Unicode('StringWidgetModel') | |
9 | default_view_name = Unicode('TextboxView') |
|
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 | _keys = ['value', 'row_count', 'disabled'] |
|
11 | _keys = ['value', 'row_count', 'disabled'] | |
12 |
|
12 | |||
13 | value = Unicode() |
|
13 | value = Unicode() |
General Comments 0
You need to be logged in to leave comments.
Login now