Show More
@@ -0,0 +1,141 b'' | |||||
|
1 | //---------------------------------------------------------------------------- | |||
|
2 | // Copyright (C) 2012 The IPython Development Team | |||
|
3 | // | |||
|
4 | // Distributed under the terms of the BSD License. The full license is in | |||
|
5 | // the file COPYING, distributed as part of this software. | |||
|
6 | //---------------------------------------------------------------------------- | |||
|
7 | ||||
|
8 | //============================================================================ | |||
|
9 | // Notification widget | |||
|
10 | //============================================================================ | |||
|
11 | ||||
|
12 | var IPython = (function (IPython) { | |||
|
13 | "use strict"; | |||
|
14 | var utils = IPython.utils; | |||
|
15 | ||||
|
16 | ||||
|
17 | var NotificationArea = function (selector) { | |||
|
18 | this.selector = selector; | |||
|
19 | if (this.selector !== undefined) { | |||
|
20 | this.element = $(selector); | |||
|
21 | } | |||
|
22 | this.widget_dict = {}; | |||
|
23 | }; | |||
|
24 | ||||
|
25 | NotificationArea.prototype.temp_message = function (msg, timeout, css_class) { | |||
|
26 | var uuid = utils.uuid(); | |||
|
27 | if( css_class == 'danger') {css_class = 'ui-state-error';} | |||
|
28 | if( css_class == 'warning') {css_class = 'ui-state-highlight';} | |||
|
29 | var tdiv = $('<div>') | |||
|
30 | .attr('id',uuid) | |||
|
31 | .addClass('notification_widget ui-widget ui-widget-content ui-corner-all') | |||
|
32 | .addClass('border-box-sizing') | |||
|
33 | .addClass(css_class) | |||
|
34 | .hide() | |||
|
35 | .text(msg); | |||
|
36 | ||||
|
37 | $(this.selector).append(tdiv); | |||
|
38 | var tmout = Math.max(1500,(timeout||1500)); | |||
|
39 | tdiv.fadeIn(100); | |||
|
40 | ||||
|
41 | setTimeout(function () { | |||
|
42 | tdiv.fadeOut(100, function () {tdiv.remove();}); | |||
|
43 | }, tmout); | |||
|
44 | }; | |||
|
45 | ||||
|
46 | NotificationArea.prototype.widget = function(name) { | |||
|
47 | if(this.widget_dict[name] == undefined) { | |||
|
48 | return this.new_notification_widget(name); | |||
|
49 | } | |||
|
50 | return this.get_widget(name); | |||
|
51 | }; | |||
|
52 | ||||
|
53 | NotificationArea.prototype.get_widget = function(name) { | |||
|
54 | if(this.widget_dict[name] == undefined) { | |||
|
55 | throw('no widgets with this name'); | |||
|
56 | } | |||
|
57 | return this.widget_dict[name]; | |||
|
58 | }; | |||
|
59 | ||||
|
60 | NotificationArea.prototype.new_notification_widget = function(name) { | |||
|
61 | if(this.widget_dict[name] != undefined) { | |||
|
62 | throw('widget with that name already exists ! '); | |||
|
63 | } | |||
|
64 | var div = $('<div/>').attr('id','notification_'+name); | |||
|
65 | $(this.selector).append(div); | |||
|
66 | this.widget_dict[name] = new IPython.NotificationWidget('#notification_'+name); | |||
|
67 | return this.widget_dict[name]; | |||
|
68 | }; | |||
|
69 | ||||
|
70 | NotificationArea.prototype.init_notification_widgets = function() { | |||
|
71 | var knw = this.new_notification_widget('kernel'); | |||
|
72 | ||||
|
73 | // Kernel events | |||
|
74 | $([IPython.events]).on('status_idle.Kernel',function () { | |||
|
75 | IPython.save_widget.update_document_title(); | |||
|
76 | knw.set_message('Kernel Idle',200); | |||
|
77 | } | |||
|
78 | ); | |||
|
79 | ||||
|
80 | $([IPython.events]).on('status_busy.Kernel',function () { | |||
|
81 | window.document.title='(Busy) '+window.document.title; | |||
|
82 | knw.set_message("Kernel busy"); | |||
|
83 | }); | |||
|
84 | ||||
|
85 | $([IPython.events]).on('status_restarting.Kernel',function () { | |||
|
86 | IPython.save_widget.update_document_title(); | |||
|
87 | knw.set_message("Restarting kernel",1000); | |||
|
88 | }); | |||
|
89 | ||||
|
90 | $([IPython.events]).on('status_interrupting.Kernel',function () { | |||
|
91 | knw.set_message("Interrupting kernel"); | |||
|
92 | }); | |||
|
93 | ||||
|
94 | $([IPython.events]).on('status_dead.Kernel',function () { | |||
|
95 | var dialog = $('<div/>'); | |||
|
96 | dialog.html('The kernel has died, would you like to restart it? If you do not restart the kernel, you will be able to save the notebook, but running code will not work until the notebook is reopened.'); | |||
|
97 | $(document).append(dialog); | |||
|
98 | dialog.dialog({ | |||
|
99 | resizable: false, | |||
|
100 | modal: true, | |||
|
101 | title: "Dead kernel", | |||
|
102 | buttons : { | |||
|
103 | "Restart": function () { | |||
|
104 | $([IPython.events]).trigger('status_restarting.Kernel'); | |||
|
105 | IPython.notebook.start_kernel(); | |||
|
106 | $(this).dialog('close'); | |||
|
107 | }, | |||
|
108 | "Continue running": function () { | |||
|
109 | $(this).dialog('close'); | |||
|
110 | } | |||
|
111 | } | |||
|
112 | }); | |||
|
113 | }); | |||
|
114 | ||||
|
115 | var nnw = this.new_notification_widget('notebook'); | |||
|
116 | ||||
|
117 | // Notebook events | |||
|
118 | $([IPython.events]).on('notebook_loading.Notebook', function () { | |||
|
119 | nnw.set_message("Loading notebook",500); | |||
|
120 | }); | |||
|
121 | $([IPython.events]).on('notebook_loaded.Notebook', function () { | |||
|
122 | nnw.set_message("Notebook loaded",500); | |||
|
123 | }); | |||
|
124 | $([IPython.events]).on('notebook_saving.Notebook', function () { | |||
|
125 | nnw.set_message("Saving notebook",500); | |||
|
126 | }); | |||
|
127 | $([IPython.events]).on('notebook_saved.Notebook', function () { | |||
|
128 | nnw.set_message("Notebook saved",2000); | |||
|
129 | }); | |||
|
130 | $([IPython.events]).on('notebook_save_failed.Notebook', function () { | |||
|
131 | nnw.set_message("Notebook save failed"); | |||
|
132 | }); | |||
|
133 | ||||
|
134 | }; | |||
|
135 | ||||
|
136 | IPython.NotificationArea = NotificationArea; | |||
|
137 | ||||
|
138 | return IPython; | |||
|
139 | ||||
|
140 | }(IPython)); | |||
|
141 |
@@ -1,394 +1,404 b'' | |||||
1 | /** |
|
1 | /** | |
2 | * Primary styles |
|
2 | * Primary styles | |
3 | * |
|
3 | * | |
4 | * Author: IPython Development Team |
|
4 | * Author: IPython Development Team | |
5 | */ |
|
5 | */ | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | body { |
|
8 | body { | |
9 | overflow: hidden; |
|
9 | overflow: hidden; | |
10 | } |
|
10 | } | |
11 |
|
11 | |||
12 | span#save_widget { |
|
12 | span#save_widget { | |
13 | padding: 5px; |
|
13 | padding: 5px; | |
14 | margin: 0px 0px 0px 300px; |
|
14 | margin: 0px 0px 0px 300px; | |
15 | display:inline-block; |
|
15 | display:inline-block; | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | span#notebook_name { |
|
18 | span#notebook_name { | |
19 | height: 1em; |
|
19 | height: 1em; | |
20 | line-height: 1em; |
|
20 | line-height: 1em; | |
21 | padding: 3px; |
|
21 | padding: 3px; | |
22 | border: none; |
|
22 | border: none; | |
23 | font-size: 146.5%; |
|
23 | font-size: 146.5%; | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | .ui-menubar-item .ui-button .ui-button-text { |
|
26 | .ui-menubar-item .ui-button .ui-button-text { | |
27 | padding: 0.4em 1.0em; |
|
27 | padding: 0.4em 1.0em; | |
28 | font-size: 100%; |
|
28 | font-size: 100%; | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 | .ui-menu { |
|
31 | .ui-menu { | |
32 | -moz-box-shadow: 0px 6px 10px -1px #adadad; |
|
32 | -moz-box-shadow: 0px 6px 10px -1px #adadad; | |
33 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; |
|
33 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; | |
34 | box-shadow: 0px 6px 10px -1px #adadad; |
|
34 | box-shadow: 0px 6px 10px -1px #adadad; | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | .ui-menu .ui-menu-item a { |
|
37 | .ui-menu .ui-menu-item a { | |
38 | border: 1px solid transparent; |
|
38 | border: 1px solid transparent; | |
39 | padding: 2px 1.6em; |
|
39 | padding: 2px 1.6em; | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | .ui-menu .ui-menu-item a.ui-state-focus { |
|
42 | .ui-menu .ui-menu-item a.ui-state-focus { | |
43 | margin: 0; |
|
43 | margin: 0; | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | .ui-menu hr { |
|
46 | .ui-menu hr { | |
47 | margin: 0.3em 0; |
|
47 | margin: 0.3em 0; | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | #menubar_container { |
|
50 | #menubar_container { | |
51 | position: relative; |
|
51 | position: relative; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | #notification { |
|
54 | #notification_area { | |
55 | position: absolute; |
|
55 | position: absolute; | |
56 |
right: |
|
56 | right: 0px; | |
57 |
top: |
|
57 | top: 0px; | |
|
58 | height: 25px; | |||
|
59 | padding: 3px 0px; | |||
|
60 | padding-right: 3px; | |||
|
61 | z-index: 10; | |||
|
62 | } | |||
|
63 | ||||
|
64 | .notification_widget{ | |||
|
65 | float : right; | |||
|
66 | right: 0px; | |||
|
67 | top: 1px; | |||
58 | height: 25px; |
|
68 | height: 25px; | |
59 | padding: 3px 6px; |
|
69 | padding: 3px 6px; | |
60 | z-index: 10; |
|
70 | z-index: 10; | |
61 | } |
|
71 | } | |
62 |
|
72 | |||
63 | #toolbar { |
|
73 | #toolbar { | |
64 | padding: 3px 15px; |
|
74 | padding: 3px 15px; | |
65 | } |
|
75 | } | |
66 |
|
76 | |||
67 | #cell_type { |
|
77 | #cell_type { | |
68 | font-size: 85%; |
|
78 | font-size: 85%; | |
69 | } |
|
79 | } | |
70 |
|
80 | |||
71 |
|
81 | |||
72 | div#main_app { |
|
82 | div#main_app { | |
73 | width: 100%; |
|
83 | width: 100%; | |
74 | position: relative; |
|
84 | position: relative; | |
75 | } |
|
85 | } | |
76 |
|
86 | |||
77 | span#quick_help_area { |
|
87 | span#quick_help_area { | |
78 | position: static; |
|
88 | position: static; | |
79 | padding: 5px 0px; |
|
89 | padding: 5px 0px; | |
80 | margin: 0px 0px 0px 0px; |
|
90 | margin: 0px 0px 0px 0px; | |
81 | } |
|
91 | } | |
82 |
|
92 | |||
83 | .help_string { |
|
93 | .help_string { | |
84 | float: right; |
|
94 | float: right; | |
85 | width: 170px; |
|
95 | width: 170px; | |
86 | padding: 0px 5px; |
|
96 | padding: 0px 5px; | |
87 | text-align: left; |
|
97 | text-align: left; | |
88 | font-size: 85%; |
|
98 | font-size: 85%; | |
89 | } |
|
99 | } | |
90 |
|
100 | |||
91 | .help_string_label { |
|
101 | .help_string_label { | |
92 | float: right; |
|
102 | float: right; | |
93 | font-size: 85%; |
|
103 | font-size: 85%; | |
94 | } |
|
104 | } | |
95 |
|
105 | |||
96 | div#notebook_panel { |
|
106 | div#notebook_panel { | |
97 | margin: 0px 0px 0px 0px; |
|
107 | margin: 0px 0px 0px 0px; | |
98 | padding: 0px; |
|
108 | padding: 0px; | |
99 | } |
|
109 | } | |
100 |
|
110 | |||
101 | div#notebook { |
|
111 | div#notebook { | |
102 | overflow-y: scroll; |
|
112 | overflow-y: scroll; | |
103 | overflow-x: auto; |
|
113 | overflow-x: auto; | |
104 | width: 100%; |
|
114 | width: 100%; | |
105 | /* This spaces the cell away from the edge of the notebook area */ |
|
115 | /* This spaces the cell away from the edge of the notebook area */ | |
106 | padding: 5px 5px 15px 5px; |
|
116 | padding: 5px 5px 15px 5px; | |
107 | margin: 0px; |
|
117 | margin: 0px; | |
108 | background-color: white; |
|
118 | background-color: white; | |
109 | } |
|
119 | } | |
110 |
|
120 | |||
111 | div#pager_splitter { |
|
121 | div#pager_splitter { | |
112 | height: 8px; |
|
122 | height: 8px; | |
113 | } |
|
123 | } | |
114 |
|
124 | |||
115 | div#pager { |
|
125 | div#pager { | |
116 | padding: 15px; |
|
126 | padding: 15px; | |
117 | overflow: auto; |
|
127 | overflow: auto; | |
118 | display: none; |
|
128 | display: none; | |
119 | } |
|
129 | } | |
120 |
|
130 | |||
121 | div.ui-widget-content { |
|
131 | div.ui-widget-content { | |
122 | border: 1px solid #aaa; |
|
132 | border: 1px solid #aaa; | |
123 | outline: none; |
|
133 | outline: none; | |
124 | } |
|
134 | } | |
125 |
|
135 | |||
126 | .cell { |
|
136 | .cell { | |
127 | border: 1px solid transparent; |
|
137 | border: 1px solid transparent; | |
128 | } |
|
138 | } | |
129 |
|
139 | |||
130 | div.cell { |
|
140 | div.cell { | |
131 | width: 100%; |
|
141 | width: 100%; | |
132 | padding: 5px 5px 5px 0px; |
|
142 | padding: 5px 5px 5px 0px; | |
133 | /* This acts as a spacer between cells, that is outside the border */ |
|
143 | /* This acts as a spacer between cells, that is outside the border */ | |
134 | margin: 2px 0px 2px 0px; |
|
144 | margin: 2px 0px 2px 0px; | |
135 | } |
|
145 | } | |
136 |
|
146 | |||
137 | div.code_cell { |
|
147 | div.code_cell { | |
138 | background-color: white; |
|
148 | background-color: white; | |
139 | } |
|
149 | } | |
140 |
|
150 | |||
141 | /* any special styling for code cells that are currently running goes here */ |
|
151 | /* any special styling for code cells that are currently running goes here */ | |
142 | div.code_cell.running { |
|
152 | div.code_cell.running { | |
143 | } |
|
153 | } | |
144 |
|
154 | |||
145 | div.prompt { |
|
155 | div.prompt { | |
146 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ |
|
156 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ | |
147 | width: 11ex; |
|
157 | width: 11ex; | |
148 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ |
|
158 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ | |
149 | padding: 0.4em; |
|
159 | padding: 0.4em; | |
150 | margin: 0px; |
|
160 | margin: 0px; | |
151 | font-family: monospace; |
|
161 | font-family: monospace; | |
152 | text-align:right; |
|
162 | text-align:right; | |
153 | } |
|
163 | } | |
154 |
|
164 | |||
155 | div.input { |
|
165 | div.input { | |
156 | page-break-inside: avoid; |
|
166 | page-break-inside: avoid; | |
157 | } |
|
167 | } | |
158 |
|
168 | |||
159 | /* input_area and input_prompt must match in top border and margin for alignment */ |
|
169 | /* input_area and input_prompt must match in top border and margin for alignment */ | |
160 | div.input_area { |
|
170 | div.input_area { | |
161 | color: black; |
|
171 | color: black; | |
162 | border: 1px solid #ddd; |
|
172 | border: 1px solid #ddd; | |
163 | border-radius: 3px; |
|
173 | border-radius: 3px; | |
164 | background: #f7f7f7; |
|
174 | background: #f7f7f7; | |
165 | } |
|
175 | } | |
166 |
|
176 | |||
167 | div.input_prompt { |
|
177 | div.input_prompt { | |
168 | color: navy; |
|
178 | color: navy; | |
169 | border-top: 1px solid transparent; |
|
179 | border-top: 1px solid transparent; | |
170 | } |
|
180 | } | |
171 |
|
181 | |||
172 | div.output_wrapper { |
|
182 | div.output_wrapper { | |
173 | /* This is a spacer between the input and output of each cell */ |
|
183 | /* This is a spacer between the input and output of each cell */ | |
174 | margin-top: 5px; |
|
184 | margin-top: 5px; | |
175 | margin-left: 5px; |
|
185 | margin-left: 5px; | |
176 | /* FF needs explicit width to stretch */ |
|
186 | /* FF needs explicit width to stretch */ | |
177 | width: 100%; |
|
187 | width: 100%; | |
178 | /* this position must be relative to enable descendents to be absolute within it */ |
|
188 | /* this position must be relative to enable descendents to be absolute within it */ | |
179 | position: relative; |
|
189 | position: relative; | |
180 | } |
|
190 | } | |
181 |
|
191 | |||
182 | /* class for the output area when it should be height-limited */ |
|
192 | /* class for the output area when it should be height-limited */ | |
183 | div.output_scroll { |
|
193 | div.output_scroll { | |
184 | /* ideally, this would be max-height, but FF barfs all over that */ |
|
194 | /* ideally, this would be max-height, but FF barfs all over that */ | |
185 | height: 24em; |
|
195 | height: 24em; | |
186 | /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */ |
|
196 | /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */ | |
187 | width: 100%; |
|
197 | width: 100%; | |
188 |
|
198 | |||
189 | overflow: auto; |
|
199 | overflow: auto; | |
190 | border-radius: 3px; |
|
200 | border-radius: 3px; | |
191 | box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8); |
|
201 | box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8); | |
192 | } |
|
202 | } | |
193 |
|
203 | |||
194 | /* output div while it is collapsed */ |
|
204 | /* output div while it is collapsed */ | |
195 | div.output_collapsed { |
|
205 | div.output_collapsed { | |
196 | margin-right: 5px; |
|
206 | margin-right: 5px; | |
197 | } |
|
207 | } | |
198 |
|
208 | |||
199 | div.out_prompt_overlay { |
|
209 | div.out_prompt_overlay { | |
200 | height: 100%; |
|
210 | height: 100%; | |
201 | padding: 0px; |
|
211 | padding: 0px; | |
202 | position: absolute; |
|
212 | position: absolute; | |
203 | border-radius: 3px; |
|
213 | border-radius: 3px; | |
204 | } |
|
214 | } | |
205 |
|
215 | |||
206 | div.out_prompt_overlay:hover { |
|
216 | div.out_prompt_overlay:hover { | |
207 | /* use inner shadow to get border that is computed the same on WebKit/FF */ |
|
217 | /* use inner shadow to get border that is computed the same on WebKit/FF */ | |
208 | box-shadow: inset 0 0 1px #000; |
|
218 | box-shadow: inset 0 0 1px #000; | |
209 | background: rgba(240, 240, 240, 0.5); |
|
219 | background: rgba(240, 240, 240, 0.5); | |
210 | } |
|
220 | } | |
211 |
|
221 | |||
212 | div.output_prompt { |
|
222 | div.output_prompt { | |
213 | color: darkred; |
|
223 | color: darkred; | |
214 | /* 5px right shift to account for margin in parent container */ |
|
224 | /* 5px right shift to account for margin in parent container */ | |
215 | margin: 0 5px 0 -5px; |
|
225 | margin: 0 5px 0 -5px; | |
216 | } |
|
226 | } | |
217 |
|
227 | |||
218 | /* This class is the outer container of all output sections. */ |
|
228 | /* This class is the outer container of all output sections. */ | |
219 | div.output_area { |
|
229 | div.output_area { | |
220 | padding: 0px; |
|
230 | padding: 0px; | |
221 | page-break-inside: avoid; |
|
231 | page-break-inside: avoid; | |
222 | } |
|
232 | } | |
223 |
|
233 | |||
224 | /* This class is for the output subarea inside the output_area and after |
|
234 | /* This class is for the output subarea inside the output_area and after | |
225 | the prompt div. */ |
|
235 | the prompt div. */ | |
226 | div.output_subarea { |
|
236 | div.output_subarea { | |
227 | padding: 0.4em 0.4em 0.4em 0.4em; |
|
237 | padding: 0.4em 0.4em 0.4em 0.4em; | |
228 | } |
|
238 | } | |
229 |
|
239 | |||
230 | /* The rest of the output_* classes are for special styling of the different |
|
240 | /* The rest of the output_* classes are for special styling of the different | |
231 | output types */ |
|
241 | output types */ | |
232 |
|
242 | |||
233 | /* all text output has this class: */ |
|
243 | /* all text output has this class: */ | |
234 | div.output_text { |
|
244 | div.output_text { | |
235 | text-align: left; |
|
245 | text-align: left; | |
236 | color: black; |
|
246 | color: black; | |
237 | font-family: monospace; |
|
247 | font-family: monospace; | |
238 | } |
|
248 | } | |
239 |
|
249 | |||
240 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ |
|
250 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ | |
241 | div.output_stream { |
|
251 | div.output_stream { | |
242 | padding-top: 0.0em; |
|
252 | padding-top: 0.0em; | |
243 | padding-bottom: 0.0em; |
|
253 | padding-bottom: 0.0em; | |
244 | } |
|
254 | } | |
245 | div.output_stdout { |
|
255 | div.output_stdout { | |
246 | } |
|
256 | } | |
247 | div.output_stderr { |
|
257 | div.output_stderr { | |
248 | background: #fdd; /* very light red background for stderr */ |
|
258 | background: #fdd; /* very light red background for stderr */ | |
249 | } |
|
259 | } | |
250 |
|
260 | |||
251 | div.output_latex { |
|
261 | div.output_latex { | |
252 | text-align: left; |
|
262 | text-align: left; | |
253 | color: black; |
|
263 | color: black; | |
254 | } |
|
264 | } | |
255 |
|
265 | |||
256 | div.output_html { |
|
266 | div.output_html { | |
257 | } |
|
267 | } | |
258 |
|
268 | |||
259 | div.output_png { |
|
269 | div.output_png { | |
260 | } |
|
270 | } | |
261 |
|
271 | |||
262 | div.output_jpeg { |
|
272 | div.output_jpeg { | |
263 | } |
|
273 | } | |
264 |
|
274 | |||
265 | div.text_cell { |
|
275 | div.text_cell { | |
266 | background-color: white; |
|
276 | background-color: white; | |
267 | padding: 5px 5px 5px 5px; |
|
277 | padding: 5px 5px 5px 5px; | |
268 | } |
|
278 | } | |
269 |
|
279 | |||
270 | div.text_cell_input { |
|
280 | div.text_cell_input { | |
271 | color: black; |
|
281 | color: black; | |
272 | border: 1px solid #ddd; |
|
282 | border: 1px solid #ddd; | |
273 | border-radius: 3px; |
|
283 | border-radius: 3px; | |
274 | background: #f7f7f7; |
|
284 | background: #f7f7f7; | |
275 | } |
|
285 | } | |
276 |
|
286 | |||
277 | div.text_cell_render { |
|
287 | div.text_cell_render { | |
278 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
288 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
279 | outline: none; |
|
289 | outline: none; | |
280 | resize: none; |
|
290 | resize: none; | |
281 | width: inherit; |
|
291 | width: inherit; | |
282 | border-style: none; |
|
292 | border-style: none; | |
283 | padding: 5px; |
|
293 | padding: 5px; | |
284 | color: black; |
|
294 | color: black; | |
285 | } |
|
295 | } | |
286 |
|
296 | |||
287 | /* The following gets added to the <head> if it is detected that the user has a |
|
297 | /* The following gets added to the <head> if it is detected that the user has a | |
288 | * monospace font with inconsistent normal/bold/italic height. See |
|
298 | * monospace font with inconsistent normal/bold/italic height. See | |
289 | * notebookmain.js. Such fonts will have keywords vertically offset with |
|
299 | * notebookmain.js. Such fonts will have keywords vertically offset with | |
290 | * respect to the rest of the text. The user should select a better font. |
|
300 | * respect to the rest of the text. The user should select a better font. | |
291 | * See: https://github.com/ipython/ipython/issues/1503 |
|
301 | * See: https://github.com/ipython/ipython/issues/1503 | |
292 | * |
|
302 | * | |
293 | * .CodeMirror span { |
|
303 | * .CodeMirror span { | |
294 | * vertical-align: bottom; |
|
304 | * vertical-align: bottom; | |
295 | * } |
|
305 | * } | |
296 | */ |
|
306 | */ | |
297 |
|
307 | |||
298 | .CodeMirror { |
|
308 | .CodeMirror { | |
299 | line-height: 1.231; /* Changed from 1em to our global default */ |
|
309 | line-height: 1.231; /* Changed from 1em to our global default */ | |
300 | } |
|
310 | } | |
301 |
|
311 | |||
302 | .CodeMirror-scroll { |
|
312 | .CodeMirror-scroll { | |
303 | height: auto; /* Changed to auto to autogrow */ |
|
313 | height: auto; /* Changed to auto to autogrow */ | |
304 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ |
|
314 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ | |
305 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ |
|
315 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ | |
306 | overflow-y: hidden; |
|
316 | overflow-y: hidden; | |
307 | overflow-x: auto; /* Changed from auto to remove scrollbar */ |
|
317 | overflow-x: auto; /* Changed from auto to remove scrollbar */ | |
308 | } |
|
318 | } | |
309 |
|
319 | |||
310 | /* CSS font colors for translated ANSI colors. */ |
|
320 | /* CSS font colors for translated ANSI colors. */ | |
311 |
|
321 | |||
312 |
|
322 | |||
313 | .ansiblack {color: black;} |
|
323 | .ansiblack {color: black;} | |
314 | .ansired {color: darkred;} |
|
324 | .ansired {color: darkred;} | |
315 | .ansigreen {color: darkgreen;} |
|
325 | .ansigreen {color: darkgreen;} | |
316 | .ansiyellow {color: brown;} |
|
326 | .ansiyellow {color: brown;} | |
317 | .ansiblue {color: darkblue;} |
|
327 | .ansiblue {color: darkblue;} | |
318 | .ansipurple {color: darkviolet;} |
|
328 | .ansipurple {color: darkviolet;} | |
319 | .ansicyan {color: steelblue;} |
|
329 | .ansicyan {color: steelblue;} | |
320 | .ansigrey {color: grey;} |
|
330 | .ansigrey {color: grey;} | |
321 | .ansibold {font-weight: bold;} |
|
331 | .ansibold {font-weight: bold;} | |
322 |
|
332 | |||
323 | .completions { |
|
333 | .completions { | |
324 | position: absolute; |
|
334 | position: absolute; | |
325 | z-index: 10; |
|
335 | z-index: 10; | |
326 | overflow: hidden; |
|
336 | overflow: hidden; | |
327 | border: 1px solid grey; |
|
337 | border: 1px solid grey; | |
328 | } |
|
338 | } | |
329 |
|
339 | |||
330 | .completions select { |
|
340 | .completions select { | |
331 | background: white; |
|
341 | background: white; | |
332 | outline: none; |
|
342 | outline: none; | |
333 | border: none; |
|
343 | border: none; | |
334 | padding: 0px; |
|
344 | padding: 0px; | |
335 | margin: 0px; |
|
345 | margin: 0px; | |
336 | overflow: auto; |
|
346 | overflow: auto; | |
337 | font-family: monospace; |
|
347 | font-family: monospace; | |
338 | } |
|
348 | } | |
339 |
|
349 | |||
340 | option.context { |
|
350 | option.context { | |
341 | background-color: #DEF7FF; |
|
351 | background-color: #DEF7FF; | |
342 | } |
|
352 | } | |
343 | option.introspection { |
|
353 | option.introspection { | |
344 | background-color: #EBF4EB; |
|
354 | background-color: #EBF4EB; | |
345 | } |
|
355 | } | |
346 |
|
356 | |||
347 | /*fixed part of the completion*/ |
|
357 | /*fixed part of the completion*/ | |
348 | .completions p b { |
|
358 | .completions p b { | |
349 | font-weight:bold; |
|
359 | font-weight:bold; | |
350 | } |
|
360 | } | |
351 |
|
361 | |||
352 | .completions p { |
|
362 | .completions p { | |
353 | background: #DDF; |
|
363 | background: #DDF; | |
354 | /*outline: none; |
|
364 | /*outline: none; | |
355 | padding: 0px;*/ |
|
365 | padding: 0px;*/ | |
356 | border-bottom: black solid 1px; |
|
366 | border-bottom: black solid 1px; | |
357 | padding: 1px; |
|
367 | padding: 1px; | |
358 | font-family: monospace; |
|
368 | font-family: monospace; | |
359 | } |
|
369 | } | |
360 |
|
370 | |||
361 | pre.dialog { |
|
371 | pre.dialog { | |
362 | background-color: #f7f7f7; |
|
372 | background-color: #f7f7f7; | |
363 | border: 1px solid #ddd; |
|
373 | border: 1px solid #ddd; | |
364 | border-radius: 3px; |
|
374 | border-radius: 3px; | |
365 | padding: 0.4em; |
|
375 | padding: 0.4em; | |
366 | padding-left: 2em; |
|
376 | padding-left: 2em; | |
367 | } |
|
377 | } | |
368 |
|
378 | |||
369 | p.dialog { |
|
379 | p.dialog { | |
370 | padding : 0.2em; |
|
380 | padding : 0.2em; | |
371 | } |
|
381 | } | |
372 |
|
382 | |||
373 | .shortcut_key { |
|
383 | .shortcut_key { | |
374 | display: inline-block; |
|
384 | display: inline-block; | |
375 | width: 15ex; |
|
385 | width: 15ex; | |
376 | text-align: right; |
|
386 | text-align: right; | |
377 | font-family: monospace; |
|
387 | font-family: monospace; | |
378 | } |
|
388 | } | |
379 |
|
389 | |||
380 | .shortcut_descr { |
|
390 | .shortcut_descr { | |
381 | } |
|
391 | } | |
382 |
|
392 | |||
383 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems |
|
393 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems | |
384 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. |
|
394 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. | |
385 | */ |
|
395 | */ | |
386 | pre, code, kbd, samp { white-space: pre-wrap; } |
|
396 | pre, code, kbd, samp { white-space: pre-wrap; } | |
387 |
|
397 | |||
388 | #fonttest { |
|
398 | #fonttest { | |
389 | font-family: monospace; |
|
399 | font-family: monospace; | |
390 | } |
|
400 | } | |
391 |
|
401 | |||
392 | .js-error { |
|
402 | .js-error { | |
393 | color: darkred; |
|
403 | color: darkred; | |
394 | } No newline at end of file |
|
404 | } |
@@ -1,391 +1,391 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // Kernel |
|
9 | // Kernel | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 |
|
13 | |||
14 | var utils = IPython.utils; |
|
14 | var utils = IPython.utils; | |
15 |
|
15 | |||
16 | // Initialization and connection. |
|
16 | // Initialization and connection. | |
17 |
|
17 | |||
18 | var Kernel = function (base_url) { |
|
18 | var Kernel = function (base_url) { | |
19 | this.kernel_id = null; |
|
19 | this.kernel_id = null; | |
20 | this.shell_channel = null; |
|
20 | this.shell_channel = null; | |
21 | this.iopub_channel = null; |
|
21 | this.iopub_channel = null; | |
22 | this.base_url = base_url; |
|
22 | this.base_url = base_url; | |
23 | this.running = false; |
|
23 | this.running = false; | |
24 | this.username = "username"; |
|
24 | this.username = "username"; | |
25 | this.session_id = utils.uuid(); |
|
25 | this.session_id = utils.uuid(); | |
26 | this._msg_callbacks = {}; |
|
26 | this._msg_callbacks = {}; | |
27 |
|
27 | |||
28 | if (typeof(WebSocket) !== 'undefined') { |
|
28 | if (typeof(WebSocket) !== 'undefined') { | |
29 | this.WebSocket = WebSocket; |
|
29 | this.WebSocket = WebSocket; | |
30 | } else if (typeof(MozWebSocket) !== 'undefined') { |
|
30 | } else if (typeof(MozWebSocket) !== 'undefined') { | |
31 | this.WebSocket = MozWebSocket; |
|
31 | this.WebSocket = MozWebSocket; | |
32 | } else { |
|
32 | } else { | |
33 | alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox β₯ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.'); |
|
33 | alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox β₯ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.'); | |
34 | }; |
|
34 | }; | |
35 | }; |
|
35 | }; | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | Kernel.prototype._get_msg = function (msg_type, content) { |
|
38 | Kernel.prototype._get_msg = function (msg_type, content) { | |
39 | var msg = { |
|
39 | var msg = { | |
40 | header : { |
|
40 | header : { | |
41 | msg_id : utils.uuid(), |
|
41 | msg_id : utils.uuid(), | |
42 | username : this.username, |
|
42 | username : this.username, | |
43 | session : this.session_id, |
|
43 | session : this.session_id, | |
44 | msg_type : msg_type |
|
44 | msg_type : msg_type | |
45 | }, |
|
45 | }, | |
46 | metadata : {}, |
|
46 | metadata : {}, | |
47 | content : content, |
|
47 | content : content, | |
48 | parent_header : {} |
|
48 | parent_header : {} | |
49 | }; |
|
49 | }; | |
50 | return msg; |
|
50 | return msg; | |
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 | Kernel.prototype.start = function (notebook_id) { |
|
53 | Kernel.prototype.start = function (notebook_id) { | |
54 | var that = this; |
|
54 | var that = this; | |
55 | if (!this.running) { |
|
55 | if (!this.running) { | |
56 | var qs = $.param({notebook:notebook_id}); |
|
56 | var qs = $.param({notebook:notebook_id}); | |
57 | var url = this.base_url + '?' + qs; |
|
57 | var url = this.base_url + '?' + qs; | |
58 | $.post(url, |
|
58 | $.post(url, | |
59 | $.proxy(that._kernel_started,that), |
|
59 | $.proxy(that._kernel_started,that), | |
60 | 'json' |
|
60 | 'json' | |
61 | ); |
|
61 | ); | |
62 | }; |
|
62 | }; | |
63 | }; |
|
63 | }; | |
64 |
|
64 | |||
65 |
|
65 | |||
66 | Kernel.prototype.restart = function () { |
|
66 | Kernel.prototype.restart = function () { | |
67 | $([IPython.events]).trigger({type: 'status_restarting.Kernel', kernel: this}); |
|
67 | $([IPython.events]).trigger({type: 'status_restarting.Kernel', kernel: this}); | |
68 | var that = this; |
|
68 | var that = this; | |
69 | if (this.running) { |
|
69 | if (this.running) { | |
70 | this.stop_channels(); |
|
70 | this.stop_channels(); | |
71 | var url = this.kernel_url + "/restart"; |
|
71 | var url = this.kernel_url + "/restart"; | |
72 | $.post(url, |
|
72 | $.post(url, | |
73 | $.proxy(that._kernel_started, that), |
|
73 | $.proxy(that._kernel_started, that), | |
74 | 'json' |
|
74 | 'json' | |
75 | ); |
|
75 | ); | |
76 | }; |
|
76 | }; | |
77 | }; |
|
77 | }; | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | Kernel.prototype._kernel_started = function (json) { |
|
80 | Kernel.prototype._kernel_started = function (json) { | |
81 | console.log("Kernel started: ", json.kernel_id); |
|
81 | console.log("Kernel started: ", json.kernel_id); | |
82 | this.running = true; |
|
82 | this.running = true; | |
83 | this.kernel_id = json.kernel_id; |
|
83 | this.kernel_id = json.kernel_id; | |
84 | this.ws_url = json.ws_url; |
|
84 | this.ws_url = json.ws_url; | |
85 | this.kernel_url = this.base_url + "/" + this.kernel_id; |
|
85 | this.kernel_url = this.base_url + "/" + this.kernel_id; | |
86 | this.start_channels(); |
|
86 | this.start_channels(); | |
87 | this.shell_channel.onmessage = $.proxy(this._handle_shell_reply,this); |
|
87 | this.shell_channel.onmessage = $.proxy(this._handle_shell_reply,this); | |
88 | this.iopub_channel.onmessage = $.proxy(this._handle_iopub_reply,this); |
|
88 | this.iopub_channel.onmessage = $.proxy(this._handle_iopub_reply,this); | |
89 | }; |
|
89 | }; | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | Kernel.prototype._websocket_closed = function(ws_url, early){ |
|
92 | Kernel.prototype._websocket_closed = function(ws_url, early){ | |
93 | var msg; |
|
93 | var msg; | |
94 | var parent_item = $('body'); |
|
94 | var parent_item = $('body'); | |
95 | if (early) { |
|
95 | if (early) { | |
96 | msg = "Websocket connection to " + ws_url + " could not be established." + |
|
96 | msg = "Websocket connection to " + ws_url + " could not be established." + | |
97 | " You will NOT be able to run code." + |
|
97 | " You will NOT be able to run code." + | |
98 | " Your browser may not be compatible with the websocket version in the server," + |
|
98 | " Your browser may not be compatible with the websocket version in the server," + | |
99 | " or if the url does not look right, there could be an error in the" + |
|
99 | " or if the url does not look right, there could be an error in the" + | |
100 | " server's configuration."; |
|
100 | " server's configuration."; | |
101 | } else { |
|
101 | } else { | |
102 | IPython.notification_widget.set_message('Reconnecting Websockets', 1000); |
|
102 | IPython.notification_area.widget('kernel').set_message('Reconnecting Websockets', 1000); | |
103 | this.start_channels(); |
|
103 | this.start_channels(); | |
104 | return; |
|
104 | return; | |
105 | } |
|
105 | } | |
106 | var dialog = $('<div/>'); |
|
106 | var dialog = $('<div/>'); | |
107 | dialog.html(msg); |
|
107 | dialog.html(msg); | |
108 | parent_item.append(dialog); |
|
108 | parent_item.append(dialog); | |
109 | dialog.dialog({ |
|
109 | dialog.dialog({ | |
110 | resizable: false, |
|
110 | resizable: false, | |
111 | modal: true, |
|
111 | modal: true, | |
112 | title: "Websocket closed", |
|
112 | title: "Websocket closed", | |
113 | closeText: "", |
|
113 | closeText: "", | |
114 | close: function(event, ui) {$(this).dialog('destroy').remove();}, |
|
114 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
115 | buttons : { |
|
115 | buttons : { | |
116 | "OK": function () { |
|
116 | "OK": function () { | |
117 | $(this).dialog('close'); |
|
117 | $(this).dialog('close'); | |
118 | } |
|
118 | } | |
119 | } |
|
119 | } | |
120 | }); |
|
120 | }); | |
121 |
|
121 | |||
122 | }; |
|
122 | }; | |
123 |
|
123 | |||
124 | Kernel.prototype.start_channels = function () { |
|
124 | Kernel.prototype.start_channels = function () { | |
125 | var that = this; |
|
125 | var that = this; | |
126 | this.stop_channels(); |
|
126 | this.stop_channels(); | |
127 | var ws_url = this.ws_url + this.kernel_url; |
|
127 | var ws_url = this.ws_url + this.kernel_url; | |
128 | console.log("Starting WS:", ws_url); |
|
128 | console.log("Starting WS:", ws_url); | |
129 | this.shell_channel = new this.WebSocket(ws_url + "/shell"); |
|
129 | this.shell_channel = new this.WebSocket(ws_url + "/shell"); | |
130 | this.iopub_channel = new this.WebSocket(ws_url + "/iopub"); |
|
130 | this.iopub_channel = new this.WebSocket(ws_url + "/iopub"); | |
131 | send_cookie = function(){ |
|
131 | send_cookie = function(){ | |
132 | this.send(document.cookie); |
|
132 | this.send(document.cookie); | |
133 | }; |
|
133 | }; | |
134 | var already_called_onclose = false; // only alert once |
|
134 | var already_called_onclose = false; // only alert once | |
135 | ws_closed_early = function(evt){ |
|
135 | ws_closed_early = function(evt){ | |
136 | if (already_called_onclose){ |
|
136 | if (already_called_onclose){ | |
137 | return; |
|
137 | return; | |
138 | } |
|
138 | } | |
139 | already_called_onclose = true; |
|
139 | already_called_onclose = true; | |
140 | if ( ! evt.wasClean ){ |
|
140 | if ( ! evt.wasClean ){ | |
141 | that._websocket_closed(ws_url, true); |
|
141 | that._websocket_closed(ws_url, true); | |
142 | } |
|
142 | } | |
143 | }; |
|
143 | }; | |
144 | ws_closed_late = function(evt){ |
|
144 | ws_closed_late = function(evt){ | |
145 | if (already_called_onclose){ |
|
145 | if (already_called_onclose){ | |
146 | return; |
|
146 | return; | |
147 | } |
|
147 | } | |
148 | already_called_onclose = true; |
|
148 | already_called_onclose = true; | |
149 | if ( ! evt.wasClean ){ |
|
149 | if ( ! evt.wasClean ){ | |
150 | that._websocket_closed(ws_url, false); |
|
150 | that._websocket_closed(ws_url, false); | |
151 | } |
|
151 | } | |
152 | }; |
|
152 | }; | |
153 | this.shell_channel.onopen = send_cookie; |
|
153 | this.shell_channel.onopen = send_cookie; | |
154 | this.shell_channel.onclose = ws_closed_early; |
|
154 | this.shell_channel.onclose = ws_closed_early; | |
155 | this.iopub_channel.onopen = send_cookie; |
|
155 | this.iopub_channel.onopen = send_cookie; | |
156 | this.iopub_channel.onclose = ws_closed_early; |
|
156 | this.iopub_channel.onclose = ws_closed_early; | |
157 | // switch from early-close to late-close message after 1s |
|
157 | // switch from early-close to late-close message after 1s | |
158 | setTimeout(function(){ |
|
158 | setTimeout(function(){ | |
159 | that.shell_channel.onclose = ws_closed_late; |
|
159 | that.shell_channel.onclose = ws_closed_late; | |
160 | that.iopub_channel.onclose = ws_closed_late; |
|
160 | that.iopub_channel.onclose = ws_closed_late; | |
161 | }, 1000); |
|
161 | }, 1000); | |
162 | }; |
|
162 | }; | |
163 |
|
163 | |||
164 |
|
164 | |||
165 | Kernel.prototype.stop_channels = function () { |
|
165 | Kernel.prototype.stop_channels = function () { | |
166 | if (this.shell_channel !== null) { |
|
166 | if (this.shell_channel !== null) { | |
167 | this.shell_channel.onclose = function (evt) {}; |
|
167 | this.shell_channel.onclose = function (evt) {}; | |
168 | this.shell_channel.close(); |
|
168 | this.shell_channel.close(); | |
169 | this.shell_channel = null; |
|
169 | this.shell_channel = null; | |
170 | }; |
|
170 | }; | |
171 | if (this.iopub_channel !== null) { |
|
171 | if (this.iopub_channel !== null) { | |
172 | this.iopub_channel.onclose = function (evt) {}; |
|
172 | this.iopub_channel.onclose = function (evt) {}; | |
173 | this.iopub_channel.close(); |
|
173 | this.iopub_channel.close(); | |
174 | this.iopub_channel = null; |
|
174 | this.iopub_channel = null; | |
175 | }; |
|
175 | }; | |
176 | }; |
|
176 | }; | |
177 |
|
177 | |||
178 | // Main public methods. |
|
178 | // Main public methods. | |
179 |
|
179 | |||
180 | Kernel.prototype.object_info_request = function (objname, callbacks) { |
|
180 | Kernel.prototype.object_info_request = function (objname, callbacks) { | |
181 | // When calling this method pass a callbacks structure of the form: |
|
181 | // When calling this method pass a callbacks structure of the form: | |
182 | // |
|
182 | // | |
183 | // callbacks = { |
|
183 | // callbacks = { | |
184 | // 'object_info_reply': object_into_reply_callback |
|
184 | // 'object_info_reply': object_into_reply_callback | |
185 | // } |
|
185 | // } | |
186 | // |
|
186 | // | |
187 | // The object_info_reply_callback will be passed the content object of the |
|
187 | // The object_info_reply_callback will be passed the content object of the | |
188 | // object_into_reply message documented here: |
|
188 | // object_into_reply message documented here: | |
189 | // |
|
189 | // | |
190 | // http://ipython.org/ipython-doc/dev/development/messaging.html#object-information |
|
190 | // http://ipython.org/ipython-doc/dev/development/messaging.html#object-information | |
191 | if(typeof(objname)!=null && objname!=null) |
|
191 | if(typeof(objname)!=null && objname!=null) | |
192 | { |
|
192 | { | |
193 | var content = { |
|
193 | var content = { | |
194 | oname : objname.toString(), |
|
194 | oname : objname.toString(), | |
195 | }; |
|
195 | }; | |
196 | var msg = this._get_msg("object_info_request", content); |
|
196 | var msg = this._get_msg("object_info_request", content); | |
197 | this.shell_channel.send(JSON.stringify(msg)); |
|
197 | this.shell_channel.send(JSON.stringify(msg)); | |
198 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); |
|
198 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); | |
199 | return msg.header.msg_id; |
|
199 | return msg.header.msg_id; | |
200 | } |
|
200 | } | |
201 | return; |
|
201 | return; | |
202 | } |
|
202 | } | |
203 |
|
203 | |||
204 | Kernel.prototype.execute = function (code, callbacks, options) { |
|
204 | Kernel.prototype.execute = function (code, callbacks, options) { | |
205 | // The options object should contain the options for the execute call. Its default |
|
205 | // The options object should contain the options for the execute call. Its default | |
206 | // values are: |
|
206 | // values are: | |
207 | // |
|
207 | // | |
208 | // options = { |
|
208 | // options = { | |
209 | // silent : true, |
|
209 | // silent : true, | |
210 | // user_variables : [], |
|
210 | // user_variables : [], | |
211 | // user_expressions : {}, |
|
211 | // user_expressions : {}, | |
212 | // allow_stdin : false |
|
212 | // allow_stdin : false | |
213 | // } |
|
213 | // } | |
214 | // |
|
214 | // | |
215 | // When calling this method pass a callbacks structure of the form: |
|
215 | // When calling this method pass a callbacks structure of the form: | |
216 | // |
|
216 | // | |
217 | // callbacks = { |
|
217 | // callbacks = { | |
218 | // 'execute_reply': execute_reply_callback, |
|
218 | // 'execute_reply': execute_reply_callback, | |
219 | // 'output': output_callback, |
|
219 | // 'output': output_callback, | |
220 | // 'clear_output': clear_output_callback, |
|
220 | // 'clear_output': clear_output_callback, | |
221 | // 'set_next_input': set_next_input_callback |
|
221 | // 'set_next_input': set_next_input_callback | |
222 | // } |
|
222 | // } | |
223 | // |
|
223 | // | |
224 | // The execute_reply_callback will be passed the content and metadata objects of the execute_reply |
|
224 | // The execute_reply_callback will be passed the content and metadata objects of the execute_reply | |
225 | // message documented here: |
|
225 | // message documented here: | |
226 | // |
|
226 | // | |
227 | // http://ipython.org/ipython-doc/dev/development/messaging.html#execute |
|
227 | // http://ipython.org/ipython-doc/dev/development/messaging.html#execute | |
228 | // |
|
228 | // | |
229 | // The output_callback will be passed msg_type ('stream','display_data','pyout','pyerr') |
|
229 | // The output_callback will be passed msg_type ('stream','display_data','pyout','pyerr') | |
230 | // of the output and the content and metadata objects of the PUB/SUB channel that contains the |
|
230 | // of the output and the content and metadata objects of the PUB/SUB channel that contains the | |
231 | // output: |
|
231 | // output: | |
232 | // |
|
232 | // | |
233 | // http://ipython.org/ipython-doc/dev/development/messaging.html#messages-on-the-pub-sub-socket |
|
233 | // http://ipython.org/ipython-doc/dev/development/messaging.html#messages-on-the-pub-sub-socket | |
234 | // |
|
234 | // | |
235 | // The clear_output_callback will be passed a content object that contains |
|
235 | // The clear_output_callback will be passed a content object that contains | |
236 | // stdout, stderr and other fields that are booleans, as well as the metadata object. |
|
236 | // stdout, stderr and other fields that are booleans, as well as the metadata object. | |
237 | // |
|
237 | // | |
238 | // The set_next_input_callback will be passed the text that should become the next |
|
238 | // The set_next_input_callback will be passed the text that should become the next | |
239 | // input cell. |
|
239 | // input cell. | |
240 |
|
240 | |||
241 | var content = { |
|
241 | var content = { | |
242 | code : code, |
|
242 | code : code, | |
243 | silent : true, |
|
243 | silent : true, | |
244 | user_variables : [], |
|
244 | user_variables : [], | |
245 | user_expressions : {}, |
|
245 | user_expressions : {}, | |
246 | allow_stdin : false |
|
246 | allow_stdin : false | |
247 | }; |
|
247 | }; | |
248 | $.extend(true, content, options) |
|
248 | $.extend(true, content, options) | |
249 | var msg = this._get_msg("execute_request", content); |
|
249 | var msg = this._get_msg("execute_request", content); | |
250 | this.shell_channel.send(JSON.stringify(msg)); |
|
250 | this.shell_channel.send(JSON.stringify(msg)); | |
251 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); |
|
251 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); | |
252 | return msg.header.msg_id; |
|
252 | return msg.header.msg_id; | |
253 | }; |
|
253 | }; | |
254 |
|
254 | |||
255 |
|
255 | |||
256 | Kernel.prototype.complete = function (line, cursor_pos, callbacks) { |
|
256 | Kernel.prototype.complete = function (line, cursor_pos, callbacks) { | |
257 | // When calling this method pass a callbacks structure of the form: |
|
257 | // When calling this method pass a callbacks structure of the form: | |
258 | // |
|
258 | // | |
259 | // callbacks = { |
|
259 | // callbacks = { | |
260 | // 'complete_reply': complete_reply_callback |
|
260 | // 'complete_reply': complete_reply_callback | |
261 | // } |
|
261 | // } | |
262 | // |
|
262 | // | |
263 | // The complete_reply_callback will be passed the content object of the |
|
263 | // The complete_reply_callback will be passed the content object of the | |
264 | // complete_reply message documented here: |
|
264 | // complete_reply message documented here: | |
265 | // |
|
265 | // | |
266 | // http://ipython.org/ipython-doc/dev/development/messaging.html#complete |
|
266 | // http://ipython.org/ipython-doc/dev/development/messaging.html#complete | |
267 | callbacks = callbacks || {}; |
|
267 | callbacks = callbacks || {}; | |
268 | var content = { |
|
268 | var content = { | |
269 | text : '', |
|
269 | text : '', | |
270 | line : line, |
|
270 | line : line, | |
271 | cursor_pos : cursor_pos |
|
271 | cursor_pos : cursor_pos | |
272 | }; |
|
272 | }; | |
273 | var msg = this._get_msg("complete_request", content); |
|
273 | var msg = this._get_msg("complete_request", content); | |
274 | this.shell_channel.send(JSON.stringify(msg)); |
|
274 | this.shell_channel.send(JSON.stringify(msg)); | |
275 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); |
|
275 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); | |
276 | return msg.header.msg_id; |
|
276 | return msg.header.msg_id; | |
277 | }; |
|
277 | }; | |
278 |
|
278 | |||
279 |
|
279 | |||
280 | Kernel.prototype.interrupt = function () { |
|
280 | Kernel.prototype.interrupt = function () { | |
281 | if (this.running) { |
|
281 | if (this.running) { | |
282 | $([IPython.events]).trigger({type: 'status_interrupting.Kernel', kernel: this}); |
|
282 | $([IPython.events]).trigger({type: 'status_interrupting.Kernel', kernel: this}); | |
283 | $.post(this.kernel_url + "/interrupt"); |
|
283 | $.post(this.kernel_url + "/interrupt"); | |
284 | }; |
|
284 | }; | |
285 | }; |
|
285 | }; | |
286 |
|
286 | |||
287 |
|
287 | |||
288 | Kernel.prototype.kill = function () { |
|
288 | Kernel.prototype.kill = function () { | |
289 | if (this.running) { |
|
289 | if (this.running) { | |
290 | this.running = false; |
|
290 | this.running = false; | |
291 | var settings = { |
|
291 | var settings = { | |
292 | cache : false, |
|
292 | cache : false, | |
293 | type : "DELETE" |
|
293 | type : "DELETE" | |
294 | }; |
|
294 | }; | |
295 | $.ajax(this.kernel_url, settings); |
|
295 | $.ajax(this.kernel_url, settings); | |
296 | }; |
|
296 | }; | |
297 | }; |
|
297 | }; | |
298 |
|
298 | |||
299 |
|
299 | |||
300 | // Reply handlers. |
|
300 | // Reply handlers. | |
301 |
|
301 | |||
302 | Kernel.prototype.get_callbacks_for_msg = function (msg_id) { |
|
302 | Kernel.prototype.get_callbacks_for_msg = function (msg_id) { | |
303 | var callbacks = this._msg_callbacks[msg_id]; |
|
303 | var callbacks = this._msg_callbacks[msg_id]; | |
304 | return callbacks; |
|
304 | return callbacks; | |
305 | }; |
|
305 | }; | |
306 |
|
306 | |||
307 |
|
307 | |||
308 | Kernel.prototype.set_callbacks_for_msg = function (msg_id, callbacks) { |
|
308 | Kernel.prototype.set_callbacks_for_msg = function (msg_id, callbacks) { | |
309 | this._msg_callbacks[msg_id] = callbacks || {}; |
|
309 | this._msg_callbacks[msg_id] = callbacks || {}; | |
310 | } |
|
310 | } | |
311 |
|
311 | |||
312 |
|
312 | |||
313 | Kernel.prototype._handle_shell_reply = function (e) { |
|
313 | Kernel.prototype._handle_shell_reply = function (e) { | |
314 | reply = $.parseJSON(e.data); |
|
314 | reply = $.parseJSON(e.data); | |
315 | var header = reply.header; |
|
315 | var header = reply.header; | |
316 | var content = reply.content; |
|
316 | var content = reply.content; | |
317 | var metadata = reply.metadata; |
|
317 | var metadata = reply.metadata; | |
318 | var msg_type = header.msg_type; |
|
318 | var msg_type = header.msg_type; | |
319 | var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id); |
|
319 | var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id); | |
320 | if (callbacks !== undefined) { |
|
320 | if (callbacks !== undefined) { | |
321 | var cb = callbacks[msg_type]; |
|
321 | var cb = callbacks[msg_type]; | |
322 | if (cb !== undefined) { |
|
322 | if (cb !== undefined) { | |
323 | cb(content, metadata); |
|
323 | cb(content, metadata); | |
324 | } |
|
324 | } | |
325 | }; |
|
325 | }; | |
326 |
|
326 | |||
327 | if (content.payload !== undefined) { |
|
327 | if (content.payload !== undefined) { | |
328 | var payload = content.payload || []; |
|
328 | var payload = content.payload || []; | |
329 | this._handle_payload(callbacks, payload); |
|
329 | this._handle_payload(callbacks, payload); | |
330 | } |
|
330 | } | |
331 | }; |
|
331 | }; | |
332 |
|
332 | |||
333 |
|
333 | |||
334 | Kernel.prototype._handle_payload = function (callbacks, payload) { |
|
334 | Kernel.prototype._handle_payload = function (callbacks, payload) { | |
335 | var l = payload.length; |
|
335 | var l = payload.length; | |
336 | // Payloads are handled by triggering events because we don't want the Kernel |
|
336 | // Payloads are handled by triggering events because we don't want the Kernel | |
337 | // to depend on the Notebook or Pager classes. |
|
337 | // to depend on the Notebook or Pager classes. | |
338 | for (var i=0; i<l; i++) { |
|
338 | for (var i=0; i<l; i++) { | |
339 | if (payload[i].source === 'IPython.zmq.page.page') { |
|
339 | if (payload[i].source === 'IPython.zmq.page.page') { | |
340 | var data = {'text':payload[i].text} |
|
340 | var data = {'text':payload[i].text} | |
341 | $([IPython.events]).trigger('open_with_text.Pager', data); |
|
341 | $([IPython.events]).trigger('open_with_text.Pager', data); | |
342 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { |
|
342 | } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') { | |
343 | if (callbacks.set_next_input !== undefined) { |
|
343 | if (callbacks.set_next_input !== undefined) { | |
344 | callbacks.set_next_input(payload[i].text) |
|
344 | callbacks.set_next_input(payload[i].text) | |
345 | } |
|
345 | } | |
346 | } |
|
346 | } | |
347 | }; |
|
347 | }; | |
348 | }; |
|
348 | }; | |
349 |
|
349 | |||
350 |
|
350 | |||
351 | Kernel.prototype._handle_iopub_reply = function (e) { |
|
351 | Kernel.prototype._handle_iopub_reply = function (e) { | |
352 | var reply = $.parseJSON(e.data); |
|
352 | var reply = $.parseJSON(e.data); | |
353 | var content = reply.content; |
|
353 | var content = reply.content; | |
354 | var msg_type = reply.header.msg_type; |
|
354 | var msg_type = reply.header.msg_type; | |
355 | var metadata = reply.metadata; |
|
355 | var metadata = reply.metadata; | |
356 | var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id); |
|
356 | var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id); | |
357 | if (msg_type !== 'status' && callbacks === undefined) { |
|
357 | if (msg_type !== 'status' && callbacks === undefined) { | |
358 | // Message not from one of this notebook's cells and there are no |
|
358 | // Message not from one of this notebook's cells and there are no | |
359 | // callbacks to handle it. |
|
359 | // callbacks to handle it. | |
360 | return; |
|
360 | return; | |
361 | } |
|
361 | } | |
362 | var output_types = ['stream','display_data','pyout','pyerr']; |
|
362 | var output_types = ['stream','display_data','pyout','pyerr']; | |
363 | if (output_types.indexOf(msg_type) >= 0) { |
|
363 | if (output_types.indexOf(msg_type) >= 0) { | |
364 | var cb = callbacks['output']; |
|
364 | var cb = callbacks['output']; | |
365 | if (cb !== undefined) { |
|
365 | if (cb !== undefined) { | |
366 | cb(msg_type, content, metadata); |
|
366 | cb(msg_type, content, metadata); | |
367 | } |
|
367 | } | |
368 | } else if (msg_type === 'status') { |
|
368 | } else if (msg_type === 'status') { | |
369 | if (content.execution_state === 'busy') { |
|
369 | if (content.execution_state === 'busy') { | |
370 | $([IPython.events]).trigger({type: 'status_busy.Kernel', kernel: this}); |
|
370 | $([IPython.events]).trigger({type: 'status_busy.Kernel', kernel: this}); | |
371 | } else if (content.execution_state === 'idle') { |
|
371 | } else if (content.execution_state === 'idle') { | |
372 | $([IPython.events]).trigger({type: 'status_idle.Kernel', kernel: this}); |
|
372 | $([IPython.events]).trigger({type: 'status_idle.Kernel', kernel: this}); | |
373 | } else if (content.execution_state === 'dead') { |
|
373 | } else if (content.execution_state === 'dead') { | |
374 | this.stop_channels(); |
|
374 | this.stop_channels(); | |
375 | $([IPython.events]).trigger({type: 'status_dead.Kernel', kernel: this}); |
|
375 | $([IPython.events]).trigger({type: 'status_dead.Kernel', kernel: this}); | |
376 | }; |
|
376 | }; | |
377 | } else if (msg_type === 'clear_output') { |
|
377 | } else if (msg_type === 'clear_output') { | |
378 | var cb = callbacks['clear_output']; |
|
378 | var cb = callbacks['clear_output']; | |
379 | if (cb !== undefined) { |
|
379 | if (cb !== undefined) { | |
380 | cb(content, metadata); |
|
380 | cb(content, metadata); | |
381 | } |
|
381 | } | |
382 | }; |
|
382 | }; | |
383 | }; |
|
383 | }; | |
384 |
|
384 | |||
385 |
|
385 | |||
386 | IPython.Kernel = Kernel; |
|
386 | IPython.Kernel = Kernel; | |
387 |
|
387 | |||
388 | return IPython; |
|
388 | return IPython; | |
389 |
|
389 | |||
390 | }(IPython)); |
|
390 | }(IPython)); | |
391 |
|
391 |
@@ -1,67 +1,68 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // On document ready |
|
9 | // On document ready | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 |
|
12 | |||
13 | $(document).ready(function () { |
|
13 | $(document).ready(function () { | |
14 |
|
14 | |||
15 | IPython.init_mathjax(); |
|
15 | IPython.init_mathjax(); | |
16 |
|
16 | |||
17 | IPython.read_only = $('body').data('readOnly') === 'True'; |
|
17 | IPython.read_only = $('body').data('readOnly') === 'True'; | |
18 | $('div#main_app').addClass('border-box-sizing ui-widget'); |
|
18 | $('div#main_app').addClass('border-box-sizing ui-widget'); | |
19 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); |
|
19 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); | |
20 | // The header's bottom border is provided by the menu bar so we remove it. |
|
20 | // The header's bottom border is provided by the menu bar so we remove it. | |
21 | $('div#header').css('border-bottom-style','none'); |
|
21 | $('div#header').css('border-bottom-style','none'); | |
22 |
|
22 | |||
23 | IPython.page = new IPython.Page(); |
|
23 | IPython.page = new IPython.Page(); | |
24 | IPython.markdown_converter = new Markdown.Converter(); |
|
24 | IPython.markdown_converter = new Markdown.Converter(); | |
25 | IPython.layout_manager = new IPython.LayoutManager(); |
|
25 | IPython.layout_manager = new IPython.LayoutManager(); | |
26 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); |
|
26 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); | |
27 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); |
|
27 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); | |
28 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); |
|
28 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); | |
29 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
29 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
30 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
30 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |
31 | IPython.menubar = new IPython.MenuBar('#menubar') |
|
31 | IPython.menubar = new IPython.MenuBar('#menubar') | |
32 | IPython.toolbar = new IPython.ToolBar('#toolbar') |
|
32 | IPython.toolbar = new IPython.ToolBar('#toolbar') | |
33 | IPython.tooltip = new IPython.Tooltip() |
|
33 | IPython.tooltip = new IPython.Tooltip() | |
34 |
IPython.notification_ |
|
34 | IPython.notification_area = new IPython.NotificationArea('#notification_area') | |
|
35 | IPython.notification_area.init_notification_widgets(); | |||
35 |
|
36 | |||
36 | IPython.layout_manager.do_resize(); |
|
37 | IPython.layout_manager.do_resize(); | |
37 |
|
38 | |||
38 | $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+ |
|
39 | $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+ | |
39 | '<span id="test2" style="font-weight: bold;">x</span>'+ |
|
40 | '<span id="test2" style="font-weight: bold;">x</span>'+ | |
40 | '<span id="test3" style="font-style: italic;">x</span></pre></div>') |
|
41 | '<span id="test3" style="font-style: italic;">x</span></pre></div>') | |
41 | var nh = $('#test1').innerHeight(); |
|
42 | var nh = $('#test1').innerHeight(); | |
42 | var bh = $('#test2').innerHeight(); |
|
43 | var bh = $('#test2').innerHeight(); | |
43 | var ih = $('#test3').innerHeight(); |
|
44 | var ih = $('#test3').innerHeight(); | |
44 | if(nh != bh || nh != ih) { |
|
45 | if(nh != bh || nh != ih) { | |
45 | $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>'); |
|
46 | $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>'); | |
46 | } |
|
47 | } | |
47 | $('#fonttest').remove(); |
|
48 | $('#fonttest').remove(); | |
48 |
|
49 | |||
49 | if(IPython.read_only){ |
|
50 | if(IPython.read_only){ | |
50 | // hide various elements from read-only view |
|
51 | // hide various elements from read-only view | |
51 | $('div#pager').remove(); |
|
52 | $('div#pager').remove(); | |
52 | $('div#pager_splitter').remove(); |
|
53 | $('div#pager_splitter').remove(); | |
53 |
|
54 | |||
54 | // set the notebook name field as not modifiable |
|
55 | // set the notebook name field as not modifiable | |
55 | $('#notebook_name').attr('disabled','disabled') |
|
56 | $('#notebook_name').attr('disabled','disabled') | |
56 | } |
|
57 | } | |
57 |
|
58 | |||
58 | IPython.page.show(); |
|
59 | IPython.page.show(); | |
59 |
|
60 | |||
60 | IPython.layout_manager.do_resize(); |
|
61 | IPython.layout_manager.do_resize(); | |
61 | $([IPython.events]).on('notebook_loaded.Notebook', function () { |
|
62 | $([IPython.events]).on('notebook_loaded.Notebook', function () { | |
62 | IPython.layout_manager.do_resize(); |
|
63 | IPython.layout_manager.do_resize(); | |
63 | }) |
|
64 | }) | |
64 | IPython.notebook.load_notebook($('body').data('notebookId')); |
|
65 | IPython.notebook.load_notebook($('body').data('notebookId')); | |
65 |
|
66 | |||
66 | }); |
|
67 | }); | |
67 |
|
68 |
@@ -1,123 +1,82 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // Notification widget |
|
9 | // Notification widget | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 |
|
13 | "use strict"; | ||
14 | var utils = IPython.utils; |
|
14 | var utils = IPython.utils; | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | var NotificationWidget = function (selector) { |
|
17 | var NotificationWidget = function (selector) { | |
18 | this.selector = selector; |
|
18 | this.selector = selector; | |
19 | this.timeout = null; |
|
19 | this.timeout = null; | |
20 | this.busy = false; |
|
20 | this.busy = false; | |
21 | if (this.selector !== undefined) { |
|
21 | if (this.selector !== undefined) { | |
22 | this.element = $(selector); |
|
22 | this.element = $(selector); | |
23 | this.style(); |
|
23 | this.style(); | |
24 | this.bind_events(); |
|
|||
25 | } |
|
24 | } | |
|
25 | this.element.button(); | |||
|
26 | this.element.hide(); | |||
|
27 | var that = this; | |||
|
28 | ||||
26 | }; |
|
29 | }; | |
27 |
|
30 | |||
28 |
|
31 | |||
29 | NotificationWidget.prototype.style = function () { |
|
32 | NotificationWidget.prototype.style = function () { | |
30 | this.element.addClass('ui-widget ui-widget-content ui-corner-all'); |
|
33 | this.element.addClass('notification_widget ui-widget ui-widget-content ui-corner-all'); | |
31 | this.element.addClass('border-box-sizing'); |
|
34 | this.element.addClass('border-box-sizing'); | |
32 | }; |
|
35 | }; | |
33 |
|
36 | |||
34 |
|
37 | // msg : message to display | ||
35 | NotificationWidget.prototype.bind_events = function () { |
|
38 | // timeout : time in ms before diseapearing | |
36 | var that = this; |
|
39 | // | |
37 | // Kernel events |
|
40 | // if timeout <= 0 | |
38 | $([IPython.events]).on('status_idle.Kernel',function () { |
|
41 | // click_callback : function called if user click on notification | |
39 | IPython.save_widget.update_document_title(); |
|
42 | // could return false to prevent the notification to be dismissed | |
40 | if (that.get_message() === 'Kernel busy') { |
|
43 | NotificationWidget.prototype.set_message = function (msg, timeout, click_callback) { | |
41 | that.element.fadeOut(100, function () { |
|
44 | var callback = click_callback || function() {return false;}; | |
42 | that.element.html(''); |
|
|||
43 | }); |
|
|||
44 | }; |
|
|||
45 | }); |
|
|||
46 | $([IPython.events]).on('status_busy.Kernel',function () { |
|
|||
47 | window.document.title='(Busy) '+window.document.title; |
|
|||
48 | that.set_message("Kernel busy"); |
|
|||
49 | }); |
|
|||
50 | $([IPython.events]).on('status_restarting.Kernel',function () { |
|
|||
51 | IPython.save_widget.update_document_title(); |
|
|||
52 | that.set_message("Restarting kernel",500); |
|
|||
53 | }); |
|
|||
54 | $([IPython.events]).on('status_interrupting.Kernel',function () { |
|
|||
55 | that.set_message("Interrupting kernel",500); |
|
|||
56 | }); |
|
|||
57 | $([IPython.events]).on('status_dead.Kernel',function () { |
|
|||
58 | var dialog = $('<div/>'); |
|
|||
59 | dialog.html('The kernel has died, would you like to restart it? If you do not restart the kernel, you will be able to save the notebook, but running code will not work until the notebook is reopened.'); |
|
|||
60 | $(document).append(dialog); |
|
|||
61 | dialog.dialog({ |
|
|||
62 | resizable: false, |
|
|||
63 | modal: true, |
|
|||
64 | title: "Dead kernel", |
|
|||
65 | buttons : { |
|
|||
66 | "Restart": function () { |
|
|||
67 | $([IPython.events]).trigger('status_restarting.Kernel'); |
|
|||
68 | IPython.notebook.start_kernel(); |
|
|||
69 | $(this).dialog('close'); |
|
|||
70 | }, |
|
|||
71 | "Continue running": function () { |
|
|||
72 | $(this).dialog('close'); |
|
|||
73 | } |
|
|||
74 | } |
|
|||
75 | }); |
|
|||
76 | }); |
|
|||
77 | // Notebook events |
|
|||
78 | $([IPython.events]).on('notebook_loading.Notebook', function () { |
|
|||
79 | that.set_message("Loading notebook",500); |
|
|||
80 | }); |
|
|||
81 | $([IPython.events]).on('notebook_loaded.Notebook', function () { |
|
|||
82 | that.set_message("Notebook loaded",500); |
|
|||
83 | }); |
|
|||
84 | $([IPython.events]).on('notebook_saving.Notebook', function () { |
|
|||
85 | that.set_message("Saving notebook",500); |
|
|||
86 | }); |
|
|||
87 | $([IPython.events]).on('notebook_saved.Notebook', function () { |
|
|||
88 | that.set_message("Notebook saved",2000); |
|
|||
89 | }); |
|
|||
90 | $([IPython.events]).on('notebook_save_failed.Notebook', function () { |
|
|||
91 | that.set_message("Notebook save failed",2000); |
|
|||
92 | }); |
|
|||
93 | }; |
|
|||
94 |
|
||||
95 |
|
||||
96 | NotificationWidget.prototype.set_message = function (msg, timeout) { |
|
|||
97 | var that = this; |
|
45 | var that = this; | |
98 | this.element.html(msg); |
|
46 | this.element.html(msg); | |
99 | this.element.fadeIn(100); |
|
47 | this.element.fadeIn(100); | |
100 | if (this.timeout !== null) { |
|
48 | if (this.timeout !== null) { | |
101 | clearTimeout(this.timeout); |
|
49 | clearTimeout(this.timeout); | |
102 | this.timeout = null; |
|
50 | this.timeout = null; | |
103 |
} |
|
51 | } | |
104 | if (timeout !== undefined) { |
|
52 | if (timeout !== undefined && timeout >=0) { | |
105 | this.timeout = setTimeout(function () { |
|
53 | this.timeout = setTimeout(function () { | |
106 | that.element.fadeOut(100, function () {that.element.html('');}); |
|
54 | that.element.fadeOut(100, function () {that.element.html('');}); | |
107 | that.timeout = null; |
|
55 | that.timeout = null; | |
108 | }, timeout) |
|
56 | }, timeout); | |
109 |
} |
|
57 | } else { | |
|
58 | this.element.click(function() { | |||
|
59 | if( callback() != false ) { | |||
|
60 | that.element.fadeOut(100, function () {that.element.html('');}); | |||
|
61 | that.element.unbind('click'); | |||
|
62 | } | |||
|
63 | if (that.timeout !== undefined) { | |||
|
64 | that.timeout = undefined; | |||
|
65 | clearTimeout(that.timeout); | |||
|
66 | } | |||
|
67 | }); | |||
|
68 | } | |||
110 | }; |
|
69 | }; | |
111 |
|
70 | |||
112 |
|
71 | |||
113 | NotificationWidget.prototype.get_message = function () { |
|
72 | NotificationWidget.prototype.get_message = function () { | |
114 | return this.element.html(); |
|
73 | return this.element.html(); | |
115 | }; |
|
74 | }; | |
116 |
|
75 | |||
117 |
|
76 | |||
118 | IPython.NotificationWidget = NotificationWidget; |
|
77 | IPython.NotificationWidget = NotificationWidget; | |
119 |
|
78 | |||
120 | return IPython; |
|
79 | return IPython; | |
121 |
|
80 | |||
122 | }(IPython)); |
|
81 | }(IPython)); | |
123 |
|
82 |
@@ -1,250 +1,252 b'' | |||||
1 | {% extends page.html %} |
|
1 | {% extends page.html %} | |
2 | {% block stylesheet %} |
|
2 | {% block stylesheet %} | |
3 |
|
3 | |||
4 | {% if mathjax_url %} |
|
4 | {% if mathjax_url %} | |
5 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script> |
|
5 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script> | |
6 | {% end %} |
|
6 | {% end %} | |
7 | <script type="text/javascript"> |
|
7 | <script type="text/javascript"> | |
8 | // MathJax disabled, set as null to distingish from *missing* MathJax, |
|
8 | // MathJax disabled, set as null to distingish from *missing* MathJax, | |
9 | // where it will be undefined, and should prompt a dialog later. |
|
9 | // where it will be undefined, and should prompt a dialog later. | |
10 | window.mathjax_url = "{{mathjax_url}}"; |
|
10 | window.mathjax_url = "{{mathjax_url}}"; | |
11 | </script> |
|
11 | </script> | |
12 |
|
12 | |||
13 | <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}"> |
|
13 | <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}"> | |
14 | <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}"> |
|
14 | <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}"> | |
15 |
|
15 | |||
16 | <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/> |
|
16 | <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/> | |
17 |
|
17 | |||
18 | <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" /> |
|
18 | <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" /> | |
19 | <link rel="stylesheet" href="{{ static_url("css/tooltip.css") }}" type="text/css" /> |
|
19 | <link rel="stylesheet" href="{{ static_url("css/tooltip.css") }}" type="text/css" /> | |
20 | <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" /> |
|
20 | <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" /> | |
21 |
|
21 | |||
22 | <link rel="stylesheet" href="{{ static_url("css/printnotebook.css") }}" type="text/css" media="print"/> |
|
22 | <link rel="stylesheet" href="{{ static_url("css/printnotebook.css") }}" type="text/css" media="print"/> | |
23 |
|
23 | |||
24 | {% end %} |
|
24 | {% end %} | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | {% block params %} |
|
27 | {% block params %} | |
28 |
|
28 | |||
29 | data-project={{project}} |
|
29 | data-project={{project}} | |
30 | data-base-project-url={{base_project_url}} |
|
30 | data-base-project-url={{base_project_url}} | |
31 | data-base-kernel-url={{base_kernel_url}} |
|
31 | data-base-kernel-url={{base_kernel_url}} | |
32 | data-read-only={{read_only and not logged_in}} |
|
32 | data-read-only={{read_only and not logged_in}} | |
33 | data-notebook-id={{notebook_id}} |
|
33 | data-notebook-id={{notebook_id}} | |
34 |
|
34 | |||
35 | {% end %} |
|
35 | {% end %} | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | {% block header %} |
|
38 | {% block header %} | |
39 |
|
39 | |||
40 | <span id="save_widget"> |
|
40 | <span id="save_widget"> | |
41 | <span id="notebook_name"></span> |
|
41 | <span id="notebook_name"></span> | |
42 | <span id="save_status"></span> |
|
42 | <span id="save_status"></span> | |
43 | </span> |
|
43 | </span> | |
44 |
|
44 | |||
45 | {% end %} |
|
45 | {% end %} | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | {% block site %} |
|
48 | {% block site %} | |
49 |
|
49 | |||
50 | <div id="menubar_container"> |
|
50 | <div id="menubar_container"> | |
51 | <div id="menubar"> |
|
51 | <div id="menubar"> | |
52 | <ul id="menus"> |
|
52 | <ul id="menus"> | |
53 | <li><a href="#">File</a> |
|
53 | <li><a href="#">File</a> | |
54 | <ul> |
|
54 | <ul> | |
55 | <li id="new_notebook"><a href="#">New</a></li> |
|
55 | <li id="new_notebook"><a href="#">New</a></li> | |
56 | <li id="open_notebook"><a href="#">Open...</a></li> |
|
56 | <li id="open_notebook"><a href="#">Open...</a></li> | |
57 | <hr/> |
|
57 | <hr/> | |
58 | <li id="copy_notebook"><a href="#">Make a Copy...</a></li> |
|
58 | <li id="copy_notebook"><a href="#">Make a Copy...</a></li> | |
59 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
59 | <li id="rename_notebook"><a href="#">Rename...</a></li> | |
60 | <li id="save_notebook"><a href="#">Save</a></li> |
|
60 | <li id="save_notebook"><a href="#">Save</a></li> | |
61 | <hr/> |
|
61 | <hr/> | |
62 | <li><a href="#">Download as</a> |
|
62 | <li><a href="#">Download as</a> | |
63 | <ul> |
|
63 | <ul> | |
64 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> |
|
64 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> | |
65 | <li id="download_py"><a href="#">Python (.py)</a></li> |
|
65 | <li id="download_py"><a href="#">Python (.py)</a></li> | |
66 | </ul> |
|
66 | </ul> | |
67 | </li> |
|
67 | </li> | |
68 | <hr/> |
|
68 | <hr/> | |
69 | <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li> |
|
69 | <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li> | |
70 | <hr/> |
|
70 | <hr/> | |
71 | <li id="kill_and_exit"><a href="#" >Close and halt</a></li> |
|
71 | <li id="kill_and_exit"><a href="#" >Close and halt</a></li> | |
72 | </ul> |
|
72 | </ul> | |
73 | </li> |
|
73 | </li> | |
74 | <li><a href="#">Edit</a> |
|
74 | <li><a href="#">Edit</a> | |
75 | <ul> |
|
75 | <ul> | |
76 | <li id="cut_cell"><a href="#">Cut Cell</a></li> |
|
76 | <li id="cut_cell"><a href="#">Cut Cell</a></li> | |
77 | <li id="copy_cell"><a href="#">Copy Cell</a></li> |
|
77 | <li id="copy_cell"><a href="#">Copy Cell</a></li> | |
78 | <li id="paste_cell" class="ui-state-disabled"><a href="#">Paste Cell</a></li> |
|
78 | <li id="paste_cell" class="ui-state-disabled"><a href="#">Paste Cell</a></li> | |
79 | <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li> |
|
79 | <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li> | |
80 | <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li> |
|
80 | <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li> | |
81 | <li id="delete_cell"><a href="#">Delete</a></li> |
|
81 | <li id="delete_cell"><a href="#">Delete</a></li> | |
82 | <hr/> |
|
82 | <hr/> | |
83 | <li id="split_cell"><a href="#">Split Cell</a></li> |
|
83 | <li id="split_cell"><a href="#">Split Cell</a></li> | |
84 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> |
|
84 | <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li> | |
85 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> |
|
85 | <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li> | |
86 | <hr/> |
|
86 | <hr/> | |
87 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> |
|
87 | <li id="move_cell_up"><a href="#">Move Cell Up</a></li> | |
88 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> |
|
88 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> | |
89 | <hr/> |
|
89 | <hr/> | |
90 | <li id="select_previous"><a href="#">Select Previous Cell</a></li> |
|
90 | <li id="select_previous"><a href="#">Select Previous Cell</a></li> | |
91 | <li id="select_next"><a href="#">Select Next Cell</a></li> |
|
91 | <li id="select_next"><a href="#">Select Next Cell</a></li> | |
92 | </ul> |
|
92 | </ul> | |
93 | </li> |
|
93 | </li> | |
94 | <li><a href="#">View</a> |
|
94 | <li><a href="#">View</a> | |
95 | <ul> |
|
95 | <ul> | |
96 | <li id="toggle_header"><a href="#">Toggle Header</a></li> |
|
96 | <li id="toggle_header"><a href="#">Toggle Header</a></li> | |
97 | <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li> |
|
97 | <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li> | |
98 | </ul> |
|
98 | </ul> | |
99 | </li> |
|
99 | </li> | |
100 | <li><a href="#">Insert</a> |
|
100 | <li><a href="#">Insert</a> | |
101 | <ul> |
|
101 | <ul> | |
102 | <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li> |
|
102 | <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li> | |
103 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li> |
|
103 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li> | |
104 | </ul> |
|
104 | </ul> | |
105 | </li> |
|
105 | </li> | |
106 | <li><a href="#">Cell</a> |
|
106 | <li><a href="#">Cell</a> | |
107 | <ul> |
|
107 | <ul> | |
108 | <li id="run_cell"><a href="#">Run</a></li> |
|
108 | <li id="run_cell"><a href="#">Run</a></li> | |
109 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> |
|
109 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> | |
110 | <li id="run_all_cells"><a href="#">Run All</a></li> |
|
110 | <li id="run_all_cells"><a href="#">Run All</a></li> | |
111 | <hr/> |
|
111 | <hr/> | |
112 | <li id="to_code"><a href="#">Code</a></li> |
|
112 | <li id="to_code"><a href="#">Code</a></li> | |
113 | <li id="to_markdown"><a href="#">Markdown </a></li> |
|
113 | <li id="to_markdown"><a href="#">Markdown </a></li> | |
114 | <li id="to_raw"><a href="#">Raw Text</a></li> |
|
114 | <li id="to_raw"><a href="#">Raw Text</a></li> | |
115 | <li id="to_heading1"><a href="#">Heading 1</a></li> |
|
115 | <li id="to_heading1"><a href="#">Heading 1</a></li> | |
116 | <li id="to_heading2"><a href="#">Heading 2</a></li> |
|
116 | <li id="to_heading2"><a href="#">Heading 2</a></li> | |
117 | <li id="to_heading3"><a href="#">Heading 3</a></li> |
|
117 | <li id="to_heading3"><a href="#">Heading 3</a></li> | |
118 | <li id="to_heading4"><a href="#">Heading 4</a></li> |
|
118 | <li id="to_heading4"><a href="#">Heading 4</a></li> | |
119 | <li id="to_heading5"><a href="#">Heading 5</a></li> |
|
119 | <li id="to_heading5"><a href="#">Heading 5</a></li> | |
120 | <li id="to_heading6"><a href="#">Heading 6</a></li> |
|
120 | <li id="to_heading6"><a href="#">Heading 6</a></li> | |
121 | <hr/> |
|
121 | <hr/> | |
122 | <li id="toggle_output"><a href="#">Toggle Current Output</a></li> |
|
122 | <li id="toggle_output"><a href="#">Toggle Current Output</a></li> | |
123 | <li id="all_outputs"><a href="#">All Output</a> |
|
123 | <li id="all_outputs"><a href="#">All Output</a> | |
124 | <ul> |
|
124 | <ul> | |
125 | <li id="expand_all_output"><a href="#">Expand</a></li> |
|
125 | <li id="expand_all_output"><a href="#">Expand</a></li> | |
126 | <li id="scroll_all_output"><a href="#">Scroll Long</a></li> |
|
126 | <li id="scroll_all_output"><a href="#">Scroll Long</a></li> | |
127 | <li id="collapse_all_output"><a href="#">Collapse</a></li> |
|
127 | <li id="collapse_all_output"><a href="#">Collapse</a></li> | |
128 | <li id="clear_all_output"><a href="#">Clear</a></li> |
|
128 | <li id="clear_all_output"><a href="#">Clear</a></li> | |
129 | </ul> |
|
129 | </ul> | |
130 | </li> |
|
130 | </li> | |
131 | </ul> |
|
131 | </ul> | |
132 | </li> |
|
132 | </li> | |
133 | <li><a href="#">Kernel</a> |
|
133 | <li><a href="#">Kernel</a> | |
134 | <ul> |
|
134 | <ul> | |
135 | <li id="int_kernel"><a href="#">Interrupt</a></li> |
|
135 | <li id="int_kernel"><a href="#">Interrupt</a></li> | |
136 | <li id="restart_kernel"><a href="#">Restart</a></li> |
|
136 | <li id="restart_kernel"><a href="#">Restart</a></li> | |
137 | </ul> |
|
137 | </ul> | |
138 | </li> |
|
138 | </li> | |
139 | <li><a href="#">Help</a> |
|
139 | <li><a href="#">Help</a> | |
140 | <ul> |
|
140 | <ul> | |
141 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> |
|
141 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> | |
142 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> |
|
142 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> | |
143 | <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
143 | <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li> | |
144 | <hr/> |
|
144 | <hr/> | |
145 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> |
|
145 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> | |
146 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> |
|
146 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> | |
147 | <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li> |
|
147 | <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li> | |
148 | <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li> |
|
148 | <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li> | |
149 | <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li> |
|
149 | <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li> | |
150 | </ul> |
|
150 | </ul> | |
151 | </li> |
|
151 | </li> | |
152 | </ul> |
|
152 | </ul> | |
153 |
|
153 | |||
154 | </div> |
|
154 | </div> | |
155 |
<div id="notification" |
|
155 | <div id="notification_area"> | |
|
156 | </div> | |||
156 | </div> |
|
157 | </div> | |
157 |
|
158 | |||
158 |
|
159 | |||
159 | <div id="toolbar"> |
|
160 | <div id="toolbar"> | |
160 |
|
161 | |||
161 | <span> |
|
162 | <span> | |
162 | <button id="save_b">Save</button> |
|
163 | <button id="save_b">Save</button> | |
163 | </span> |
|
164 | </span> | |
164 | <span id="cut_copy_paste"> |
|
165 | <span id="cut_copy_paste"> | |
165 | <button id="cut_b" title="Cut Cell">Cut Cell</button> |
|
166 | <button id="cut_b" title="Cut Cell">Cut Cell</button> | |
166 | <button id="copy_b" title="Copy Cell">Copy Cell</button> |
|
167 | <button id="copy_b" title="Copy Cell">Copy Cell</button> | |
167 | <button id="paste_b" title="Paste Cell">Paste Cell</button> |
|
168 | <button id="paste_b" title="Paste Cell">Paste Cell</button> | |
168 | </span> |
|
169 | </span> | |
169 | <span id="move_up_down"> |
|
170 | <span id="move_up_down"> | |
170 | <button id="move_up_b" title="Move Cell Up">Move Cell Up</button> |
|
171 | <button id="move_up_b" title="Move Cell Up">Move Cell Up</button> | |
171 | <button id="move_down_b" title="Move Cell Down">Move Down</button> |
|
172 | <button id="move_down_b" title="Move Cell Down">Move Down</button> | |
172 | </span> |
|
173 | </span> | |
173 | <span id="insert_above_below"> |
|
174 | <span id="insert_above_below"> | |
174 | <button id="insert_above_b" title="Insert Cell Above">Insert Cell Above</button> |
|
175 | <button id="insert_above_b" title="Insert Cell Above">Insert Cell Above</button> | |
175 | <button id="insert_below_b" title="Insert Cell Below">Insert Cell Below</button> |
|
176 | <button id="insert_below_b" title="Insert Cell Below">Insert Cell Below</button> | |
176 | </span> |
|
177 | </span> | |
177 | <span id="run_int"> |
|
178 | <span id="run_int"> | |
178 | <button id="run_b" title="Run Cell">Run Cell</button> |
|
179 | <button id="run_b" title="Run Cell">Run Cell</button> | |
179 | <button id="interrupt_b" title="Interrupt">Interrupt</button> |
|
180 | <button id="interrupt_b" title="Interrupt">Interrupt</button> | |
180 | </span> |
|
181 | </span> | |
181 | <span> |
|
182 | <span> | |
182 | <select id="cell_type"> |
|
183 | <select id="cell_type"> | |
183 | <option value="code">Code</option> |
|
184 | <option value="code">Code</option> | |
184 | <option value="markdown">Markdown</option> |
|
185 | <option value="markdown">Markdown</option> | |
185 | <option value="raw">Raw Text</option> |
|
186 | <option value="raw">Raw Text</option> | |
186 | <option value="heading1">Heading 1</option> |
|
187 | <option value="heading1">Heading 1</option> | |
187 | <option value="heading2">Heading 2</option> |
|
188 | <option value="heading2">Heading 2</option> | |
188 | <option value="heading3">Heading 3</option> |
|
189 | <option value="heading3">Heading 3</option> | |
189 | <option value="heading4">Heading 4</option> |
|
190 | <option value="heading4">Heading 4</option> | |
190 | <option value="heading5">Heading 5</option> |
|
191 | <option value="heading5">Heading 5</option> | |
191 | <option value="heading6">Heading 6</option> |
|
192 | <option value="heading6">Heading 6</option> | |
192 | </select> |
|
193 | </select> | |
193 | </span> |
|
194 | </span> | |
194 |
|
195 | |||
195 | </div> |
|
196 | </div> | |
196 |
|
197 | |||
197 | <div id="main_app"> |
|
198 | <div id="main_app"> | |
198 |
|
199 | |||
199 | <div id="notebook_panel"> |
|
200 | <div id="notebook_panel"> | |
200 | <div id="notebook"></div> |
|
201 | <div id="notebook"></div> | |
201 | <div id="pager_splitter"></div> |
|
202 | <div id="pager_splitter"></div> | |
202 | <div id="pager"></div> |
|
203 | <div id="pager"></div> | |
203 | </div> |
|
204 | </div> | |
204 |
|
205 | |||
205 | </div> |
|
206 | </div> | |
206 | <div id='tooltip' class='tooltip ui-corner-all' style='display:none'></div> |
|
207 | <div id='tooltip' class='tooltip ui-corner-all' style='display:none'></div> | |
207 |
|
208 | |||
208 |
|
209 | |||
209 | {% end %} |
|
210 | {% end %} | |
210 |
|
211 | |||
211 |
|
212 | |||
212 | {% block script %} |
|
213 | {% block script %} | |
213 |
|
214 | |||
214 | <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script> |
|
215 | <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script> | |
215 | <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script> |
|
216 | <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script> | |
216 | <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script> |
|
217 | <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script> | |
217 | <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script> |
|
218 | <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script> | |
218 | <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script> |
|
219 | <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script> | |
219 | <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script> |
|
220 | <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script> | |
220 | <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script> |
|
221 | <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script> | |
221 | <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script> |
|
222 | <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script> | |
222 |
|
223 | |||
223 | <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script> |
|
224 | <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script> | |
224 |
|
225 | |||
225 | <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script> |
|
226 | <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script> | |
226 | <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script> |
|
227 | <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script> | |
227 |
|
228 | |||
228 | <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script> |
|
229 | <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script> | |
229 | <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
230 | <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script> | |
230 | <script src="{{ static_url("js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
231 | <script src="{{ static_url("js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script> | |
231 | <script src="{{ static_url("js/initmathjax.js") }}" type="text/javascript" charset="utf-8"></script> |
|
232 | <script src="{{ static_url("js/initmathjax.js") }}" type="text/javascript" charset="utf-8"></script> | |
232 | <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script> |
|
233 | <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script> | |
233 | <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
234 | <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script> | |
234 | <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
235 | <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script> | |
235 | <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script> |
|
236 | <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script> | |
236 | <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script> |
|
237 | <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script> | |
237 | <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script> |
|
238 | <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script> | |
238 | <script src="{{ static_url("js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
239 | <script src="{{ static_url("js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script> | |
239 | <script src="{{ static_url("js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script> |
|
240 | <script src="{{ static_url("js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script> | |
240 | <script src="{{ static_url("js/pager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
241 | <script src="{{ static_url("js/pager.js") }}" type="text/javascript" charset="utf-8"></script> | |
241 | <script src="{{ static_url("js/menubar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
242 | <script src="{{ static_url("js/menubar.js") }}" type="text/javascript" charset="utf-8"></script> | |
242 | <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
243 | <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> | |
243 | <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> |
|
244 | <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> | |
244 | <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
245 | <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> | |
|
246 | <script src="{{ static_url("js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script> | |||
245 | <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> |
|
247 | <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> | |
246 | <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script> |
|
248 | <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script> | |
247 |
|
249 | |||
248 | <script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script> |
|
250 | <script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script> | |
249 |
|
251 | |||
250 | {% end %} |
|
252 | {% end %} |
General Comments 0
You need to be logged in to leave comments.
Login now