##// END OF EJS Templates
Remove init_widget_js, use require.js for everything...
Jonathan Frederic -
Show More
@@ -14,7 +14,8 b''
14 // as injecting require.js make marked not to put itself in the globals,
14 // as injecting require.js make marked not to put itself in the globals,
15 // which make both this file fail at setting marked configuration, and textcell.js
15 // which make both this file fail at setting marked configuration, and textcell.js
16 // which search marked into global.
16 // which search marked into global.
17 require(['components/marked/lib/marked'],
17 require(['components/marked/lib/marked',
18 'notebook/js/widgets/basic_widgets'],
18
19
19 function (marked) {
20 function (marked) {
20
21
@@ -1295,11 +1295,13 b' var IPython = (function (IPython) {'
1295
1295
1296
1296
1297 /**
1297 /**
1298 * Once a session is started, link the code cells to the kernel
1298 * Once a session is started, link the code cells to the kernel and pass the
1299 * comm manager to the widget manager
1299 *
1300 *
1300 */
1301 */
1301 Notebook.prototype._session_started = function(){
1302 Notebook.prototype._session_started = function(){
1302 this.kernel = this.session.kernel;
1303 this.kernel = this.session.kernel;
1304 IPython.widget_manager.attach_comm_manager(this.kernel.comm_manager);
1303 var ncells = this.ncells();
1305 var ncells = this.ncells();
1304 for (var i=0; i<ncells; i++) {
1306 for (var i=0; i<ncells; i++) {
1305 var cell = this.get_cell(i);
1307 var cell = this.get_cell(i);
@@ -24,8 +24,6 b' define(["components/underscore/underscore-min",'
24 "components/backbone/backbone-min",
24 "components/backbone/backbone-min",
25 ], function(){
25 ], function(){
26
26
27 // Only run once on a notebook.
28 if (IPython.notebook.widget_manager == undefined) {
29
27
30 //--------------------------------------------------------------------
28 //--------------------------------------------------------------------
31 // WidgetModel class
29 // WidgetModel class
@@ -73,8 +71,8 b' define(["components/underscore/underscore-min",'
73
71
74 // Send buffer if this message caused another message to be
72 // Send buffer if this message caused another message to be
75 // throttled.
73 // throttled.
76 if (this.msg_buffer != null) {
74 if (this.msg_buffer != null &&
77 if (this.msg_throttle == this.pending_msgs &&
75 this.msg_throttle == this.pending_msgs &&
78 this.msg_buffer.length > 0) {
76 this.msg_buffer.length > 0) {
79
77
80 var output_area = this._get_msg_output_area(msg);
78 var output_area = this._get_msg_output_area(msg);
@@ -89,7 +87,6 b' define(["components/underscore/underscore-min",'
89 --this.pending_msgs;
87 --this.pending_msgs;
90 }
88 }
91 }
89 }
92 }
93 },
90 },
94
91
95
92
@@ -421,8 +418,8 b' define(["components/underscore/underscore-min",'
421 //--------------------------------------------------------------------
418 //--------------------------------------------------------------------
422 // WidgetManager class
419 // WidgetManager class
423 //--------------------------------------------------------------------
420 //--------------------------------------------------------------------
424 var WidgetManager = function(comm_manager){
421 var WidgetManager = function(){
425 this.comm_manager = comm_manager;
422 this.comm_manager = null;
426 this.widget_model_types = {};
423 this.widget_model_types = {};
427 this.widget_view_types = {};
424 this.widget_view_types = {};
428
425
@@ -436,10 +433,22 b' define(["components/underscore/underscore-min",'
436 }
433 }
437
434
438
435
436 WidgetManager.prototype.attach_comm_manager = function (comm_manager) {
437 this.comm_manager = comm_manager;
438
439 // Register already register widget model types with the comm manager.
440 for (var widget_model_name in this.widget_model_types) {
441 this.comm_manager.register_target(widget_model_name, $.proxy(this.handle_com_open, this));
442 }
443 }
444
445
439 WidgetManager.prototype.register_widget_model = function (widget_model_name, widget_model_type) {
446 WidgetManager.prototype.register_widget_model = function (widget_model_name, widget_model_type) {
440 // Register the widget with the comm manager. Make sure to pass this object's context
447 // Register the widget with the comm manager. Make sure to pass this object's context
441 // in so `this` works in the call back.
448 // in so `this` works in the call back.
449 if (this.comm_manager!=null) {
442 this.comm_manager.register_target(widget_model_name, $.proxy(this.handle_com_open, this));
450 this.comm_manager.register_target(widget_model_name, $.proxy(this.handle_com_open, this));
451 }
443 this.widget_model_types[widget_model_name] = widget_model_type;
452 this.widget_model_types[widget_model_name] = widget_model_type;
444 }
453 }
445
454
@@ -462,7 +471,6 b' define(["components/underscore/underscore-min",'
462 IPython.WidgetModel = WidgetModel;
471 IPython.WidgetModel = WidgetModel;
463 IPython.WidgetView = WidgetView;
472 IPython.WidgetView = WidgetView;
464
473
465 IPython.notebook.widget_manager = new WidgetManager(IPython.notebook.kernel.comm_manager);
474 IPython.widget_manager = new WidgetManager();
466
475
467 };
468 });
476 });
@@ -1,8 +1,8 b''
1
1
2 require(["notebook/js/widget"], function(){
2 define(["notebook/js/widget"], function(){
3
3
4 var BoolWidgetModel = IPython.WidgetModel.extend({});
4 var BoolWidgetModel = IPython.WidgetModel.extend({});
5 IPython.notebook.widget_manager.register_widget_model('BoolWidgetModel', BoolWidgetModel);
5 IPython.widget_manager.register_widget_model('BoolWidgetModel', BoolWidgetModel);
6
6
7 var CheckboxView = IPython.WidgetView.extend({
7 var CheckboxView = IPython.WidgetView.extend({
8
8
@@ -51,7 +51,7 b' require(["notebook/js/widget"], function(){'
51
51
52 });
52 });
53
53
54 IPython.notebook.widget_manager.register_widget_view('CheckboxView', CheckboxView);
54 IPython.widget_manager.register_widget_view('CheckboxView', CheckboxView);
55
55
56 var ToggleButtonView = IPython.WidgetView.extend({
56 var ToggleButtonView = IPython.WidgetView.extend({
57
57
@@ -104,6 +104,6 b' require(["notebook/js/widget"], function(){'
104 },
104 },
105 });
105 });
106
106
107 IPython.notebook.widget_manager.register_widget_view('ToggleButtonView', ToggleButtonView);
107 IPython.widget_manager.register_widget_view('ToggleButtonView', ToggleButtonView);
108
108
109 });
109 });
@@ -1,8 +1,8 b''
1
1
2 require(["notebook/js/widget"], function(){
2 define(["notebook/js/widget"], function(){
3
3
4 var ButtonWidgetModel = IPython.WidgetModel.extend({});
4 var ButtonWidgetModel = IPython.WidgetModel.extend({});
5 IPython.notebook.widget_manager.register_widget_model('ButtonWidgetModel', ButtonWidgetModel);
5 IPython.widget_manager.register_widget_model('ButtonWidgetModel', ButtonWidgetModel);
6
6
7 var ButtonView = IPython.WidgetView.extend({
7 var ButtonView = IPython.WidgetView.extend({
8
8
@@ -34,6 +34,6 b' require(["notebook/js/widget"], function(){'
34
34
35 });
35 });
36
36
37 IPython.notebook.widget_manager.register_widget_view('ButtonView', ButtonView);
37 IPython.widget_manager.register_widget_view('ButtonView', ButtonView);
38
38
39 });
39 });
@@ -1,6 +1,6 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var ContainerModel = IPython.WidgetModel.extend({});
2 var ContainerModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('ContainerWidgetModel', ContainerModel);
3 IPython.widget_manager.register_widget_model('ContainerWidgetModel', ContainerModel);
4
4
5 var ContainerView = IPython.WidgetView.extend({
5 var ContainerView = IPython.WidgetView.extend({
6
6
@@ -42,5 +42,5 b' require(["notebook/js/widget"], function(){'
42 },
42 },
43 });
43 });
44
44
45 IPython.notebook.widget_manager.register_widget_view('ContainerView', ContainerView);
45 IPython.widget_manager.register_widget_view('ContainerView', ContainerView);
46 }); No newline at end of file
46 });
@@ -1,4 +1,4 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var FloatWidgetModel = IPython.WidgetModel.extend({});
2 var FloatWidgetModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('FloatWidgetModel', FloatWidgetModel);
3 IPython.widget_manager.register_widget_model('FloatWidgetModel', FloatWidgetModel);
4 }); No newline at end of file
4 });
@@ -1,6 +1,6 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var FloatRangeWidgetModel = IPython.WidgetModel.extend({});
2 var FloatRangeWidgetModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('FloatRangeWidgetModel', FloatRangeWidgetModel);
3 IPython.widget_manager.register_widget_model('FloatRangeWidgetModel', FloatRangeWidgetModel);
4
4
5 var FloatSliderView = IPython.WidgetView.extend({
5 var FloatSliderView = IPython.WidgetView.extend({
6
6
@@ -97,7 +97,7 b' require(["notebook/js/widget"], function(){'
97 },
97 },
98 });
98 });
99
99
100 IPython.notebook.widget_manager.register_widget_view('FloatSliderView', FloatSliderView);
100 IPython.widget_manager.register_widget_view('FloatSliderView', FloatSliderView);
101
101
102
102
103 var FloatTextView = IPython.WidgetView.extend({
103 var FloatTextView = IPython.WidgetView.extend({
@@ -188,7 +188,7 b' require(["notebook/js/widget"], function(){'
188 }
188 }
189 });
189 });
190
190
191 IPython.notebook.widget_manager.register_widget_view('FloatTextView', FloatTextView);
191 IPython.widget_manager.register_widget_view('FloatTextView', FloatTextView);
192
192
193
193
194 var ProgressView = IPython.WidgetView.extend({
194 var ProgressView = IPython.WidgetView.extend({
@@ -235,5 +235,5 b' require(["notebook/js/widget"], function(){'
235
235
236 });
236 });
237
237
238 IPython.notebook.widget_manager.register_widget_view('ProgressView', ProgressView);
238 IPython.widget_manager.register_widget_view('ProgressView', ProgressView);
239 });
239 });
@@ -1,4 +1,4 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var IntWidgetModel = IPython.WidgetModel.extend({});
2 var IntWidgetModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('IntWidgetModel', IntWidgetModel);
3 IPython.widget_manager.register_widget_model('IntWidgetModel', IntWidgetModel);
4 }); No newline at end of file
4 });
@@ -1,6 +1,6 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var IntRangeWidgetModel = IPython.WidgetModel.extend({});
2 var IntRangeWidgetModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('IntRangeWidgetModel', IntRangeWidgetModel);
3 IPython.widget_manager.register_widget_model('IntRangeWidgetModel', IntRangeWidgetModel);
4
4
5 var IntSliderView = IPython.WidgetView.extend({
5 var IntSliderView = IPython.WidgetView.extend({
6
6
@@ -97,7 +97,7 b' require(["notebook/js/widget"], function(){'
97 },
97 },
98 });
98 });
99
99
100 IPython.notebook.widget_manager.register_widget_view('IntSliderView', IntSliderView);
100 IPython.widget_manager.register_widget_view('IntSliderView', IntSliderView);
101
101
102 var IntTextView = IPython.WidgetView.extend({
102 var IntTextView = IPython.WidgetView.extend({
103
103
@@ -187,5 +187,5 b' require(["notebook/js/widget"], function(){'
187 }
187 }
188 });
188 });
189
189
190 IPython.notebook.widget_manager.register_widget_view('IntTextView', IntTextView);
190 IPython.widget_manager.register_widget_view('IntTextView', IntTextView);
191 });
191 });
@@ -1,6 +1,6 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var MulticontainerModel = IPython.WidgetModel.extend({});
2 var MulticontainerModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('MulticontainerWidgetModel', MulticontainerModel);
3 IPython.widget_manager.register_widget_model('MulticontainerWidgetModel', MulticontainerModel);
4
4
5 var AccordionView = IPython.WidgetView.extend({
5 var AccordionView = IPython.WidgetView.extend({
6
6
@@ -57,7 +57,7 b' require(["notebook/js/widget"], function(){'
57 },
57 },
58 });
58 });
59
59
60 IPython.notebook.widget_manager.register_widget_view('AccordionView', AccordionView);
60 IPython.widget_manager.register_widget_view('AccordionView', AccordionView);
61
61
62 var TabView = IPython.WidgetView.extend({
62 var TabView = IPython.WidgetView.extend({
63
63
@@ -134,6 +134,6 b' require(["notebook/js/widget"], function(){'
134 },
134 },
135 });
135 });
136
136
137 IPython.notebook.widget_manager.register_widget_view('TabView', TabView);
137 IPython.widget_manager.register_widget_view('TabView', TabView);
138
138
139 });
139 });
@@ -1,6 +1,6 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var SelectionWidgetModel = IPython.WidgetModel.extend({});
2 var SelectionWidgetModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('SelectionWidgetModel', SelectionWidgetModel);
3 IPython.widget_manager.register_widget_model('SelectionWidgetModel', SelectionWidgetModel);
4
4
5 var DropdownView = IPython.WidgetView.extend({
5 var DropdownView = IPython.WidgetView.extend({
6
6
@@ -80,7 +80,7 b' require(["notebook/js/widget"], function(){'
80
80
81 });
81 });
82
82
83 IPython.notebook.widget_manager.register_widget_view('DropdownView', DropdownView);
83 IPython.widget_manager.register_widget_view('DropdownView', DropdownView);
84
84
85 var RadioButtonsView = IPython.WidgetView.extend({
85 var RadioButtonsView = IPython.WidgetView.extend({
86
86
@@ -165,7 +165,7 b' require(["notebook/js/widget"], function(){'
165
165
166 });
166 });
167
167
168 IPython.notebook.widget_manager.register_widget_view('RadioButtonsView', RadioButtonsView);
168 IPython.widget_manager.register_widget_view('RadioButtonsView', RadioButtonsView);
169
169
170
170
171 var ToggleButtonsView = IPython.WidgetView.extend({
171 var ToggleButtonsView = IPython.WidgetView.extend({
@@ -247,5 +247,5 b' require(["notebook/js/widget"], function(){'
247
247
248 });
248 });
249
249
250 IPython.notebook.widget_manager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
250 IPython.widget_manager.register_widget_view('ToggleButtonsView', ToggleButtonsView);
251 });
251 });
@@ -1,6 +1,6 b''
1 require(["notebook/js/widget"], function(){
1 define(["notebook/js/widget"], function(){
2 var StringWidgetModel = IPython.WidgetModel.extend({});
2 var StringWidgetModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel);
3 IPython.widget_manager.register_widget_model('StringWidgetModel', StringWidgetModel);
4
4
5 var LabelView = IPython.WidgetView.extend({
5 var LabelView = IPython.WidgetView.extend({
6
6
@@ -19,7 +19,7 b' require(["notebook/js/widget"], function(){'
19
19
20 });
20 });
21
21
22 IPython.notebook.widget_manager.register_widget_view('LabelView', LabelView);
22 IPython.widget_manager.register_widget_view('LabelView', LabelView);
23
23
24 var TextAreaView = IPython.WidgetView.extend({
24 var TextAreaView = IPython.WidgetView.extend({
25
25
@@ -73,7 +73,7 b' require(["notebook/js/widget"], function(){'
73 },
73 },
74 });
74 });
75
75
76 IPython.notebook.widget_manager.register_widget_view('TextAreaView', TextAreaView);
76 IPython.widget_manager.register_widget_view('TextAreaView', TextAreaView);
77
77
78 var TextBoxView = IPython.WidgetView.extend({
78 var TextBoxView = IPython.WidgetView.extend({
79
79
@@ -127,5 +127,5 b' require(["notebook/js/widget"], function(){'
127 },
127 },
128 });
128 });
129
129
130 IPython.notebook.widget_manager.register_widget_view('TextBoxView', TextBoxView);
130 IPython.widget_manager.register_widget_view('TextBoxView', TextBoxView);
131 });
131 });
@@ -1,4 +1,4 b''
1 from .widget import Widget, init_widget_js
1 from .widget import Widget
2
2
3 from .widget_bool import BoolWidget
3 from .widget_bool import BoolWidget
4 from .widget_button import ButtonWidget
4 from .widget_button import ButtonWidget
@@ -26,19 +26,6 b' from IPython.utils.traitlets import Unicode, Dict, List, Instance, Bool'
26 from IPython.display import Javascript, display
26 from IPython.display import Javascript, display
27 from IPython.utils.py3compat import string_types
27 from IPython.utils.py3compat import string_types
28
28
29 #-----------------------------------------------------------------------------
30 # Shared
31 #-----------------------------------------------------------------------------
32 def init_widget_js():
33 path = os.path.split(os.path.abspath( __file__ ))[0]
34 for filepath in glob(os.path.join(path, "*.py")):
35 filename = os.path.split(filepath)[1]
36 name = filename.rsplit('.', 1)[0]
37 if not (name == 'widget' or name == '__init__') and name.startswith('widget_'):
38 # Remove 'widget_' from the start of the name before compiling the path.
39 js_path = 'static/notebook/js/widgets/%s.js' % name[7:]
40 display(Javascript(data='$.getScript($("body").data("baseProjectUrl") + "%s");' % js_path), exclude="text/plain")
41
42
29
43 #-----------------------------------------------------------------------------
30 #-----------------------------------------------------------------------------
44 # Classes
31 # Classes
@@ -18,85 +18,11 b''
18 "collapsed": false,
18 "collapsed": false,
19 "input": [
19 "input": [
20 "from IPython.html import widgets # Widget definitions\n",
20 "from IPython.html import widgets # Widget definitions\n",
21 "from IPython.display import display # Used to display widgets in the notebook\n",
21 "from IPython.display import display # Used to display widgets in the notebook"
22 "\n",
23 "# Enable widgets in this notebook\n",
24 "widgets.init_widget_js()"
25 ],
22 ],
26 "language": "python",
23 "language": "python",
27 "metadata": {},
24 "metadata": {},
28 "outputs": [
25 "outputs": [],
29 {
30 "javascript": [
31 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/button.js\");"
32 ],
33 "metadata": {},
34 "output_type": "display_data"
35 },
36 {
37 "javascript": [
38 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int_range.js\");"
39 ],
40 "metadata": {},
41 "output_type": "display_data"
42 },
43 {
44 "javascript": [
45 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/string.js\");"
46 ],
47 "metadata": {},
48 "output_type": "display_data"
49 },
50 {
51 "javascript": [
52 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/multicontainer.js\");"
53 ],
54 "metadata": {},
55 "output_type": "display_data"
56 },
57 {
58 "javascript": [
59 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/bool.js\");"
60 ],
61 "metadata": {},
62 "output_type": "display_data"
63 },
64 {
65 "javascript": [
66 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int.js\");"
67 ],
68 "metadata": {},
69 "output_type": "display_data"
70 },
71 {
72 "javascript": [
73 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/selection.js\");"
74 ],
75 "metadata": {},
76 "output_type": "display_data"
77 },
78 {
79 "javascript": [
80 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float.js\");"
81 ],
82 "metadata": {},
83 "output_type": "display_data"
84 },
85 {
86 "javascript": [
87 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float_range.js\");"
88 ],
89 "metadata": {},
90 "output_type": "display_data"
91 },
92 {
93 "javascript": [
94 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/container.js\");"
95 ],
96 "metadata": {},
97 "output_type": "display_data"
98 }
99 ],
100 "prompt_number": 1
26 "prompt_number": 1
101 },
27 },
102 {
28 {
@@ -141,7 +67,7 b''
141 " \n",
67 " \n",
142 " // Define the FileModel and register it with the widget manager.\n",
68 " // Define the FileModel and register it with the widget manager.\n",
143 " var FileModel = IPython.WidgetModel.extend({});\n",
69 " var FileModel = IPython.WidgetModel.extend({});\n",
144 " IPython.notebook.widget_manager.register_widget_model('FileWidgetModel', FileModel);\n",
70 " IPython.widget_manager.register_widget_model('FileWidgetModel', FileModel);\n",
145 " \n",
71 " \n",
146 " // Define the FilePickerView\n",
72 " // Define the FilePickerView\n",
147 " var FilePickerView = IPython.WidgetView.extend({\n",
73 " var FilePickerView = IPython.WidgetView.extend({\n",
@@ -176,7 +102,7 b''
176 " });\n",
102 " });\n",
177 " \n",
103 " \n",
178 " // Register the DatePickerView with the widget manager.\n",
104 " // Register the DatePickerView with the widget manager.\n",
179 " IPython.notebook.widget_manager.register_widget_view('FilePickerView', FilePickerView);\n",
105 " IPython.widget_manager.register_widget_view('FilePickerView', FilePickerView);\n",
180 "});"
106 "});"
181 ],
107 ],
182 "language": "python",
108 "language": "python",
@@ -189,7 +115,7 b''
189 " \n",
115 " \n",
190 " // Define the FileModel and register it with the widget manager.\n",
116 " // Define the FileModel and register it with the widget manager.\n",
191 " var FileModel = IPython.WidgetModel.extend({});\n",
117 " var FileModel = IPython.WidgetModel.extend({});\n",
192 " IPython.notebook.widget_manager.register_widget_model('FileWidgetModel', FileModel);\n",
118 " IPython.widget_manager.register_widget_model('FileWidgetModel', FileModel);\n",
193 " \n",
119 " \n",
194 " // Define the FilePickerView\n",
120 " // Define the FilePickerView\n",
195 " var FilePickerView = IPython.WidgetView.extend({\n",
121 " var FilePickerView = IPython.WidgetView.extend({\n",
@@ -202,7 +128,6 b''
202 " },\n",
128 " },\n",
203 " \n",
129 " \n",
204 " // Handles: User input\n",
130 " // Handles: User input\n",
205 " events: { \"change\" : \"handleFileChange\" }, \n",
206 " handleFileChange: function(evt) { \n",
131 " handleFileChange: function(evt) { \n",
207 " \n",
132 " \n",
208 " //Retrieve the first (and only!) File from the FileList object\n",
133 " //Retrieve the first (and only!) File from the FileList object\n",
@@ -225,13 +150,13 b''
225 " });\n",
150 " });\n",
226 " \n",
151 " \n",
227 " // Register the DatePickerView with the widget manager.\n",
152 " // Register the DatePickerView with the widget manager.\n",
228 " IPython.notebook.widget_manager.register_widget_view('FilePickerView', FilePickerView);\n",
153 " IPython.widget_manager.register_widget_view('FilePickerView', FilePickerView);\n",
229 "});"
154 "});"
230 ],
155 ],
231 "metadata": {},
156 "metadata": {},
232 "output_type": "display_data",
157 "output_type": "display_data",
233 "text": [
158 "text": [
234 "<IPython.core.display.Javascript at 0x2fa80d0>"
159 "<IPython.core.display.Javascript at 0x319fe90>"
235 ]
160 ]
236 }
161 }
237 ],
162 ],
@@ -1,5 +1,11 b''
1 {
1 {
2 "metadata": {
2 "metadata": {
3 "cell_tags": [
4 [
5 "<None>",
6 null
7 ]
8 ],
3 "name": ""
9 "name": ""
4 },
10 },
5 "nbformat": 3,
11 "nbformat": 3,
@@ -11,7 +17,7 b''
11 "cell_type": "markdown",
17 "cell_type": "markdown",
12 "metadata": {},
18 "metadata": {},
13 "source": [
19 "source": [
14 "To enable the use IPython widgets in the notebook, the widget namespace and display function need to be imported. The Javascript dependencies need to be loaded via `IPython.html.widgets.init_widget_js()`. This method needs to be called each time the notebook webpage is refreshed."
20 "To use IPython widgets in the notebook, the widget namespace and display function need to be imported."
15 ]
21 ]
16 },
22 },
17 {
23 {
@@ -19,85 +25,11 b''
19 "collapsed": false,
25 "collapsed": false,
20 "input": [
26 "input": [
21 "from IPython.html import widgets # Widget definitions\n",
27 "from IPython.html import widgets # Widget definitions\n",
22 "from IPython.display import display # Used to display widgets in the notebook\n",
28 "from IPython.display import display # Used to display widgets in the notebook"
23 "\n",
24 "# Enable widgets in this notebook\n",
25 "widgets.init_widget_js()"
26 ],
29 ],
27 "language": "python",
30 "language": "python",
28 "metadata": {},
31 "metadata": {},
29 "outputs": [
32 "outputs": [],
30 {
31 "javascript": [
32 "$.getScript(\"/static/notebook/js/widgets/bool.js\");"
33 ],
34 "metadata": {},
35 "output_type": "display_data"
36 },
37 {
38 "javascript": [
39 "$.getScript(\"/static/notebook/js/widgets/int_range.js\");"
40 ],
41 "metadata": {},
42 "output_type": "display_data"
43 },
44 {
45 "javascript": [
46 "$.getScript(\"/static/notebook/js/widgets/int.js\");"
47 ],
48 "metadata": {},
49 "output_type": "display_data"
50 },
51 {
52 "javascript": [
53 "$.getScript(\"/static/notebook/js/widgets/selection.js\");"
54 ],
55 "metadata": {},
56 "output_type": "display_data"
57 },
58 {
59 "javascript": [
60 "$.getScript(\"/static/notebook/js/widgets/string.js\");"
61 ],
62 "metadata": {},
63 "output_type": "display_data"
64 },
65 {
66 "javascript": [
67 "$.getScript(\"/static/notebook/js/widgets/float.js\");"
68 ],
69 "metadata": {},
70 "output_type": "display_data"
71 },
72 {
73 "javascript": [
74 "$.getScript(\"/static/notebook/js/widgets/container.js\");"
75 ],
76 "metadata": {},
77 "output_type": "display_data"
78 },
79 {
80 "javascript": [
81 "$.getScript(\"/static/notebook/js/widgets/multicontainer.js\");"
82 ],
83 "metadata": {},
84 "output_type": "display_data"
85 },
86 {
87 "javascript": [
88 "$.getScript(\"/static/notebook/js/widgets/button.js\");"
89 ],
90 "metadata": {},
91 "output_type": "display_data"
92 },
93 {
94 "javascript": [
95 "$.getScript(\"/static/notebook/js/widgets/float_range.js\");"
96 ],
97 "metadata": {},
98 "output_type": "display_data"
99 }
100 ],
101 "prompt_number": 1
33 "prompt_number": 1
102 },
34 },
103 {
35 {
@@ -1,5 +1,11 b''
1 {
1 {
2 "metadata": {
2 "metadata": {
3 "cell_tags": [
4 [
5 "<None>",
6 null
7 ]
8 ],
3 "name": ""
9 "name": ""
4 },
10 },
5 "nbformat": 3,
11 "nbformat": 3,
@@ -12,85 +18,11 b''
12 "collapsed": false,
18 "collapsed": false,
13 "input": [
19 "input": [
14 "from IPython.html import widgets # Widget definitions\n",
20 "from IPython.html import widgets # Widget definitions\n",
15 "from IPython.display import display # Used to display widgets in the notebook\n",
21 "from IPython.display import display # Used to display widgets in the notebook"
16 "\n",
17 "# Enable widgets in this notebook\n",
18 "widgets.init_widget_js()"
19 ],
22 ],
20 "language": "python",
23 "language": "python",
21 "metadata": {},
24 "metadata": {},
22 "outputs": [
25 "outputs": [],
23 {
24 "javascript": [
25 "$.getScript(\"/static/notebook/js/widgets/bool.js\");"
26 ],
27 "metadata": {},
28 "output_type": "display_data"
29 },
30 {
31 "javascript": [
32 "$.getScript(\"/static/notebook/js/widgets/int_range.js\");"
33 ],
34 "metadata": {},
35 "output_type": "display_data"
36 },
37 {
38 "javascript": [
39 "$.getScript(\"/static/notebook/js/widgets/int.js\");"
40 ],
41 "metadata": {},
42 "output_type": "display_data"
43 },
44 {
45 "javascript": [
46 "$.getScript(\"/static/notebook/js/widgets/selection.js\");"
47 ],
48 "metadata": {},
49 "output_type": "display_data"
50 },
51 {
52 "javascript": [
53 "$.getScript(\"/static/notebook/js/widgets/string.js\");"
54 ],
55 "metadata": {},
56 "output_type": "display_data"
57 },
58 {
59 "javascript": [
60 "$.getScript(\"/static/notebook/js/widgets/float.js\");"
61 ],
62 "metadata": {},
63 "output_type": "display_data"
64 },
65 {
66 "javascript": [
67 "$.getScript(\"/static/notebook/js/widgets/container.js\");"
68 ],
69 "metadata": {},
70 "output_type": "display_data"
71 },
72 {
73 "javascript": [
74 "$.getScript(\"/static/notebook/js/widgets/multicontainer.js\");"
75 ],
76 "metadata": {},
77 "output_type": "display_data"
78 },
79 {
80 "javascript": [
81 "$.getScript(\"/static/notebook/js/widgets/button.js\");"
82 ],
83 "metadata": {},
84 "output_type": "display_data"
85 },
86 {
87 "javascript": [
88 "$.getScript(\"/static/notebook/js/widgets/float_range.js\");"
89 ],
90 "metadata": {},
91 "output_type": "display_data"
92 }
93 ],
94 "prompt_number": 1
26 "prompt_number": 1
95 },
27 },
96 {
28 {
@@ -1,5 +1,11 b''
1 {
1 {
2 "metadata": {
2 "metadata": {
3 "cell_tags": [
4 [
5 "<None>",
6 null
7 ]
8 ],
3 "name": ""
9 "name": ""
4 },
10 },
5 "nbformat": 3,
11 "nbformat": 3,
@@ -12,85 +18,11 b''
12 "collapsed": false,
18 "collapsed": false,
13 "input": [
19 "input": [
14 "from IPython.html import widgets # Widget definitions\n",
20 "from IPython.html import widgets # Widget definitions\n",
15 "from IPython.display import display # Used to display widgets in the notebook\n",
21 "from IPython.display import display # Used to display widgets in the notebook"
16 "\n",
17 "# Enable widgets in this notebook\n",
18 "widgets.init_widget_js()"
19 ],
22 ],
20 "language": "python",
23 "language": "python",
21 "metadata": {},
24 "metadata": {},
22 "outputs": [
25 "outputs": [],
23 {
24 "javascript": [
25 "$.getScript(\"/static/notebook/js/widgets/bool.js\");"
26 ],
27 "metadata": {},
28 "output_type": "display_data"
29 },
30 {
31 "javascript": [
32 "$.getScript(\"/static/notebook/js/widgets/int_range.js\");"
33 ],
34 "metadata": {},
35 "output_type": "display_data"
36 },
37 {
38 "javascript": [
39 "$.getScript(\"/static/notebook/js/widgets/int.js\");"
40 ],
41 "metadata": {},
42 "output_type": "display_data"
43 },
44 {
45 "javascript": [
46 "$.getScript(\"/static/notebook/js/widgets/selection.js\");"
47 ],
48 "metadata": {},
49 "output_type": "display_data"
50 },
51 {
52 "javascript": [
53 "$.getScript(\"/static/notebook/js/widgets/string.js\");"
54 ],
55 "metadata": {},
56 "output_type": "display_data"
57 },
58 {
59 "javascript": [
60 "$.getScript(\"/static/notebook/js/widgets/float.js\");"
61 ],
62 "metadata": {},
63 "output_type": "display_data"
64 },
65 {
66 "javascript": [
67 "$.getScript(\"/static/notebook/js/widgets/container.js\");"
68 ],
69 "metadata": {},
70 "output_type": "display_data"
71 },
72 {
73 "javascript": [
74 "$.getScript(\"/static/notebook/js/widgets/multicontainer.js\");"
75 ],
76 "metadata": {},
77 "output_type": "display_data"
78 },
79 {
80 "javascript": [
81 "$.getScript(\"/static/notebook/js/widgets/button.js\");"
82 ],
83 "metadata": {},
84 "output_type": "display_data"
85 },
86 {
87 "javascript": [
88 "$.getScript(\"/static/notebook/js/widgets/float_range.js\");"
89 ],
90 "metadata": {},
91 "output_type": "display_data"
92 }
93 ],
94 "prompt_number": 1
26 "prompt_number": 1
95 },
27 },
96 {
28 {
@@ -1,5 +1,11 b''
1 {
1 {
2 "metadata": {
2 "metadata": {
3 "cell_tags": [
4 [
5 "<None>",
6 null
7 ]
8 ],
3 "name": ""
9 "name": ""
4 },
10 },
5 "nbformat": 3,
11 "nbformat": 3,
@@ -12,85 +18,11 b''
12 "collapsed": false,
18 "collapsed": false,
13 "input": [
19 "input": [
14 "from IPython.html import widgets # Widget definitions\n",
20 "from IPython.html import widgets # Widget definitions\n",
15 "from IPython.display import display # Used to display widgets in the notebook\n",
21 "from IPython.display import display # Used to display widgets in the notebook"
16 "\n",
17 "# Enable widgets in this notebook\n",
18 "widgets.init_widget_js()"
19 ],
22 ],
20 "language": "python",
23 "language": "python",
21 "metadata": {},
24 "metadata": {},
22 "outputs": [
25 "outputs": [],
23 {
24 "javascript": [
25 "$.getScript(\"../static/notebook/js/widgets/bool.js\");"
26 ],
27 "metadata": {},
28 "output_type": "display_data"
29 },
30 {
31 "javascript": [
32 "$.getScript(\"../static/notebook/js/widgets/int_range.js\");"
33 ],
34 "metadata": {},
35 "output_type": "display_data"
36 },
37 {
38 "javascript": [
39 "$.getScript(\"../static/notebook/js/widgets/int.js\");"
40 ],
41 "metadata": {},
42 "output_type": "display_data"
43 },
44 {
45 "javascript": [
46 "$.getScript(\"../static/notebook/js/widgets/selection.js\");"
47 ],
48 "metadata": {},
49 "output_type": "display_data"
50 },
51 {
52 "javascript": [
53 "$.getScript(\"../static/notebook/js/widgets/string.js\");"
54 ],
55 "metadata": {},
56 "output_type": "display_data"
57 },
58 {
59 "javascript": [
60 "$.getScript(\"../static/notebook/js/widgets/float.js\");"
61 ],
62 "metadata": {},
63 "output_type": "display_data"
64 },
65 {
66 "javascript": [
67 "$.getScript(\"../static/notebook/js/widgets/container.js\");"
68 ],
69 "metadata": {},
70 "output_type": "display_data"
71 },
72 {
73 "javascript": [
74 "$.getScript(\"../static/notebook/js/widgets/multicontainer.js\");"
75 ],
76 "metadata": {},
77 "output_type": "display_data"
78 },
79 {
80 "javascript": [
81 "$.getScript(\"../static/notebook/js/widgets/button.js\");"
82 ],
83 "metadata": {},
84 "output_type": "display_data"
85 },
86 {
87 "javascript": [
88 "$.getScript(\"../static/notebook/js/widgets/float_range.js\");"
89 ],
90 "metadata": {},
91 "output_type": "display_data"
92 }
93 ],
94 "prompt_number": 1
26 "prompt_number": 1
95 },
27 },
96 {
28 {
@@ -18,85 +18,11 b''
18 "collapsed": false,
18 "collapsed": false,
19 "input": [
19 "input": [
20 "from IPython.html import widgets # Widget definitions\n",
20 "from IPython.html import widgets # Widget definitions\n",
21 "from IPython.display import display # Used to display widgets in the notebook\n",
21 "from IPython.display import display # Used to display widgets in the notebook"
22 "\n",
23 "# Enable widgets in this notebook\n",
24 "widgets.init_widget_js()"
25 ],
22 ],
26 "language": "python",
23 "language": "python",
27 "metadata": {},
24 "metadata": {},
28 "outputs": [
25 "outputs": [],
29 {
30 "javascript": [
31 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/button.js\");"
32 ],
33 "metadata": {},
34 "output_type": "display_data"
35 },
36 {
37 "javascript": [
38 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int_range.js\");"
39 ],
40 "metadata": {},
41 "output_type": "display_data"
42 },
43 {
44 "javascript": [
45 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/string.js\");"
46 ],
47 "metadata": {},
48 "output_type": "display_data"
49 },
50 {
51 "javascript": [
52 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/multicontainer.js\");"
53 ],
54 "metadata": {},
55 "output_type": "display_data"
56 },
57 {
58 "javascript": [
59 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/bool.js\");"
60 ],
61 "metadata": {},
62 "output_type": "display_data"
63 },
64 {
65 "javascript": [
66 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int.js\");"
67 ],
68 "metadata": {},
69 "output_type": "display_data"
70 },
71 {
72 "javascript": [
73 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/selection.js\");"
74 ],
75 "metadata": {},
76 "output_type": "display_data"
77 },
78 {
79 "javascript": [
80 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float.js\");"
81 ],
82 "metadata": {},
83 "output_type": "display_data"
84 },
85 {
86 "javascript": [
87 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float_range.js\");"
88 ],
89 "metadata": {},
90 "output_type": "display_data"
91 },
92 {
93 "javascript": [
94 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/container.js\");"
95 ],
96 "metadata": {},
97 "output_type": "display_data"
98 }
99 ],
100 "prompt_number": 1
26 "prompt_number": 1
101 },
27 },
102 {
28 {
@@ -30,85 +30,11 b''
30 "collapsed": false,
30 "collapsed": false,
31 "input": [
31 "input": [
32 "from IPython.html import widgets # Widget definitions\n",
32 "from IPython.html import widgets # Widget definitions\n",
33 "from IPython.display import display # Used to display widgets in the notebook\n",
33 "from IPython.display import display # Used to display widgets in the notebook"
34 "\n",
35 "# Enable widgets in this notebook\n",
36 "widgets.init_widget_js()"
37 ],
34 ],
38 "language": "python",
35 "language": "python",
39 "metadata": {},
36 "metadata": {},
40 "outputs": [
37 "outputs": [],
41 {
42 "javascript": [
43 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/button.js\");"
44 ],
45 "metadata": {},
46 "output_type": "display_data"
47 },
48 {
49 "javascript": [
50 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int_range.js\");"
51 ],
52 "metadata": {},
53 "output_type": "display_data"
54 },
55 {
56 "javascript": [
57 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/string.js\");"
58 ],
59 "metadata": {},
60 "output_type": "display_data"
61 },
62 {
63 "javascript": [
64 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/multicontainer.js\");"
65 ],
66 "metadata": {},
67 "output_type": "display_data"
68 },
69 {
70 "javascript": [
71 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/bool.js\");"
72 ],
73 "metadata": {},
74 "output_type": "display_data"
75 },
76 {
77 "javascript": [
78 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/int.js\");"
79 ],
80 "metadata": {},
81 "output_type": "display_data"
82 },
83 {
84 "javascript": [
85 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/selection.js\");"
86 ],
87 "metadata": {},
88 "output_type": "display_data"
89 },
90 {
91 "javascript": [
92 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float.js\");"
93 ],
94 "metadata": {},
95 "output_type": "display_data"
96 },
97 {
98 "javascript": [
99 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/float_range.js\");"
100 ],
101 "metadata": {},
102 "output_type": "display_data"
103 },
104 {
105 "javascript": [
106 "$.getScript($(\"body\").data(\"baseProjectUrl\") + \"static/notebook/js/widgets/container.js\");"
107 ],
108 "metadata": {},
109 "output_type": "display_data"
110 }
111 ],
112 "prompt_number": 1
38 "prompt_number": 1
113 },
39 },
114 {
40 {
@@ -213,7 +139,7 b''
213 "metadata": {},
139 "metadata": {},
214 "output_type": "display_data",
140 "output_type": "display_data",
215 "text": [
141 "text": [
216 "<IPython.core.display.Javascript at 0x168b0d0>"
142 "<IPython.core.display.Javascript at 0x21f8f10>"
217 ]
143 ]
218 }
144 }
219 ],
145 ],
@@ -236,7 +162,7 b''
236 " \n",
162 " \n",
237 " // Define the DateModel and register it with the widget manager.\n",
163 " // Define the DateModel and register it with the widget manager.\n",
238 " var DateModel = IPython.WidgetModel.extend({});\n",
164 " var DateModel = IPython.WidgetModel.extend({});\n",
239 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
165 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
240 "});"
166 "});"
241 ],
167 ],
242 "language": "python",
168 "language": "python",
@@ -249,13 +175,13 b''
249 " \n",
175 " \n",
250 " // Define the DateModel and register it with the widget manager.\n",
176 " // Define the DateModel and register it with the widget manager.\n",
251 " var DateModel = IPython.WidgetModel.extend({});\n",
177 " var DateModel = IPython.WidgetModel.extend({});\n",
252 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
178 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
253 "});"
179 "});"
254 ],
180 ],
255 "metadata": {},
181 "metadata": {},
256 "output_type": "display_data",
182 "output_type": "display_data",
257 "text": [
183 "text": [
258 "<IPython.core.display.Javascript at 0x168df50>"
184 "<IPython.core.display.Javascript at 0x21f8ed0>"
259 ]
185 ]
260 }
186 }
261 ],
187 ],
@@ -280,7 +206,7 b''
280 " \n",
206 " \n",
281 " // Define the DateModel and register it with the widget manager.\n",
207 " // Define the DateModel and register it with the widget manager.\n",
282 " var DateModel = IPython.WidgetModel.extend({});\n",
208 " var DateModel = IPython.WidgetModel.extend({});\n",
283 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
209 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
284 " \n",
210 " \n",
285 " // Define the DatePickerView\n",
211 " // Define the DatePickerView\n",
286 " var DatePickerView = IPython.WidgetView.extend({\n",
212 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -292,7 +218,7 b''
292 " });\n",
218 " });\n",
293 " \n",
219 " \n",
294 " // Register the DatePickerView with the widget manager.\n",
220 " // Register the DatePickerView with the widget manager.\n",
295 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
221 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
296 "});"
222 "});"
297 ],
223 ],
298 "language": "python",
224 "language": "python",
@@ -305,7 +231,7 b''
305 " \n",
231 " \n",
306 " // Define the DateModel and register it with the widget manager.\n",
232 " // Define the DateModel and register it with the widget manager.\n",
307 " var DateModel = IPython.WidgetModel.extend({});\n",
233 " var DateModel = IPython.WidgetModel.extend({});\n",
308 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
234 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
309 " \n",
235 " \n",
310 " // Define the DatePickerView\n",
236 " // Define the DatePickerView\n",
311 " var DatePickerView = IPython.WidgetView.extend({\n",
237 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -317,13 +243,13 b''
317 " });\n",
243 " });\n",
318 " \n",
244 " \n",
319 " // Register the DatePickerView with the widget manager.\n",
245 " // Register the DatePickerView with the widget manager.\n",
320 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
246 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
321 "});"
247 "});"
322 ],
248 ],
323 "metadata": {},
249 "metadata": {},
324 "output_type": "display_data",
250 "output_type": "display_data",
325 "text": [
251 "text": [
326 "<IPython.core.display.Javascript at 0x168f050>"
252 "<IPython.core.display.Javascript at 0x21f8cd0>"
327 ]
253 ]
328 }
254 }
329 ],
255 ],
@@ -426,7 +352,7 b''
426 " \n",
352 " \n",
427 " // Define the DateModel and register it with the widget manager.\n",
353 " // Define the DateModel and register it with the widget manager.\n",
428 " var DateModel = IPython.WidgetModel.extend({});\n",
354 " var DateModel = IPython.WidgetModel.extend({});\n",
429 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
355 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
430 " \n",
356 " \n",
431 " // Define the DatePickerView\n",
357 " // Define the DatePickerView\n",
432 " var DatePickerView = IPython.WidgetView.extend({\n",
358 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -443,7 +369,7 b''
443 " });\n",
369 " });\n",
444 " \n",
370 " \n",
445 " // Register the DatePickerView with the widget manager.\n",
371 " // Register the DatePickerView with the widget manager.\n",
446 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
372 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
447 "});"
373 "});"
448 ],
374 ],
449 "language": "python",
375 "language": "python",
@@ -456,7 +382,7 b''
456 " \n",
382 " \n",
457 " // Define the DateModel and register it with the widget manager.\n",
383 " // Define the DateModel and register it with the widget manager.\n",
458 " var DateModel = IPython.WidgetModel.extend({});\n",
384 " var DateModel = IPython.WidgetModel.extend({});\n",
459 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
385 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
460 " \n",
386 " \n",
461 " // Define the DatePickerView\n",
387 " // Define the DatePickerView\n",
462 " var DatePickerView = IPython.WidgetView.extend({\n",
388 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -473,13 +399,13 b''
473 " });\n",
399 " });\n",
474 " \n",
400 " \n",
475 " // Register the DatePickerView with the widget manager.\n",
401 " // Register the DatePickerView with the widget manager.\n",
476 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
402 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
477 "});"
403 "});"
478 ],
404 ],
479 "metadata": {},
405 "metadata": {},
480 "output_type": "display_data",
406 "output_type": "display_data",
481 "text": [
407 "text": [
482 "<IPython.core.display.Javascript at 0x17822d0>"
408 "<IPython.core.display.Javascript at 0x21fc310>"
483 ]
409 ]
484 }
410 }
485 ],
411 ],
@@ -502,7 +428,7 b''
502 " \n",
428 " \n",
503 " // Define the DateModel and register it with the widget manager.\n",
429 " // Define the DateModel and register it with the widget manager.\n",
504 " var DateModel = IPython.WidgetModel.extend({});\n",
430 " var DateModel = IPython.WidgetModel.extend({});\n",
505 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
431 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
506 " \n",
432 " \n",
507 " // Define the DatePickerView\n",
433 " // Define the DatePickerView\n",
508 " var DatePickerView = IPython.WidgetView.extend({\n",
434 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -526,7 +452,7 b''
526 " });\n",
452 " });\n",
527 " \n",
453 " \n",
528 " // Register the DatePickerView with the widget manager.\n",
454 " // Register the DatePickerView with the widget manager.\n",
529 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
455 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
530 "});"
456 "});"
531 ],
457 ],
532 "language": "python",
458 "language": "python",
@@ -539,7 +465,7 b''
539 " \n",
465 " \n",
540 " // Define the DateModel and register it with the widget manager.\n",
466 " // Define the DateModel and register it with the widget manager.\n",
541 " var DateModel = IPython.WidgetModel.extend({});\n",
467 " var DateModel = IPython.WidgetModel.extend({});\n",
542 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
468 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
543 " \n",
469 " \n",
544 " // Define the DatePickerView\n",
470 " // Define the DatePickerView\n",
545 " var DatePickerView = IPython.WidgetView.extend({\n",
471 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -563,13 +489,13 b''
563 " });\n",
489 " });\n",
564 " \n",
490 " \n",
565 " // Register the DatePickerView with the widget manager.\n",
491 " // Register the DatePickerView with the widget manager.\n",
566 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
492 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
567 "});"
493 "});"
568 ],
494 ],
569 "metadata": {},
495 "metadata": {},
570 "output_type": "display_data",
496 "output_type": "display_data",
571 "text": [
497 "text": [
572 "<IPython.core.display.Javascript at 0x1782390>"
498 "<IPython.core.display.Javascript at 0x21fc290>"
573 ]
499 ]
574 }
500 }
575 ],
501 ],
@@ -596,7 +522,7 b''
596 " \n",
522 " \n",
597 " // Define the DateModel and register it with the widget manager.\n",
523 " // Define the DateModel and register it with the widget manager.\n",
598 " var DateModel = IPython.WidgetModel.extend({});\n",
524 " var DateModel = IPython.WidgetModel.extend({});\n",
599 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
525 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
600 " \n",
526 " \n",
601 " // Define the DatePickerView\n",
527 " // Define the DatePickerView\n",
602 " var DatePickerView = IPython.WidgetView.extend({\n",
528 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -632,7 +558,7 b''
632 " });\n",
558 " });\n",
633 " \n",
559 " \n",
634 " // Register the DatePickerView with the widget manager.\n",
560 " // Register the DatePickerView with the widget manager.\n",
635 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
561 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
636 "});"
562 "});"
637 ],
563 ],
638 "language": "python",
564 "language": "python",
@@ -645,7 +571,7 b''
645 " \n",
571 " \n",
646 " // Define the DateModel and register it with the widget manager.\n",
572 " // Define the DateModel and register it with the widget manager.\n",
647 " var DateModel = IPython.WidgetModel.extend({});\n",
573 " var DateModel = IPython.WidgetModel.extend({});\n",
648 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
574 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
649 " \n",
575 " \n",
650 " // Define the DatePickerView\n",
576 " // Define the DatePickerView\n",
651 " var DatePickerView = IPython.WidgetView.extend({\n",
577 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -681,13 +607,13 b''
681 " });\n",
607 " });\n",
682 " \n",
608 " \n",
683 " // Register the DatePickerView with the widget manager.\n",
609 " // Register the DatePickerView with the widget manager.\n",
684 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
610 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
685 "});"
611 "});"
686 ],
612 ],
687 "metadata": {},
613 "metadata": {},
688 "output_type": "display_data",
614 "output_type": "display_data",
689 "text": [
615 "text": [
690 "<IPython.core.display.Javascript at 0x17821d0>"
616 "<IPython.core.display.Javascript at 0x21fc3d0>"
691 ]
617 ]
692 }
618 }
693 ],
619 ],
@@ -759,7 +685,7 b''
759 "output_type": "pyout",
685 "output_type": "pyout",
760 "prompt_number": 13,
686 "prompt_number": 13,
761 "text": [
687 "text": [
762 "u''"
688 "u'2013-11-14'"
763 ]
689 ]
764 }
690 }
765 ],
691 ],
@@ -1041,7 +967,7 b''
1041 " \n",
967 " \n",
1042 " // Define the DateModel and register it with the widget manager.\n",
968 " // Define the DateModel and register it with the widget manager.\n",
1043 " var DateModel = IPython.WidgetModel.extend({});\n",
969 " var DateModel = IPython.WidgetModel.extend({});\n",
1044 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
970 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
1045 " \n",
971 " \n",
1046 " // Define the DatePickerView\n",
972 " // Define the DatePickerView\n",
1047 " var DatePickerView = IPython.WidgetView.extend({\n",
973 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -1095,7 +1021,7 b''
1095 " });\n",
1021 " });\n",
1096 " \n",
1022 " \n",
1097 " // Register the DatePickerView with the widget manager.\n",
1023 " // Register the DatePickerView with the widget manager.\n",
1098 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
1024 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
1099 "});"
1025 "});"
1100 ],
1026 ],
1101 "language": "python",
1027 "language": "python",
@@ -1108,7 +1034,7 b''
1108 " \n",
1034 " \n",
1109 " // Define the DateModel and register it with the widget manager.\n",
1035 " // Define the DateModel and register it with the widget manager.\n",
1110 " var DateModel = IPython.WidgetModel.extend({});\n",
1036 " var DateModel = IPython.WidgetModel.extend({});\n",
1111 " IPython.notebook.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
1037 " IPython.widget_manager.register_widget_model('DateWidgetModel', DateModel);\n",
1112 " \n",
1038 " \n",
1113 " // Define the DatePickerView\n",
1039 " // Define the DatePickerView\n",
1114 " var DatePickerView = IPython.WidgetView.extend({\n",
1040 " var DatePickerView = IPython.WidgetView.extend({\n",
@@ -1162,13 +1088,13 b''
1162 " });\n",
1088 " });\n",
1163 " \n",
1089 " \n",
1164 " // Register the DatePickerView with the widget manager.\n",
1090 " // Register the DatePickerView with the widget manager.\n",
1165 " IPython.notebook.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
1091 " IPython.widget_manager.register_widget_view('DatePickerView', DatePickerView);\n",
1166 "});"
1092 "});"
1167 ],
1093 ],
1168 "metadata": {},
1094 "metadata": {},
1169 "output_type": "display_data",
1095 "output_type": "display_data",
1170 "text": [
1096 "text": [
1171 "<IPython.core.display.Javascript at 0x179f790>"
1097 "<IPython.core.display.Javascript at 0x221a850>"
1172 ]
1098 ]
1173 }
1099 }
1174 ],
1100 ],
@@ -1216,7 +1142,6 b''
1216 "cell_type": "code",
1142 "cell_type": "code",
1217 "collapsed": false,
1143 "collapsed": false,
1218 "input": [
1144 "input": [
1219 "\n",
1220 "display(my_widget, view_name=\"TextBoxView\")"
1145 "display(my_widget, view_name=\"TextBoxView\")"
1221 ],
1146 ],
1222 "language": "python",
1147 "language": "python",
General Comments 0
You need to be logged in to leave comments. Login now