##// END OF EJS Templates
main_app -> ipython-main-app
Bussonnier Matthias -
Show More
@@ -1,6 +1,6 b''
1
1
2 #main_app {
2 #ipython-main-app {
3 height: 100px;
3 height: 100px;
4 width: 350px;
4 width: 350px;
5 margin: 50px auto;
5 margin: 50px auto;
6 }
6 }
@@ -1,7 +1,7 b''
1
1
2 #main_app {
2 #ipython-main-app {
3 height: 100px;
3 height: 100px;
4 width: 200px;
4 width: 200px;
5 margin: 50px auto;
5 margin: 50px auto;
6 }
6 }
7
7
@@ -1,448 +1,448 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 @import "variables.less";
7 @import "variables.less";
8
8
9 body {
9 body {
10 overflow: hidden;
10 overflow: hidden;
11 background-color:@notebook_background;
11 background-color:@notebook_background;
12 }
12 }
13
13
14 blockquote {
14 blockquote {
15 border-left: 4px solid #DDD;
15 border-left: 4px solid #DDD;
16 padding: 0 15px;
16 padding: 0 15px;
17 color: #777;
17 color: #777;
18 }
18 }
19
19
20 span#save_widget {
20 span#save_widget {
21 padding: 5px;
21 padding: 5px;
22 margin: 0px 0px 0px 300px;
22 margin: 0px 0px 0px 300px;
23 display:inline-block;
23 display:inline-block;
24 }
24 }
25
25
26 span#notebook_name {
26 span#notebook_name {
27 height: 1em;
27 height: 1em;
28 line-height: 1em;
28 line-height: 1em;
29 padding: 3px;
29 padding: 3px;
30 border: none;
30 border: none;
31 font-size: 146.5%;
31 font-size: 146.5%;
32 }
32 }
33
33
34
34
35 .ui-menubar-item .ui-button .ui-button-text {
35 .ui-menubar-item .ui-button .ui-button-text {
36 padding: 0.4em 1.0em;
36 padding: 0.4em 1.0em;
37 font-size: 100%;
37 font-size: 100%;
38 }
38 }
39
39
40 .ui-menu {
40 .ui-menu {
41 -moz-box-shadow: 0px 6px 10px -1px #adadad;
41 -moz-box-shadow: 0px 6px 10px -1px #adadad;
42 -webkit-box-shadow: 0px 6px 10px -1px #adadad;
42 -webkit-box-shadow: 0px 6px 10px -1px #adadad;
43 box-shadow: 0px 6px 10px -1px #adadad;
43 box-shadow: 0px 6px 10px -1px #adadad;
44 }
44 }
45
45
46 .ui-menu .ui-menu-item a {
46 .ui-menu .ui-menu-item a {
47 border: 1px solid transparent;
47 border: 1px solid transparent;
48 padding: 2px 1.6em;
48 padding: 2px 1.6em;
49 }
49 }
50
50
51 .ui-menu .ui-menu-item a.ui-state-focus {
51 .ui-menu .ui-menu-item a.ui-state-focus {
52 margin: 0;
52 margin: 0;
53 }
53 }
54
54
55 .ui-menu hr {
55 .ui-menu hr {
56 margin: 0.3em 0;
56 margin: 0.3em 0;
57 }
57 }
58
58
59 #menubar_container {
59 #menubar_container {
60 position: relative;
60 position: relative;
61 }
61 }
62
62
63 #notification_area {
63 #notification_area {
64 position: absolute;
64 position: absolute;
65 right: 0px;
65 right: 0px;
66 top: 0px;
66 top: 0px;
67 height: 25px;
67 height: 25px;
68 padding: 3px 0px;
68 padding: 3px 0px;
69 padding-right: 3px;
69 padding-right: 3px;
70 z-index: 10;
70 z-index: 10;
71 }
71 }
72
72
73 .notification_widget{
73 .notification_widget{
74 float : right;
74 float : right;
75 right: 0px;
75 right: 0px;
76 top: 1px;
76 top: 1px;
77 height: 25px;
77 height: 25px;
78 padding: 3px 6px;
78 padding: 3px 6px;
79 z-index: 10;
79 z-index: 10;
80 }
80 }
81
81
82 .toolbar {
82 .toolbar {
83 padding: 3px 15px;
83 padding: 3px 15px;
84 border-bottom: @borderwidth @border_color solid;
84 border-bottom: @borderwidth @border_color solid;
85 }
85 }
86
86
87 #maintoolbar > select, #maintoolbar label {
87 #maintoolbar > select, #maintoolbar label {
88 font-size: 85%;
88 font-size: 85%;
89 margin-left:0.3em;
89 margin-left:0.3em;
90 margin-right:0.3em;
90 margin-right:0.3em;
91
91
92 }
92 }
93
93
94
94
95 div#main_app {
95 #ipython-main-app {
96 width: 100%;
96 width: 100%;
97 position: relative;
97 position: relative;
98 }
98 }
99
99
100 span#quick_help_area {
100 span#quick_help_area {
101 position: static;
101 position: static;
102 padding: 5px 0px;
102 padding: 5px 0px;
103 margin: 0px 0px 0px 0px;
103 margin: 0px 0px 0px 0px;
104 }
104 }
105
105
106 .help_string {
106 .help_string {
107 float: right;
107 float: right;
108 width: 170px;
108 width: 170px;
109 padding: 0px 5px;
109 padding: 0px 5px;
110 text-align: left;
110 text-align: left;
111 font-size: 85%;
111 font-size: 85%;
112 }
112 }
113
113
114 .help_string_label {
114 .help_string_label {
115 float: right;
115 float: right;
116 font-size: 85%;
116 font-size: 85%;
117 }
117 }
118
118
119 div#notebook_panel {
119 div#notebook_panel {
120 margin: 0px 0px 0px 0px;
120 margin: 0px 0px 0px 0px;
121 padding: 0px;
121 padding: 0px;
122 }
122 }
123
123
124 div#notebook {
124 div#notebook {
125 overflow-y: scroll;
125 overflow-y: scroll;
126 overflow-x: auto;
126 overflow-x: auto;
127 width: 100%;
127 width: 100%;
128 /* This spaces the cell away from the edge of the notebook area */
128 /* This spaces the cell away from the edge of the notebook area */
129 padding: 5px 5px 15px 5px;
129 padding: 5px 5px 15px 5px;
130 margin: 0px;
130 margin: 0px;
131 }
131 }
132
132
133 div#pager_splitter {
133 div#pager_splitter {
134 height: 8px;
134 height: 8px;
135 }
135 }
136
136
137 #pager_container {
137 #pager_container {
138 position : relative;
138 position : relative;
139 }
139 }
140
140
141 div#pager {
141 div#pager {
142 padding: 15px;
142 padding: 15px;
143 overflow: auto;
143 overflow: auto;
144 display: none;
144 display: none;
145 }
145 }
146
146
147 div.ui-widget-content {
147 div.ui-widget-content {
148 border: 1px solid @border_color;
148 border: 1px solid @border_color;
149 outline: none;
149 outline: none;
150 }
150 }
151
151
152 .cell {
152 .cell {
153 border: 1px solid transparent;
153 border: 1px solid transparent;
154
154
155 &.selected {
155 &.selected {
156 .corner-all;
156 .corner-all;
157 background-color:@cell_selected_background;
157 background-color:@cell_selected_background;
158 border : thin @border_color solid;
158 border : thin @border_color solid;
159 }
159 }
160 }
160 }
161
161
162 div.cell {
162 div.cell {
163 width: 100%;
163 width: 100%;
164 padding: 5px 5px 5px 0px;
164 padding: 5px 5px 5px 0px;
165 /* This acts as a spacer between cells, that is outside the border */
165 /* This acts as a spacer between cells, that is outside the border */
166 margin: 2px 0px 2px 0px;
166 margin: 2px 0px 2px 0px;
167 outline: none;
167 outline: none;
168 }
168 }
169
169
170 div.code_cell {
170 div.code_cell {
171 }
171 }
172
172
173 /* any special styling for code cells that are currently running goes here */
173 /* any special styling for code cells that are currently running goes here */
174 div.code_cell.running {
174 div.code_cell.running {
175 }
175 }
176
176
177 div.prompt {
177 div.prompt {
178 /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
178 /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
179 width: 11ex;
179 width: 11ex;
180 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
180 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
181 padding: 0.4em;
181 padding: 0.4em;
182 margin: 0px;
182 margin: 0px;
183 font-family: monospace;
183 font-family: monospace;
184 text-align: right;
184 text-align: right;
185 /* This has to match that of the the CodeMirror class line-height below */
185 /* This has to match that of the the CodeMirror class line-height below */
186 line-height: 1.231;
186 line-height: 1.231;
187 }
187 }
188
188
189 div.input {
189 div.input {
190 page-break-inside: avoid;
190 page-break-inside: avoid;
191 }
191 }
192
192
193 /* input_area and input_prompt must match in top border and margin for alignment */
193 /* input_area and input_prompt must match in top border and margin for alignment */
194 div.input_area {
194 div.input_area {
195 color: black;
195 color: black;
196 border: 1px solid @border_color;
196 border: 1px solid @border_color;
197 .corner-all;
197 .corner-all;
198 background: @cell_background;
198 background: @cell_background;
199 }
199 }
200
200
201 div.input_prompt {
201 div.input_prompt {
202 color: navy;
202 color: navy;
203 border-top: 1px solid transparent;
203 border-top: 1px solid transparent;
204 }
204 }
205
205
206 div.output_wrapper {
206 div.output_wrapper {
207 /* This is a spacer between the input and output of each cell */
207 /* This is a spacer between the input and output of each cell */
208 margin-top: 5px;
208 margin-top: 5px;
209 margin-left: 5px;
209 margin-left: 5px;
210 /* FF needs explicit width to stretch */
210 /* FF needs explicit width to stretch */
211 width: 100%;
211 width: 100%;
212 /* this position must be relative to enable descendents to be absolute within it */
212 /* this position must be relative to enable descendents to be absolute within it */
213 position: relative;
213 position: relative;
214 }
214 }
215
215
216 /* class for the output area when it should be height-limited */
216 /* class for the output area when it should be height-limited */
217 div.output_scroll {
217 div.output_scroll {
218 /* ideally, this would be max-height, but FF barfs all over that */
218 /* ideally, this would be max-height, but FF barfs all over that */
219 height: 24em;
219 height: 24em;
220 /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */
220 /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */
221 width: 100%;
221 width: 100%;
222
222
223 overflow: auto;
223 overflow: auto;
224 .corner-all;
224 .corner-all;
225 box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8);
225 box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8);
226 }
226 }
227
227
228 /* output div while it is collapsed */
228 /* output div while it is collapsed */
229 div.output_collapsed {
229 div.output_collapsed {
230 margin-right: 5px;
230 margin-right: 5px;
231 }
231 }
232
232
233 div.out_prompt_overlay {
233 div.out_prompt_overlay {
234 height: 100%;
234 height: 100%;
235 padding: 0px;
235 padding: 0px;
236 position: absolute;
236 position: absolute;
237 .corner-all;
237 .corner-all;
238 }
238 }
239
239
240 div.out_prompt_overlay:hover {
240 div.out_prompt_overlay:hover {
241 /* use inner shadow to get border that is computed the same on WebKit/FF */
241 /* use inner shadow to get border that is computed the same on WebKit/FF */
242 box-shadow: inset 0 0 1px #000;
242 box-shadow: inset 0 0 1px #000;
243 background: rgba(240, 240, 240, 0.5);
243 background: rgba(240, 240, 240, 0.5);
244 }
244 }
245
245
246 div.output_prompt {
246 div.output_prompt {
247 color: darkred;
247 color: darkred;
248 /* 5px right shift to account for margin in parent container */
248 /* 5px right shift to account for margin in parent container */
249 margin: 0 5px 0 -5px;
249 margin: 0 5px 0 -5px;
250 }
250 }
251
251
252 /* This class is the outer container of all output sections. */
252 /* This class is the outer container of all output sections. */
253 div.output_area {
253 div.output_area {
254 padding: 0px;
254 padding: 0px;
255 page-break-inside: avoid;
255 page-break-inside: avoid;
256 }
256 }
257
257
258
258
259 /* This is needed to protect the pre formating from global settings such
259 /* This is needed to protect the pre formating from global settings such
260 as that of bootstrap */
260 as that of bootstrap */
261 div.output_area pre {
261 div.output_area pre {
262 font-family: monospace;
262 font-family: monospace;
263 margin: 0;
263 margin: 0;
264 padding: 0;
264 padding: 0;
265 border: 0;
265 border: 0;
266 font-size: 100%;
266 font-size: 100%;
267 font: inherit;
267 font: inherit;
268 vertical-align: baseline;
268 vertical-align: baseline;
269 color: black;
269 color: black;
270 background-color: white;
270 background-color: white;
271 }
271 }
272
272
273 /* This class is for the output subarea inside the output_area and after
273 /* This class is for the output subarea inside the output_area and after
274 the prompt div. */
274 the prompt div. */
275 div.output_subarea {
275 div.output_subarea {
276 padding: 0.44em 0.4em 0.4em 1px;
276 padding: 0.44em 0.4em 0.4em 1px;
277 }
277 }
278
278
279 /* The rest of the output_* classes are for special styling of the different
279 /* The rest of the output_* classes are for special styling of the different
280 output types */
280 output types */
281
281
282 /* all text output has this class: */
282 /* all text output has this class: */
283 div.output_text {
283 div.output_text {
284 text-align: left;
284 text-align: left;
285 color: black;
285 color: black;
286 font-family: monospace;
286 font-family: monospace;
287 /* This has to match that of the the CodeMirror class line-height below */
287 /* This has to match that of the the CodeMirror class line-height below */
288 line-height: 1.231;
288 line-height: 1.231;
289 }
289 }
290
290
291 /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
291 /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
292 div.output_stream {
292 div.output_stream {
293 padding-top: 0.0em;
293 padding-top: 0.0em;
294 padding-bottom: 0.0em;
294 padding-bottom: 0.0em;
295 }
295 }
296 div.output_stdout {
296 div.output_stdout {
297 }
297 }
298 div.output_stderr {
298 div.output_stderr {
299 background: #fdd; /* very light red background for stderr */
299 background: #fdd; /* very light red background for stderr */
300 }
300 }
301
301
302 div.output_latex {
302 div.output_latex {
303 text-align: left;
303 text-align: left;
304 color: black;
304 color: black;
305 }
305 }
306
306
307 div.output_html {
307 div.output_html {
308 }
308 }
309
309
310 div.output_png {
310 div.output_png {
311 }
311 }
312
312
313 div.output_jpeg {
313 div.output_jpeg {
314 }
314 }
315
315
316 div.text_cell {
316 div.text_cell {
317 padding: 5px 5px 5px 5px;
317 padding: 5px 5px 5px 5px;
318 }
318 }
319
319
320 div.text_cell_input {
320 div.text_cell_input {
321 color: black;
321 color: black;
322 border: 1px solid @border_color;
322 border: 1px solid @border_color;
323 .corner-all;
323 .corner-all;
324 background: @cell_background;
324 background: @cell_background;
325 }
325 }
326
326
327 div.text_cell_render {
327 div.text_cell_render {
328 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
328 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
329 outline: none;
329 outline: none;
330 resize: none;
330 resize: none;
331 width: inherit;
331 width: inherit;
332 border-style: none;
332 border-style: none;
333 padding: 5px;
333 padding: 5px;
334 color: black;
334 color: black;
335 }
335 }
336
336
337 /* The following gets added to the <head> if it is detected that the user has a
337 /* The following gets added to the <head> if it is detected that the user has a
338 * monospace font with inconsistent normal/bold/italic height. See
338 * monospace font with inconsistent normal/bold/italic height. See
339 * notebookmain.js. Such fonts will have keywords vertically offset with
339 * notebookmain.js. Such fonts will have keywords vertically offset with
340 * respect to the rest of the text. The user should select a better font.
340 * respect to the rest of the text. The user should select a better font.
341 * See: https://github.com/ipython/ipython/issues/1503
341 * See: https://github.com/ipython/ipython/issues/1503
342 *
342 *
343 * .CodeMirror span {
343 * .CodeMirror span {
344 * vertical-align: bottom;
344 * vertical-align: bottom;
345 * }
345 * }
346 */
346 */
347
347
348 .CodeMirror {
348 .CodeMirror {
349 line-height: 1.231; /* Changed from 1em to our global default */
349 line-height: 1.231; /* Changed from 1em to our global default */
350 }
350 }
351
351
352 .CodeMirror-scroll {
352 .CodeMirror-scroll {
353 height: auto; /* Changed to auto to autogrow */
353 height: auto; /* Changed to auto to autogrow */
354 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
354 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
355 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
355 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
356 overflow-y: hidden;
356 overflow-y: hidden;
357 overflow-x: auto; /* Changed from auto to remove scrollbar */
357 overflow-x: auto; /* Changed from auto to remove scrollbar */
358 }
358 }
359
359
360 /* CSS font colors for translated ANSI colors. */
360 /* CSS font colors for translated ANSI colors. */
361
361
362
362
363 .ansiblack {color: black;}
363 .ansiblack {color: black;}
364 .ansired {color: darkred;}
364 .ansired {color: darkred;}
365 .ansigreen {color: darkgreen;}
365 .ansigreen {color: darkgreen;}
366 .ansiyellow {color: brown;}
366 .ansiyellow {color: brown;}
367 .ansiblue {color: darkblue;}
367 .ansiblue {color: darkblue;}
368 .ansipurple {color: darkviolet;}
368 .ansipurple {color: darkviolet;}
369 .ansicyan {color: steelblue;}
369 .ansicyan {color: steelblue;}
370 .ansigrey {color: grey;}
370 .ansigrey {color: grey;}
371 .ansibold {font-weight: bold;}
371 .ansibold {font-weight: bold;}
372
372
373 .completions {
373 .completions {
374 position: absolute;
374 position: absolute;
375 z-index: 10;
375 z-index: 10;
376 overflow: hidden;
376 overflow: hidden;
377 border: 1px solid @border_color;
377 border: 1px solid @border_color;
378 }
378 }
379
379
380 .completions select {
380 .completions select {
381 background: white;
381 background: white;
382 outline: none;
382 outline: none;
383 border: none;
383 border: none;
384 padding: 0px;
384 padding: 0px;
385 margin: 0px;
385 margin: 0px;
386 overflow: auto;
386 overflow: auto;
387 font-family: monospace;
387 font-family: monospace;
388 }
388 }
389
389
390 option.context {
390 option.context {
391 background-color: #DEF7FF;
391 background-color: #DEF7FF;
392 }
392 }
393 option.introspection {
393 option.introspection {
394 background-color: #EBF4EB;
394 background-color: #EBF4EB;
395 }
395 }
396
396
397 /*fixed part of the completion*/
397 /*fixed part of the completion*/
398 .completions p b {
398 .completions p b {
399 font-weight:bold;
399 font-weight:bold;
400 }
400 }
401
401
402 .completions p {
402 .completions p {
403 background: #DDF;
403 background: #DDF;
404 /*outline: none;
404 /*outline: none;
405 padding: 0px;*/
405 padding: 0px;*/
406 border-bottom: black solid 1px;
406 border-bottom: black solid 1px;
407 padding: 1px;
407 padding: 1px;
408 font-family: monospace;
408 font-family: monospace;
409 }
409 }
410
410
411 pre.dialog {
411 pre.dialog {
412 background-color: @cell_background;
412 background-color: @cell_background;
413 border: 1px solid #ddd;
413 border: 1px solid #ddd;
414 .corner-all;
414 .corner-all;
415 padding: 0.4em;
415 padding: 0.4em;
416 padding-left: 2em;
416 padding-left: 2em;
417 }
417 }
418
418
419 p.dialog {
419 p.dialog {
420 padding : 0.2em;
420 padding : 0.2em;
421 }
421 }
422
422
423 .shortcut_key {
423 .shortcut_key {
424 display: inline-block;
424 display: inline-block;
425 width: 15ex;
425 width: 15ex;
426 text-align: right;
426 text-align: right;
427 font-family: monospace;
427 font-family: monospace;
428 }
428 }
429
429
430 .shortcut_descr {
430 .shortcut_descr {
431 }
431 }
432
432
433 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
433 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
434 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
434 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
435 */
435 */
436 pre, code, kbd, samp { white-space: pre-wrap; }
436 pre, code, kbd, samp { white-space: pre-wrap; }
437
437
438 #fonttest {
438 #fonttest {
439 font-family: monospace;
439 font-family: monospace;
440 }
440 }
441
441
442 .js-error {
442 .js-error {
443 color: darkred;
443 color: darkred;
444 }
444 }
445
445
446
446
447
447
448
448
@@ -1,84 +1,84 b''
1
1
2 /**
2 /**
3 * Primary styles
3 * Primary styles
4 *
4 *
5 * Author: IPython Development Team
5 * Author: IPython Development Team
6 */
6 */
7
7
8 #main_app {
8 #ipython-main-app {
9 width: 920px;
9 width: 920px;
10 margin: 30px auto 0px auto;
10 margin: 30px auto 0px auto;
11 }
11 }
12
12
13 #tabs {
13 #tabs {
14 border-style: none;
14 border-style: none;
15 }
15 }
16
16
17 #tab1, #tab2 {
17 #tab1, #tab2 {
18 padding: 1em 0em;
18 padding: 1em 0em;
19 }
19 }
20
20
21 .list_toolbar {
21 .list_toolbar {
22 padding: 5px;
22 padding: 5px;
23 height: 25px;
23 height: 25px;
24 line-height: 25px;
24 line-height: 25px;
25 }
25 }
26
26
27 .toolbar_info {
27 .toolbar_info {
28 float: left;
28 float: left;
29 }
29 }
30
30
31 .toolbar_buttons {
31 .toolbar_buttons {
32 float: right;
32 float: right;
33 }
33 }
34
34
35 .list_header {
35 .list_header {
36 height: 25px;
36 height: 25px;
37 line-height: 25px;
37 line-height: 25px;
38 padding: 3px 5px;
38 padding: 3px 5px;
39 }
39 }
40
40
41
41
42
42
43 .list_item {
43 .list_item {
44 height: 25px;
44 height: 25px;
45 line-height: 25px;
45 line-height: 25px;
46 padding: 3px 5px;
46 padding: 3px 5px;
47 }
47 }
48
48
49 .notebook_item a {
49 .notebook_item a {
50 text-decoration: none;
50 text-decoration: none;
51 }
51 }
52
52
53 .profile_col {
53 .profile_col {
54 }
54 }
55
55
56 .status_col {
56 .status_col {
57 float: right;
57 float: right;
58 width: 325px;
58 width: 325px;
59 }
59 }
60
60
61 .engines_col {
61 .engines_col {
62 float: right;
62 float: right;
63 width: 325px;
63 width: 325px;
64 }
64 }
65
65
66 .action_col {
66 .action_col {
67 float: right;
67 float: right;
68 }
68 }
69
69
70 .item_buttons {
70 .item_buttons {
71 float: right;
71 float: right;
72 }
72 }
73
73
74 .item_buttons .upload_button {
74 .item_buttons .upload_button {
75 color: darkred;
75 color: darkred;
76 }
76 }
77
77
78 .highlight_text {
78 .highlight_text {
79 color: blue;
79 color: blue;
80 }
80 }
81
81
82 .ui-tabs .ui-tabs-nav li a {
82 .ui-tabs .ui-tabs-nav li a {
83 padding: .3em .5em;
83 padding: .3em .5em;
84 }
84 }
@@ -1,62 +1,62 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 // Layout
9 // Layout
10 //============================================================================
10 //============================================================================
11
11
12 var IPython = (function (IPython) {
12 var IPython = (function (IPython) {
13
13
14 var LayoutManager = function () {
14 var LayoutManager = function () {
15 this.bind_events();
15 this.bind_events();
16 };
16 };
17
17
18
18
19 LayoutManager.prototype.bind_events = function () {
19 LayoutManager.prototype.bind_events = function () {
20 $(window).resize($.proxy(this.do_resize,this));
20 $(window).resize($.proxy(this.do_resize,this));
21 };
21 };
22
22
23 LayoutManager.prototype.app_height = function() {
23 LayoutManager.prototype.app_height = function() {
24 var win = $(window);
24 var win = $(window);
25 var w = win.width();
25 var w = win.width();
26 var h = win.height();
26 var h = win.height();
27 var header_height;
27 var header_height;
28 if ($('div#header').css('display') === 'none') {
28 if ($('div#header').css('display') === 'none') {
29 header_height = 0;
29 header_height = 0;
30 } else {
30 } else {
31 header_height = $('div#header').outerHeight(true);
31 header_height = $('div#header').outerHeight(true);
32 }
32 }
33 var menubar_height = $('div#menubar').outerHeight(true);
33 var menubar_height = $('div#menubar').outerHeight(true);
34 var toolbar_height;
34 var toolbar_height;
35 if ($('div#maintoolbar').css('display') === 'none') {
35 if ($('div#maintoolbar').css('display') === 'none') {
36 toolbar_height = 0;
36 toolbar_height = 0;
37 } else {
37 } else {
38 toolbar_height = $('div#maintoolbar').outerHeight(true);
38 toolbar_height = $('div#maintoolbar').outerHeight(true);
39 }
39 }
40 return h-header_height-menubar_height-toolbar_height; // content height
40 return h-header_height-menubar_height-toolbar_height; // content height
41 }
41 }
42
42
43 LayoutManager.prototype.do_resize = function () {
43 LayoutManager.prototype.do_resize = function () {
44 var app_height = this.app_height() // content height
44 var app_height = this.app_height() // content height
45
45
46 $('div#main_app').height(app_height); // content+padding+border height
46 $('#ipython-main-app').height(app_height); // content+padding+border height
47
47
48 var pager_height = IPython.pager.percentage_height*app_height;
48 var pager_height = IPython.pager.percentage_height*app_height;
49 var pager_splitter_height = $('div#pager_splitter').outerHeight(true);
49 var pager_splitter_height = $('div#pager_splitter').outerHeight(true);
50 $('div#pager').height(pager_height);
50 $('div#pager').height(pager_height);
51 if (IPython.pager.expanded) {
51 if (IPython.pager.expanded) {
52 $('div#notebook').height(app_height-pager_height-pager_splitter_height);
52 $('div#notebook').height(app_height-pager_height-pager_splitter_height);
53 } else {
53 } else {
54 $('div#notebook').height(app_height-pager_splitter_height);
54 $('div#notebook').height(app_height-pager_splitter_height);
55 }
55 }
56 };
56 };
57
57
58 IPython.LayoutManager = LayoutManager;
58 IPython.LayoutManager = LayoutManager;
59
59
60 return IPython;
60 return IPython;
61
61
62 }(IPython));
62 }(IPython));
@@ -1,22 +1,22 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.page = new IPython.Page();
15 IPython.page = new IPython.Page();
16 $('input#login_submit').button();
16 $('input#login_submit').button();
17 $('div#main_app').addClass('border-box-sizing ui-widget');
17 $('#ipython-main-app').addClass('border-box-sizing ui-widget');
18 IPython.page.show();
18 IPython.page.show();
19 $('input#password_input').focus();
19 $('input#password_input').focus();
20
20
21 });
21 });
22
22
@@ -1,20 +1,20 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.page = new IPython.Page();
15 IPython.page = new IPython.Page();
16 $('div#main_app').addClass('border-box-sizing ui-widget');
16 $('#ipython-main-app').addClass('border-box-sizing ui-widget');
17 IPython.page.show();
17 IPython.page.show();
18
18
19 });
19 });
20
20
@@ -1,1371 +1,1371 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 // Notebook
9 // Notebook
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 var key = IPython.utils.keycodes;
15 var key = IPython.utils.keycodes;
16
16
17 var Notebook = function (selector) {
17 var Notebook = function (selector) {
18 this.read_only = IPython.read_only;
18 this.read_only = IPython.read_only;
19 this.element = $(selector);
19 this.element = $(selector);
20 this.element.scroll();
20 this.element.scroll();
21 this.element.data("notebook", this);
21 this.element.data("notebook", this);
22 this.next_prompt_number = 1;
22 this.next_prompt_number = 1;
23 this.kernel = null;
23 this.kernel = null;
24 this.clipboard = null;
24 this.clipboard = null;
25 this.undelete_backup = null;
25 this.undelete_backup = null;
26 this.undelete_index = null;
26 this.undelete_index = null;
27 this.undelete_below = false;
27 this.undelete_below = false;
28 this.paste_enabled = false;
28 this.paste_enabled = false;
29 this.dirty = false;
29 this.dirty = false;
30 this.metadata = {};
30 this.metadata = {};
31 // single worksheet for now
31 // single worksheet for now
32 this.worksheet_metadata = {};
32 this.worksheet_metadata = {};
33 this.control_key_active = false;
33 this.control_key_active = false;
34 this.notebook_id = null;
34 this.notebook_id = null;
35 this.notebook_name = null;
35 this.notebook_name = null;
36 this.notebook_name_blacklist_re = /[\/\\:]/;
36 this.notebook_name_blacklist_re = /[\/\\:]/;
37 this.nbformat = 3 // Increment this when changing the nbformat
37 this.nbformat = 3 // Increment this when changing the nbformat
38 this.nbformat_minor = 0 // Increment this when changing the nbformat
38 this.nbformat_minor = 0 // Increment this when changing the nbformat
39 this.style();
39 this.style();
40 this.create_elements();
40 this.create_elements();
41 this.bind_events();
41 this.bind_events();
42 };
42 };
43
43
44
44
45 Notebook.prototype.style = function () {
45 Notebook.prototype.style = function () {
46 $('div#notebook').addClass('border-box-sizing');
46 $('div#notebook').addClass('border-box-sizing');
47 };
47 };
48
48
49
49
50 Notebook.prototype.create_elements = function () {
50 Notebook.prototype.create_elements = function () {
51 // We add this end_space div to the end of the notebook div to:
51 // We add this end_space div to the end of the notebook div to:
52 // i) provide a margin between the last cell and the end of the notebook
52 // i) provide a margin between the last cell and the end of the notebook
53 // ii) to prevent the div from scrolling up when the last cell is being
53 // ii) to prevent the div from scrolling up when the last cell is being
54 // edited, but is too low on the page, which browsers will do automatically.
54 // edited, but is too low on the page, which browsers will do automatically.
55 var that = this;
55 var that = this;
56 var end_space = $('<div/>').addClass('end_space').height("30%");
56 var end_space = $('<div/>').addClass('end_space').height("30%");
57 end_space.dblclick(function (e) {
57 end_space.dblclick(function (e) {
58 if (that.read_only) return;
58 if (that.read_only) return;
59 var ncells = that.ncells();
59 var ncells = that.ncells();
60 that.insert_cell_below('code',ncells-1);
60 that.insert_cell_below('code',ncells-1);
61 });
61 });
62 this.element.append(end_space);
62 this.element.append(end_space);
63 $('div#notebook').addClass('border-box-sizing');
63 $('div#notebook').addClass('border-box-sizing');
64 };
64 };
65
65
66
66
67 Notebook.prototype.bind_events = function () {
67 Notebook.prototype.bind_events = function () {
68 var that = this;
68 var that = this;
69
69
70 $([IPython.events]).on('set_next_input.Notebook', function (event, data) {
70 $([IPython.events]).on('set_next_input.Notebook', function (event, data) {
71 var index = that.find_cell_index(data.cell);
71 var index = that.find_cell_index(data.cell);
72 var new_cell = that.insert_cell_below('code',index);
72 var new_cell = that.insert_cell_below('code',index);
73 new_cell.set_text(data.text);
73 new_cell.set_text(data.text);
74 that.dirty = true;
74 that.dirty = true;
75 });
75 });
76
76
77 $([IPython.events]).on('set_dirty.Notebook', function (event, data) {
77 $([IPython.events]).on('set_dirty.Notebook', function (event, data) {
78 that.dirty = data.value;
78 that.dirty = data.value;
79 });
79 });
80
80
81 $([IPython.events]).on('select.Cell', function (event, data) {
81 $([IPython.events]).on('select.Cell', function (event, data) {
82 var index = that.find_cell_index(data.cell);
82 var index = that.find_cell_index(data.cell);
83 that.select(index);
83 that.select(index);
84 });
84 });
85
85
86
86
87 $(document).keydown(function (event) {
87 $(document).keydown(function (event) {
88 // console.log(event);
88 // console.log(event);
89 if (that.read_only) return true;
89 if (that.read_only) return true;
90
90
91 // Save (CTRL+S) or (AppleKey+S)
91 // Save (CTRL+S) or (AppleKey+S)
92 //metaKey = applekey on mac
92 //metaKey = applekey on mac
93 if ((event.ctrlKey || event.metaKey) && event.keyCode==83) {
93 if ((event.ctrlKey || event.metaKey) && event.keyCode==83) {
94 that.save_notebook();
94 that.save_notebook();
95 event.preventDefault();
95 event.preventDefault();
96 return false;
96 return false;
97 } else if (event.which === key.ESC) {
97 } else if (event.which === key.ESC) {
98 // Intercept escape at highest level to avoid closing
98 // Intercept escape at highest level to avoid closing
99 // websocket connection with firefox
99 // websocket connection with firefox
100 event.preventDefault();
100 event.preventDefault();
101 } else if (event.which === key.SHIFT) {
101 } else if (event.which === key.SHIFT) {
102 // ignore shift keydown
102 // ignore shift keydown
103 return true;
103 return true;
104 }
104 }
105 if (event.which === key.UPARROW && !event.shiftKey) {
105 if (event.which === key.UPARROW && !event.shiftKey) {
106 var cell = that.get_selected_cell();
106 var cell = that.get_selected_cell();
107 if (cell.at_top()) {
107 if (cell.at_top()) {
108 event.preventDefault();
108 event.preventDefault();
109 that.select_prev();
109 that.select_prev();
110 };
110 };
111 } else if (event.which === key.DOWNARROW && !event.shiftKey) {
111 } else if (event.which === key.DOWNARROW && !event.shiftKey) {
112 var cell = that.get_selected_cell();
112 var cell = that.get_selected_cell();
113 if (cell.at_bottom()) {
113 if (cell.at_bottom()) {
114 event.preventDefault();
114 event.preventDefault();
115 that.select_next();
115 that.select_next();
116 };
116 };
117 } else if (event.which === key.ENTER && event.shiftKey) {
117 } else if (event.which === key.ENTER && event.shiftKey) {
118 that.execute_selected_cell();
118 that.execute_selected_cell();
119 return false;
119 return false;
120 } else if (event.which === key.ENTER && event.altKey) {
120 } else if (event.which === key.ENTER && event.altKey) {
121 // Execute code cell, and insert new in place
121 // Execute code cell, and insert new in place
122 that.execute_selected_cell();
122 that.execute_selected_cell();
123 // Only insert a new cell, if we ended up in an already populated cell
123 // Only insert a new cell, if we ended up in an already populated cell
124 if (/\S/.test(that.get_selected_cell().get_text()) == true) {
124 if (/\S/.test(that.get_selected_cell().get_text()) == true) {
125 that.insert_cell_above('code');
125 that.insert_cell_above('code');
126 }
126 }
127 return false;
127 return false;
128 } else if (event.which === key.ENTER && event.ctrlKey) {
128 } else if (event.which === key.ENTER && event.ctrlKey) {
129 that.execute_selected_cell({terminal:true});
129 that.execute_selected_cell({terminal:true});
130 return false;
130 return false;
131 } else if (event.which === 77 && event.ctrlKey && that.control_key_active == false) {
131 } else if (event.which === 77 && event.ctrlKey && that.control_key_active == false) {
132 that.control_key_active = true;
132 that.control_key_active = true;
133 return false;
133 return false;
134 } else if (event.which === 88 && that.control_key_active) {
134 } else if (event.which === 88 && that.control_key_active) {
135 // Cut selected cell = x
135 // Cut selected cell = x
136 that.cut_cell();
136 that.cut_cell();
137 that.control_key_active = false;
137 that.control_key_active = false;
138 return false;
138 return false;
139 } else if (event.which === 67 && that.control_key_active) {
139 } else if (event.which === 67 && that.control_key_active) {
140 // Copy selected cell = c
140 // Copy selected cell = c
141 that.copy_cell();
141 that.copy_cell();
142 that.control_key_active = false;
142 that.control_key_active = false;
143 return false;
143 return false;
144 } else if (event.which === 86 && that.control_key_active) {
144 } else if (event.which === 86 && that.control_key_active) {
145 // Paste below selected cell = v
145 // Paste below selected cell = v
146 that.paste_cell_below();
146 that.paste_cell_below();
147 that.control_key_active = false;
147 that.control_key_active = false;
148 return false;
148 return false;
149 } else if (event.which === 68 && that.control_key_active) {
149 } else if (event.which === 68 && that.control_key_active) {
150 // Delete selected cell = d
150 // Delete selected cell = d
151 that.delete_cell();
151 that.delete_cell();
152 that.control_key_active = false;
152 that.control_key_active = false;
153 return false;
153 return false;
154 } else if (event.which === 65 && that.control_key_active) {
154 } else if (event.which === 65 && that.control_key_active) {
155 // Insert code cell above selected = a
155 // Insert code cell above selected = a
156 that.insert_cell_above('code');
156 that.insert_cell_above('code');
157 that.control_key_active = false;
157 that.control_key_active = false;
158 return false;
158 return false;
159 } else if (event.which === 66 && that.control_key_active) {
159 } else if (event.which === 66 && that.control_key_active) {
160 // Insert code cell below selected = b
160 // Insert code cell below selected = b
161 that.insert_cell_below('code');
161 that.insert_cell_below('code');
162 that.control_key_active = false;
162 that.control_key_active = false;
163 return false;
163 return false;
164 } else if (event.which === 89 && that.control_key_active) {
164 } else if (event.which === 89 && that.control_key_active) {
165 // To code = y
165 // To code = y
166 that.to_code();
166 that.to_code();
167 that.control_key_active = false;
167 that.control_key_active = false;
168 return false;
168 return false;
169 } else if (event.which === 77 && that.control_key_active) {
169 } else if (event.which === 77 && that.control_key_active) {
170 // To markdown = m
170 // To markdown = m
171 that.to_markdown();
171 that.to_markdown();
172 that.control_key_active = false;
172 that.control_key_active = false;
173 return false;
173 return false;
174 } else if (event.which === 84 && that.control_key_active) {
174 } else if (event.which === 84 && that.control_key_active) {
175 // To Raw = t
175 // To Raw = t
176 that.to_raw();
176 that.to_raw();
177 that.control_key_active = false;
177 that.control_key_active = false;
178 return false;
178 return false;
179 } else if (event.which === 49 && that.control_key_active) {
179 } else if (event.which === 49 && that.control_key_active) {
180 // To Heading 1 = 1
180 // To Heading 1 = 1
181 that.to_heading(undefined, 1);
181 that.to_heading(undefined, 1);
182 that.control_key_active = false;
182 that.control_key_active = false;
183 return false;
183 return false;
184 } else if (event.which === 50 && that.control_key_active) {
184 } else if (event.which === 50 && that.control_key_active) {
185 // To Heading 2 = 2
185 // To Heading 2 = 2
186 that.to_heading(undefined, 2);
186 that.to_heading(undefined, 2);
187 that.control_key_active = false;
187 that.control_key_active = false;
188 return false;
188 return false;
189 } else if (event.which === 51 && that.control_key_active) {
189 } else if (event.which === 51 && that.control_key_active) {
190 // To Heading 3 = 3
190 // To Heading 3 = 3
191 that.to_heading(undefined, 3);
191 that.to_heading(undefined, 3);
192 that.control_key_active = false;
192 that.control_key_active = false;
193 return false;
193 return false;
194 } else if (event.which === 52 && that.control_key_active) {
194 } else if (event.which === 52 && that.control_key_active) {
195 // To Heading 4 = 4
195 // To Heading 4 = 4
196 that.to_heading(undefined, 4);
196 that.to_heading(undefined, 4);
197 that.control_key_active = false;
197 that.control_key_active = false;
198 return false;
198 return false;
199 } else if (event.which === 53 && that.control_key_active) {
199 } else if (event.which === 53 && that.control_key_active) {
200 // To Heading 5 = 5
200 // To Heading 5 = 5
201 that.to_heading(undefined, 5);
201 that.to_heading(undefined, 5);
202 that.control_key_active = false;
202 that.control_key_active = false;
203 return false;
203 return false;
204 } else if (event.which === 54 && that.control_key_active) {
204 } else if (event.which === 54 && that.control_key_active) {
205 // To Heading 6 = 6
205 // To Heading 6 = 6
206 that.to_heading(undefined, 6);
206 that.to_heading(undefined, 6);
207 that.control_key_active = false;
207 that.control_key_active = false;
208 return false;
208 return false;
209 } else if (event.which === 79 && that.control_key_active) {
209 } else if (event.which === 79 && that.control_key_active) {
210 // Toggle output = o
210 // Toggle output = o
211 if (event.shiftKey){
211 if (event.shiftKey){
212 that.toggle_output_scroll();
212 that.toggle_output_scroll();
213 } else {
213 } else {
214 that.toggle_output();
214 that.toggle_output();
215 }
215 }
216 that.control_key_active = false;
216 that.control_key_active = false;
217 return false;
217 return false;
218 } else if (event.which === 83 && that.control_key_active) {
218 } else if (event.which === 83 && that.control_key_active) {
219 // Save notebook = s
219 // Save notebook = s
220 that.save_notebook();
220 that.save_notebook();
221 that.control_key_active = false;
221 that.control_key_active = false;
222 return false;
222 return false;
223 } else if (event.which === 74 && that.control_key_active) {
223 } else if (event.which === 74 && that.control_key_active) {
224 // Move cell down = j
224 // Move cell down = j
225 that.move_cell_down();
225 that.move_cell_down();
226 that.control_key_active = false;
226 that.control_key_active = false;
227 return false;
227 return false;
228 } else if (event.which === 75 && that.control_key_active) {
228 } else if (event.which === 75 && that.control_key_active) {
229 // Move cell up = k
229 // Move cell up = k
230 that.move_cell_up();
230 that.move_cell_up();
231 that.control_key_active = false;
231 that.control_key_active = false;
232 return false;
232 return false;
233 } else if (event.which === 80 && that.control_key_active) {
233 } else if (event.which === 80 && that.control_key_active) {
234 // Select previous = p
234 // Select previous = p
235 that.select_prev();
235 that.select_prev();
236 that.control_key_active = false;
236 that.control_key_active = false;
237 return false;
237 return false;
238 } else if (event.which === 78 && that.control_key_active) {
238 } else if (event.which === 78 && that.control_key_active) {
239 // Select next = n
239 // Select next = n
240 that.select_next();
240 that.select_next();
241 that.control_key_active = false;
241 that.control_key_active = false;
242 return false;
242 return false;
243 } else if (event.which === 76 && that.control_key_active) {
243 } else if (event.which === 76 && that.control_key_active) {
244 // Toggle line numbers = l
244 // Toggle line numbers = l
245 that.cell_toggle_line_numbers();
245 that.cell_toggle_line_numbers();
246 that.control_key_active = false;
246 that.control_key_active = false;
247 return false;
247 return false;
248 } else if (event.which === 73 && that.control_key_active) {
248 } else if (event.which === 73 && that.control_key_active) {
249 // Interrupt kernel = i
249 // Interrupt kernel = i
250 that.kernel.interrupt();
250 that.kernel.interrupt();
251 that.control_key_active = false;
251 that.control_key_active = false;
252 return false;
252 return false;
253 } else if (event.which === 190 && that.control_key_active) {
253 } else if (event.which === 190 && that.control_key_active) {
254 // Restart kernel = . # matches qt console
254 // Restart kernel = . # matches qt console
255 that.restart_kernel();
255 that.restart_kernel();
256 that.control_key_active = false;
256 that.control_key_active = false;
257 return false;
257 return false;
258 } else if (event.which === 72 && that.control_key_active) {
258 } else if (event.which === 72 && that.control_key_active) {
259 // Show keyboard shortcuts = h
259 // Show keyboard shortcuts = h
260 IPython.quick_help.show_keyboard_shortcuts();
260 IPython.quick_help.show_keyboard_shortcuts();
261 that.control_key_active = false;
261 that.control_key_active = false;
262 return false;
262 return false;
263 } else if (event.which === 90 && that.control_key_active) {
263 } else if (event.which === 90 && that.control_key_active) {
264 // Undo last cell delete = z
264 // Undo last cell delete = z
265 that.undelete();
265 that.undelete();
266 that.control_key_active = false;
266 that.control_key_active = false;
267 return false;
267 return false;
268 } else if (that.control_key_active) {
268 } else if (that.control_key_active) {
269 that.control_key_active = false;
269 that.control_key_active = false;
270 return true;
270 return true;
271 };
271 };
272 return true;
272 return true;
273 });
273 });
274
274
275 var collapse_time = function(time){
275 var collapse_time = function(time){
276 var app_height = $('div#main_app').height(); // content height
276 var app_height = $('#ipython-main-app').height(); // content height
277 var splitter_height = $('div#pager_splitter').outerHeight(true);
277 var splitter_height = $('div#pager_splitter').outerHeight(true);
278 var new_height = app_height - splitter_height;
278 var new_height = app_height - splitter_height;
279 that.element.animate({height : new_height + 'px'}, time);
279 that.element.animate({height : new_height + 'px'}, time);
280 }
280 }
281
281
282 this.element.bind('collapse_pager', function (event,extrap) {
282 this.element.bind('collapse_pager', function (event,extrap) {
283 var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
283 var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
284 collapse_time(time);
284 collapse_time(time);
285 });
285 });
286
286
287 var expand_time = function(time) {
287 var expand_time = function(time) {
288 var app_height = $('div#main_app').height(); // content height
288 var app_height = $('#ipython-main-app').height(); // content height
289 var splitter_height = $('div#pager_splitter').outerHeight(true);
289 var splitter_height = $('div#pager_splitter').outerHeight(true);
290 var pager_height = $('div#pager').outerHeight(true);
290 var pager_height = $('div#pager').outerHeight(true);
291 var new_height = app_height - pager_height - splitter_height;
291 var new_height = app_height - pager_height - splitter_height;
292 that.element.animate({height : new_height + 'px'}, time);
292 that.element.animate({height : new_height + 'px'}, time);
293 }
293 }
294
294
295 this.element.bind('expand_pager', function (event, extrap) {
295 this.element.bind('expand_pager', function (event, extrap) {
296 var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
296 var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
297 expand_time(time);
297 expand_time(time);
298 });
298 });
299
299
300 $(window).bind('beforeunload', function () {
300 $(window).bind('beforeunload', function () {
301 // TODO: Make killing the kernel configurable.
301 // TODO: Make killing the kernel configurable.
302 var kill_kernel = false;
302 var kill_kernel = false;
303 if (kill_kernel) {
303 if (kill_kernel) {
304 that.kernel.kill();
304 that.kernel.kill();
305 }
305 }
306 if (that.dirty && ! that.read_only) {
306 if (that.dirty && ! that.read_only) {
307 return "You have unsaved changes that will be lost if you leave this page.";
307 return "You have unsaved changes that will be lost if you leave this page.";
308 };
308 };
309 // Null is the *only* return value that will make the browser not
309 // Null is the *only* return value that will make the browser not
310 // pop up the "don't leave" dialog.
310 // pop up the "don't leave" dialog.
311 return null;
311 return null;
312 });
312 });
313 };
313 };
314
314
315 Notebook.prototype.scroll_to_cell = function (cell_number, time) {
315 Notebook.prototype.scroll_to_cell = function (cell_number, time) {
316 var cells = this.get_cells();
316 var cells = this.get_cells();
317 var time = time || 0;
317 var time = time || 0;
318 cell_number = Math.min(cells.length-1,cell_number);
318 cell_number = Math.min(cells.length-1,cell_number);
319 cell_number = Math.max(0 ,cell_number);
319 cell_number = Math.max(0 ,cell_number);
320 var scroll_value = cells[cell_number].element.position().top-cells[0].element.position().top ;
320 var scroll_value = cells[cell_number].element.position().top-cells[0].element.position().top ;
321 this.element.animate({scrollTop:scroll_value}, time);
321 this.element.animate({scrollTop:scroll_value}, time);
322 return scroll_value;
322 return scroll_value;
323 };
323 };
324
324
325
325
326 Notebook.prototype.scroll_to_bottom = function () {
326 Notebook.prototype.scroll_to_bottom = function () {
327 this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0);
327 this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0);
328 };
328 };
329
329
330
330
331 Notebook.prototype.scroll_to_top = function () {
331 Notebook.prototype.scroll_to_top = function () {
332 this.element.animate({scrollTop:0}, 0);
332 this.element.animate({scrollTop:0}, 0);
333 };
333 };
334
334
335
335
336 // Cell indexing, retrieval, etc.
336 // Cell indexing, retrieval, etc.
337
337
338 Notebook.prototype.get_cell_elements = function () {
338 Notebook.prototype.get_cell_elements = function () {
339 return this.element.children("div.cell");
339 return this.element.children("div.cell");
340 };
340 };
341
341
342
342
343 Notebook.prototype.get_cell_element = function (index) {
343 Notebook.prototype.get_cell_element = function (index) {
344 var result = null;
344 var result = null;
345 var e = this.get_cell_elements().eq(index);
345 var e = this.get_cell_elements().eq(index);
346 if (e.length !== 0) {
346 if (e.length !== 0) {
347 result = e;
347 result = e;
348 }
348 }
349 return result;
349 return result;
350 };
350 };
351
351
352
352
353 Notebook.prototype.ncells = function (cell) {
353 Notebook.prototype.ncells = function (cell) {
354 return this.get_cell_elements().length;
354 return this.get_cell_elements().length;
355 };
355 };
356
356
357
357
358 // TODO: we are often calling cells as cells()[i], which we should optimize
358 // TODO: we are often calling cells as cells()[i], which we should optimize
359 // to cells(i) or a new method.
359 // to cells(i) or a new method.
360 Notebook.prototype.get_cells = function () {
360 Notebook.prototype.get_cells = function () {
361 return this.get_cell_elements().toArray().map(function (e) {
361 return this.get_cell_elements().toArray().map(function (e) {
362 return $(e).data("cell");
362 return $(e).data("cell");
363 });
363 });
364 };
364 };
365
365
366
366
367 Notebook.prototype.get_cell = function (index) {
367 Notebook.prototype.get_cell = function (index) {
368 var result = null;
368 var result = null;
369 var ce = this.get_cell_element(index);
369 var ce = this.get_cell_element(index);
370 if (ce !== null) {
370 if (ce !== null) {
371 result = ce.data('cell');
371 result = ce.data('cell');
372 }
372 }
373 return result;
373 return result;
374 }
374 }
375
375
376
376
377 Notebook.prototype.get_next_cell = function (cell) {
377 Notebook.prototype.get_next_cell = function (cell) {
378 var result = null;
378 var result = null;
379 var index = this.find_cell_index(cell);
379 var index = this.find_cell_index(cell);
380 if (index !== null && index < this.ncells()) {
380 if (index !== null && index < this.ncells()) {
381 result = this.get_cell(index+1);
381 result = this.get_cell(index+1);
382 }
382 }
383 return result;
383 return result;
384 }
384 }
385
385
386
386
387 Notebook.prototype.get_prev_cell = function (cell) {
387 Notebook.prototype.get_prev_cell = function (cell) {
388 var result = null;
388 var result = null;
389 var index = this.find_cell_index(cell);
389 var index = this.find_cell_index(cell);
390 if (index !== null && index > 1) {
390 if (index !== null && index > 1) {
391 result = this.get_cell(index-1);
391 result = this.get_cell(index-1);
392 }
392 }
393 return result;
393 return result;
394 }
394 }
395
395
396 Notebook.prototype.find_cell_index = function (cell) {
396 Notebook.prototype.find_cell_index = function (cell) {
397 var result = null;
397 var result = null;
398 this.get_cell_elements().filter(function (index) {
398 this.get_cell_elements().filter(function (index) {
399 if ($(this).data("cell") === cell) {
399 if ($(this).data("cell") === cell) {
400 result = index;
400 result = index;
401 };
401 };
402 });
402 });
403 return result;
403 return result;
404 };
404 };
405
405
406
406
407 Notebook.prototype.index_or_selected = function (index) {
407 Notebook.prototype.index_or_selected = function (index) {
408 var i;
408 var i;
409 if (index === undefined || index === null) {
409 if (index === undefined || index === null) {
410 i = this.get_selected_index();
410 i = this.get_selected_index();
411 if (i === null) {
411 if (i === null) {
412 i = 0;
412 i = 0;
413 }
413 }
414 } else {
414 } else {
415 i = index;
415 i = index;
416 }
416 }
417 return i;
417 return i;
418 };
418 };
419
419
420
420
421 Notebook.prototype.get_selected_cell = function () {
421 Notebook.prototype.get_selected_cell = function () {
422 var index = this.get_selected_index();
422 var index = this.get_selected_index();
423 return this.get_cell(index);
423 return this.get_cell(index);
424 };
424 };
425
425
426
426
427 Notebook.prototype.is_valid_cell_index = function (index) {
427 Notebook.prototype.is_valid_cell_index = function (index) {
428 if (index !== null && index >= 0 && index < this.ncells()) {
428 if (index !== null && index >= 0 && index < this.ncells()) {
429 return true;
429 return true;
430 } else {
430 } else {
431 return false;
431 return false;
432 };
432 };
433 }
433 }
434
434
435 Notebook.prototype.get_selected_index = function () {
435 Notebook.prototype.get_selected_index = function () {
436 var result = null;
436 var result = null;
437 this.get_cell_elements().filter(function (index) {
437 this.get_cell_elements().filter(function (index) {
438 if ($(this).data("cell").selected === true) {
438 if ($(this).data("cell").selected === true) {
439 result = index;
439 result = index;
440 };
440 };
441 });
441 });
442 return result;
442 return result;
443 };
443 };
444
444
445
445
446 // Cell selection.
446 // Cell selection.
447
447
448 Notebook.prototype.select = function (index) {
448 Notebook.prototype.select = function (index) {
449 if (index !== undefined && index >= 0 && index < this.ncells()) {
449 if (index !== undefined && index >= 0 && index < this.ncells()) {
450 var sindex = this.get_selected_index()
450 var sindex = this.get_selected_index()
451 if (sindex !== null && index !== sindex) {
451 if (sindex !== null && index !== sindex) {
452 this.get_cell(sindex).unselect();
452 this.get_cell(sindex).unselect();
453 };
453 };
454 var cell = this.get_cell(index);
454 var cell = this.get_cell(index);
455 cell.select();
455 cell.select();
456 if (cell.cell_type === 'heading') {
456 if (cell.cell_type === 'heading') {
457 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
457 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
458 {'cell_type':cell.cell_type,level:cell.level}
458 {'cell_type':cell.cell_type,level:cell.level}
459 );
459 );
460 } else {
460 } else {
461 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
461 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
462 {'cell_type':cell.cell_type}
462 {'cell_type':cell.cell_type}
463 );
463 );
464 };
464 };
465 };
465 };
466 return this;
466 return this;
467 };
467 };
468
468
469
469
470 Notebook.prototype.select_next = function () {
470 Notebook.prototype.select_next = function () {
471 var index = this.get_selected_index();
471 var index = this.get_selected_index();
472 if (index !== null && index >= 0 && (index+1) < this.ncells()) {
472 if (index !== null && index >= 0 && (index+1) < this.ncells()) {
473 this.select(index+1);
473 this.select(index+1);
474 };
474 };
475 return this;
475 return this;
476 };
476 };
477
477
478
478
479 Notebook.prototype.select_prev = function () {
479 Notebook.prototype.select_prev = function () {
480 var index = this.get_selected_index();
480 var index = this.get_selected_index();
481 if (index !== null && index >= 0 && (index-1) < this.ncells()) {
481 if (index !== null && index >= 0 && (index-1) < this.ncells()) {
482 this.select(index-1);
482 this.select(index-1);
483 };
483 };
484 return this;
484 return this;
485 };
485 };
486
486
487
487
488 // Cell movement
488 // Cell movement
489
489
490 Notebook.prototype.move_cell_up = function (index) {
490 Notebook.prototype.move_cell_up = function (index) {
491 var i = this.index_or_selected();
491 var i = this.index_or_selected();
492 if (i !== null && i < this.ncells() && i > 0) {
492 if (i !== null && i < this.ncells() && i > 0) {
493 var pivot = this.get_cell_element(i-1);
493 var pivot = this.get_cell_element(i-1);
494 var tomove = this.get_cell_element(i);
494 var tomove = this.get_cell_element(i);
495 if (pivot !== null && tomove !== null) {
495 if (pivot !== null && tomove !== null) {
496 tomove.detach();
496 tomove.detach();
497 pivot.before(tomove);
497 pivot.before(tomove);
498 this.select(i-1);
498 this.select(i-1);
499 };
499 };
500 };
500 };
501 this.dirty = true;
501 this.dirty = true;
502 return this;
502 return this;
503 };
503 };
504
504
505
505
506 Notebook.prototype.move_cell_down = function (index) {
506 Notebook.prototype.move_cell_down = function (index) {
507 var i = this.index_or_selected();
507 var i = this.index_or_selected();
508 if (i !== null && i < (this.ncells()-1) && i >= 0) {
508 if (i !== null && i < (this.ncells()-1) && i >= 0) {
509 var pivot = this.get_cell_element(i+1);
509 var pivot = this.get_cell_element(i+1);
510 var tomove = this.get_cell_element(i);
510 var tomove = this.get_cell_element(i);
511 if (pivot !== null && tomove !== null) {
511 if (pivot !== null && tomove !== null) {
512 tomove.detach();
512 tomove.detach();
513 pivot.after(tomove);
513 pivot.after(tomove);
514 this.select(i+1);
514 this.select(i+1);
515 };
515 };
516 };
516 };
517 this.dirty = true;
517 this.dirty = true;
518 return this;
518 return this;
519 };
519 };
520
520
521
521
522 Notebook.prototype.sort_cells = function () {
522 Notebook.prototype.sort_cells = function () {
523 // This is not working right now. Calling this will actually crash
523 // This is not working right now. Calling this will actually crash
524 // the browser. I think there is an infinite loop in here...
524 // the browser. I think there is an infinite loop in here...
525 var ncells = this.ncells();
525 var ncells = this.ncells();
526 var sindex = this.get_selected_index();
526 var sindex = this.get_selected_index();
527 var swapped;
527 var swapped;
528 do {
528 do {
529 swapped = false;
529 swapped = false;
530 for (var i=1; i<ncells; i++) {
530 for (var i=1; i<ncells; i++) {
531 current = this.get_cell(i);
531 current = this.get_cell(i);
532 previous = this.get_cell(i-1);
532 previous = this.get_cell(i-1);
533 if (previous.input_prompt_number > current.input_prompt_number) {
533 if (previous.input_prompt_number > current.input_prompt_number) {
534 this.move_cell_up(i);
534 this.move_cell_up(i);
535 swapped = true;
535 swapped = true;
536 };
536 };
537 };
537 };
538 } while (swapped);
538 } while (swapped);
539 this.select(sindex);
539 this.select(sindex);
540 return this;
540 return this;
541 };
541 };
542
542
543 // Insertion, deletion.
543 // Insertion, deletion.
544
544
545 Notebook.prototype.delete_cell = function (index) {
545 Notebook.prototype.delete_cell = function (index) {
546 var i = this.index_or_selected(index);
546 var i = this.index_or_selected(index);
547 var cell = this.get_selected_cell();
547 var cell = this.get_selected_cell();
548 this.undelete_backup = cell.toJSON();
548 this.undelete_backup = cell.toJSON();
549 if (this.is_valid_cell_index(i)) {
549 if (this.is_valid_cell_index(i)) {
550 var ce = this.get_cell_element(i);
550 var ce = this.get_cell_element(i);
551 ce.remove();
551 ce.remove();
552 if (i === (this.ncells())) {
552 if (i === (this.ncells())) {
553 this.select(i-1);
553 this.select(i-1);
554 this.undelete_index = i - 1;
554 this.undelete_index = i - 1;
555 this.undelete_below = true;
555 this.undelete_below = true;
556 } else {
556 } else {
557 this.select(i);
557 this.select(i);
558 this.undelete_index = i;
558 this.undelete_index = i;
559 this.undelete_below = false;
559 this.undelete_below = false;
560 };
560 };
561 this.dirty = true;
561 this.dirty = true;
562 };
562 };
563 return this;
563 return this;
564 };
564 };
565
565
566
566
567 Notebook.prototype.insert_cell_at_bottom = function (type){
567 Notebook.prototype.insert_cell_at_bottom = function (type){
568 var len = this.ncells();
568 var len = this.ncells();
569 return this.insert_cell_below(type,len-1);
569 return this.insert_cell_below(type,len-1);
570 }
570 }
571
571
572 Notebook.prototype.insert_cell_below = function (type, index) {
572 Notebook.prototype.insert_cell_below = function (type, index) {
573 // type = ('code','html','markdown')
573 // type = ('code','html','markdown')
574 // index = cell index or undefined to insert below selected
574 // index = cell index or undefined to insert below selected
575 index = this.index_or_selected(index);
575 index = this.index_or_selected(index);
576 var cell = null;
576 var cell = null;
577 // This is intentionally < rather than <= for the sake of more
577 // This is intentionally < rather than <= for the sake of more
578 // sensible behavior in some cases.
578 // sensible behavior in some cases.
579 if (this.undelete_index !== null && index < this.undelete_index) {
579 if (this.undelete_index !== null && index < this.undelete_index) {
580 this.undelete_index = this.undelete_index + 1;
580 this.undelete_index = this.undelete_index + 1;
581 }
581 }
582 if (this.ncells() === 0 || this.is_valid_cell_index(index)) {
582 if (this.ncells() === 0 || this.is_valid_cell_index(index)) {
583 if (type === 'code') {
583 if (type === 'code') {
584 cell = new IPython.CodeCell(this.kernel);
584 cell = new IPython.CodeCell(this.kernel);
585 cell.set_input_prompt();
585 cell.set_input_prompt();
586 } else if (type === 'markdown') {
586 } else if (type === 'markdown') {
587 cell = new IPython.MarkdownCell();
587 cell = new IPython.MarkdownCell();
588 } else if (type === 'html') {
588 } else if (type === 'html') {
589 cell = new IPython.HTMLCell();
589 cell = new IPython.HTMLCell();
590 } else if (type === 'raw') {
590 } else if (type === 'raw') {
591 cell = new IPython.RawCell();
591 cell = new IPython.RawCell();
592 } else if (type === 'heading') {
592 } else if (type === 'heading') {
593 cell = new IPython.HeadingCell();
593 cell = new IPython.HeadingCell();
594 };
594 };
595 if (cell !== null) {
595 if (cell !== null) {
596 if (this.ncells() === 0) {
596 if (this.ncells() === 0) {
597 this.element.find('div.end_space').before(cell.element);
597 this.element.find('div.end_space').before(cell.element);
598 } else if (this.is_valid_cell_index(index)) {
598 } else if (this.is_valid_cell_index(index)) {
599 this.get_cell_element(index).after(cell.element);
599 this.get_cell_element(index).after(cell.element);
600 };
600 };
601 cell.render();
601 cell.render();
602 this.select(this.find_cell_index(cell));
602 this.select(this.find_cell_index(cell));
603 this.dirty = true;
603 this.dirty = true;
604 return cell;
604 return cell;
605 };
605 };
606 };
606 };
607 return cell;
607 return cell;
608 };
608 };
609
609
610
610
611 Notebook.prototype.insert_cell_above = function (type, index) {
611 Notebook.prototype.insert_cell_above = function (type, index) {
612 // type = ('code','html','markdown')
612 // type = ('code','html','markdown')
613 // index = cell index or undefined to insert above selected
613 // index = cell index or undefined to insert above selected
614 index = this.index_or_selected(index);
614 index = this.index_or_selected(index);
615 var cell = null;
615 var cell = null;
616 if (this.undelete_index !== null && index <= this.undelete_index) {
616 if (this.undelete_index !== null && index <= this.undelete_index) {
617 this.undelete_index = this.undelete_index + 1;
617 this.undelete_index = this.undelete_index + 1;
618 }
618 }
619 if (this.ncells() === 0 || this.is_valid_cell_index(index)) {
619 if (this.ncells() === 0 || this.is_valid_cell_index(index)) {
620 if (type === 'code') {
620 if (type === 'code') {
621 cell = new IPython.CodeCell(this.kernel);
621 cell = new IPython.CodeCell(this.kernel);
622 cell.set_input_prompt();
622 cell.set_input_prompt();
623 } else if (type === 'markdown') {
623 } else if (type === 'markdown') {
624 cell = new IPython.MarkdownCell();
624 cell = new IPython.MarkdownCell();
625 } else if (type === 'html') {
625 } else if (type === 'html') {
626 cell = new IPython.HTMLCell();
626 cell = new IPython.HTMLCell();
627 } else if (type === 'raw') {
627 } else if (type === 'raw') {
628 cell = new IPython.RawCell();
628 cell = new IPython.RawCell();
629 } else if (type === 'heading') {
629 } else if (type === 'heading') {
630 cell = new IPython.HeadingCell();
630 cell = new IPython.HeadingCell();
631 };
631 };
632 if (cell !== null) {
632 if (cell !== null) {
633 if (this.ncells() === 0) {
633 if (this.ncells() === 0) {
634 this.element.find('div.end_space').before(cell.element);
634 this.element.find('div.end_space').before(cell.element);
635 } else if (this.is_valid_cell_index(index)) {
635 } else if (this.is_valid_cell_index(index)) {
636 this.get_cell_element(index).before(cell.element);
636 this.get_cell_element(index).before(cell.element);
637 };
637 };
638 cell.render();
638 cell.render();
639 this.select(this.find_cell_index(cell));
639 this.select(this.find_cell_index(cell));
640 this.dirty = true;
640 this.dirty = true;
641 return cell;
641 return cell;
642 };
642 };
643 };
643 };
644 return cell;
644 return cell;
645 };
645 };
646
646
647
647
648 Notebook.prototype.to_code = function (index) {
648 Notebook.prototype.to_code = function (index) {
649 var i = this.index_or_selected(index);
649 var i = this.index_or_selected(index);
650 if (this.is_valid_cell_index(i)) {
650 if (this.is_valid_cell_index(i)) {
651 var source_element = this.get_cell_element(i);
651 var source_element = this.get_cell_element(i);
652 var source_cell = source_element.data("cell");
652 var source_cell = source_element.data("cell");
653 if (!(source_cell instanceof IPython.CodeCell)) {
653 if (!(source_cell instanceof IPython.CodeCell)) {
654 var target_cell = this.insert_cell_below('code',i);
654 var target_cell = this.insert_cell_below('code',i);
655 var text = source_cell.get_text();
655 var text = source_cell.get_text();
656 if (text === source_cell.placeholder) {
656 if (text === source_cell.placeholder) {
657 text = '';
657 text = '';
658 }
658 }
659 target_cell.set_text(text);
659 target_cell.set_text(text);
660 // make this value the starting point, so that we can only undo
660 // make this value the starting point, so that we can only undo
661 // to this state, instead of a blank cell
661 // to this state, instead of a blank cell
662 target_cell.code_mirror.clearHistory();
662 target_cell.code_mirror.clearHistory();
663 source_element.remove();
663 source_element.remove();
664 this.dirty = true;
664 this.dirty = true;
665 };
665 };
666 };
666 };
667 };
667 };
668
668
669
669
670 Notebook.prototype.to_markdown = function (index) {
670 Notebook.prototype.to_markdown = function (index) {
671 var i = this.index_or_selected(index);
671 var i = this.index_or_selected(index);
672 if (this.is_valid_cell_index(i)) {
672 if (this.is_valid_cell_index(i)) {
673 var source_element = this.get_cell_element(i);
673 var source_element = this.get_cell_element(i);
674 var source_cell = source_element.data("cell");
674 var source_cell = source_element.data("cell");
675 if (!(source_cell instanceof IPython.MarkdownCell)) {
675 if (!(source_cell instanceof IPython.MarkdownCell)) {
676 var target_cell = this.insert_cell_below('markdown',i);
676 var target_cell = this.insert_cell_below('markdown',i);
677 var text = source_cell.get_text();
677 var text = source_cell.get_text();
678 if (text === source_cell.placeholder) {
678 if (text === source_cell.placeholder) {
679 text = '';
679 text = '';
680 };
680 };
681 // The edit must come before the set_text.
681 // The edit must come before the set_text.
682 target_cell.edit();
682 target_cell.edit();
683 target_cell.set_text(text);
683 target_cell.set_text(text);
684 // make this value the starting point, so that we can only undo
684 // make this value the starting point, so that we can only undo
685 // to this state, instead of a blank cell
685 // to this state, instead of a blank cell
686 target_cell.code_mirror.clearHistory();
686 target_cell.code_mirror.clearHistory();
687 source_element.remove();
687 source_element.remove();
688 this.dirty = true;
688 this.dirty = true;
689 };
689 };
690 };
690 };
691 };
691 };
692
692
693
693
694 Notebook.prototype.to_html = function (index) {
694 Notebook.prototype.to_html = function (index) {
695 var i = this.index_or_selected(index);
695 var i = this.index_or_selected(index);
696 if (this.is_valid_cell_index(i)) {
696 if (this.is_valid_cell_index(i)) {
697 var source_element = this.get_cell_element(i);
697 var source_element = this.get_cell_element(i);
698 var source_cell = source_element.data("cell");
698 var source_cell = source_element.data("cell");
699 var target_cell = null;
699 var target_cell = null;
700 if (!(source_cell instanceof IPython.HTMLCell)) {
700 if (!(source_cell instanceof IPython.HTMLCell)) {
701 target_cell = this.insert_cell_below('html',i);
701 target_cell = this.insert_cell_below('html',i);
702 var text = source_cell.get_text();
702 var text = source_cell.get_text();
703 if (text === source_cell.placeholder) {
703 if (text === source_cell.placeholder) {
704 text = '';
704 text = '';
705 };
705 };
706 // The edit must come before the set_text.
706 // The edit must come before the set_text.
707 target_cell.edit();
707 target_cell.edit();
708 target_cell.set_text(text);
708 target_cell.set_text(text);
709 // make this value the starting point, so that we can only undo
709 // make this value the starting point, so that we can only undo
710 // to this state, instead of a blank cell
710 // to this state, instead of a blank cell
711 target_cell.code_mirror.clearHistory();
711 target_cell.code_mirror.clearHistory();
712 source_element.remove();
712 source_element.remove();
713 this.dirty = true;
713 this.dirty = true;
714 };
714 };
715 };
715 };
716 };
716 };
717
717
718
718
719 Notebook.prototype.to_raw = function (index) {
719 Notebook.prototype.to_raw = function (index) {
720 var i = this.index_or_selected(index);
720 var i = this.index_or_selected(index);
721 if (this.is_valid_cell_index(i)) {
721 if (this.is_valid_cell_index(i)) {
722 var source_element = this.get_cell_element(i);
722 var source_element = this.get_cell_element(i);
723 var source_cell = source_element.data("cell");
723 var source_cell = source_element.data("cell");
724 var target_cell = null;
724 var target_cell = null;
725 if (!(source_cell instanceof IPython.RawCell)) {
725 if (!(source_cell instanceof IPython.RawCell)) {
726 target_cell = this.insert_cell_below('raw',i);
726 target_cell = this.insert_cell_below('raw',i);
727 var text = source_cell.get_text();
727 var text = source_cell.get_text();
728 if (text === source_cell.placeholder) {
728 if (text === source_cell.placeholder) {
729 text = '';
729 text = '';
730 };
730 };
731 // The edit must come before the set_text.
731 // The edit must come before the set_text.
732 target_cell.edit();
732 target_cell.edit();
733 target_cell.set_text(text);
733 target_cell.set_text(text);
734 // make this value the starting point, so that we can only undo
734 // make this value the starting point, so that we can only undo
735 // to this state, instead of a blank cell
735 // to this state, instead of a blank cell
736 target_cell.code_mirror.clearHistory();
736 target_cell.code_mirror.clearHistory();
737 source_element.remove();
737 source_element.remove();
738 this.dirty = true;
738 this.dirty = true;
739 };
739 };
740 };
740 };
741 };
741 };
742
742
743
743
744 Notebook.prototype.to_heading = function (index, level) {
744 Notebook.prototype.to_heading = function (index, level) {
745 level = level || 1;
745 level = level || 1;
746 var i = this.index_or_selected(index);
746 var i = this.index_or_selected(index);
747 if (this.is_valid_cell_index(i)) {
747 if (this.is_valid_cell_index(i)) {
748 var source_element = this.get_cell_element(i);
748 var source_element = this.get_cell_element(i);
749 var source_cell = source_element.data("cell");
749 var source_cell = source_element.data("cell");
750 var target_cell = null;
750 var target_cell = null;
751 if (source_cell instanceof IPython.HeadingCell) {
751 if (source_cell instanceof IPython.HeadingCell) {
752 source_cell.set_level(level);
752 source_cell.set_level(level);
753 } else {
753 } else {
754 target_cell = this.insert_cell_below('heading',i);
754 target_cell = this.insert_cell_below('heading',i);
755 var text = source_cell.get_text();
755 var text = source_cell.get_text();
756 if (text === source_cell.placeholder) {
756 if (text === source_cell.placeholder) {
757 text = '';
757 text = '';
758 };
758 };
759 // The edit must come before the set_text.
759 // The edit must come before the set_text.
760 target_cell.set_level(level);
760 target_cell.set_level(level);
761 target_cell.edit();
761 target_cell.edit();
762 target_cell.set_text(text);
762 target_cell.set_text(text);
763 // make this value the starting point, so that we can only undo
763 // make this value the starting point, so that we can only undo
764 // to this state, instead of a blank cell
764 // to this state, instead of a blank cell
765 target_cell.code_mirror.clearHistory();
765 target_cell.code_mirror.clearHistory();
766 source_element.remove();
766 source_element.remove();
767 this.dirty = true;
767 this.dirty = true;
768 };
768 };
769 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
769 $([IPython.events]).trigger('selected_cell_type_changed.Notebook',
770 {'cell_type':'heading',level:level}
770 {'cell_type':'heading',level:level}
771 );
771 );
772 };
772 };
773 };
773 };
774
774
775
775
776 // Cut/Copy/Paste
776 // Cut/Copy/Paste
777
777
778 Notebook.prototype.enable_paste = function () {
778 Notebook.prototype.enable_paste = function () {
779 var that = this;
779 var that = this;
780 if (!this.paste_enabled) {
780 if (!this.paste_enabled) {
781 $('#paste_cell_replace').removeClass('ui-state-disabled')
781 $('#paste_cell_replace').removeClass('ui-state-disabled')
782 .on('click', function () {that.paste_cell_replace();});
782 .on('click', function () {that.paste_cell_replace();});
783 $('#paste_cell_above').removeClass('ui-state-disabled')
783 $('#paste_cell_above').removeClass('ui-state-disabled')
784 .on('click', function () {that.paste_cell_above();});
784 .on('click', function () {that.paste_cell_above();});
785 $('#paste_cell_below').removeClass('ui-state-disabled')
785 $('#paste_cell_below').removeClass('ui-state-disabled')
786 .on('click', function () {that.paste_cell_below();});
786 .on('click', function () {that.paste_cell_below();});
787 this.paste_enabled = true;
787 this.paste_enabled = true;
788 };
788 };
789 };
789 };
790
790
791
791
792 Notebook.prototype.disable_paste = function () {
792 Notebook.prototype.disable_paste = function () {
793 if (this.paste_enabled) {
793 if (this.paste_enabled) {
794 $('#paste_cell_replace').addClass('ui-state-disabled').off('click');
794 $('#paste_cell_replace').addClass('ui-state-disabled').off('click');
795 $('#paste_cell_above').addClass('ui-state-disabled').off('click');
795 $('#paste_cell_above').addClass('ui-state-disabled').off('click');
796 $('#paste_cell_below').addClass('ui-state-disabled').off('click');
796 $('#paste_cell_below').addClass('ui-state-disabled').off('click');
797 this.paste_enabled = false;
797 this.paste_enabled = false;
798 };
798 };
799 };
799 };
800
800
801
801
802 Notebook.prototype.cut_cell = function () {
802 Notebook.prototype.cut_cell = function () {
803 this.copy_cell();
803 this.copy_cell();
804 this.delete_cell();
804 this.delete_cell();
805 }
805 }
806
806
807 Notebook.prototype.copy_cell = function () {
807 Notebook.prototype.copy_cell = function () {
808 var cell = this.get_selected_cell();
808 var cell = this.get_selected_cell();
809 this.clipboard = cell.toJSON();
809 this.clipboard = cell.toJSON();
810 this.enable_paste();
810 this.enable_paste();
811 };
811 };
812
812
813
813
814 Notebook.prototype.paste_cell_replace = function () {
814 Notebook.prototype.paste_cell_replace = function () {
815 if (this.clipboard !== null && this.paste_enabled) {
815 if (this.clipboard !== null && this.paste_enabled) {
816 var cell_data = this.clipboard;
816 var cell_data = this.clipboard;
817 var new_cell = this.insert_cell_above(cell_data.cell_type);
817 var new_cell = this.insert_cell_above(cell_data.cell_type);
818 new_cell.fromJSON(cell_data);
818 new_cell.fromJSON(cell_data);
819 var old_cell = this.get_next_cell(new_cell);
819 var old_cell = this.get_next_cell(new_cell);
820 this.delete_cell(this.find_cell_index(old_cell));
820 this.delete_cell(this.find_cell_index(old_cell));
821 this.select(this.find_cell_index(new_cell));
821 this.select(this.find_cell_index(new_cell));
822 };
822 };
823 };
823 };
824
824
825
825
826 Notebook.prototype.paste_cell_above = function () {
826 Notebook.prototype.paste_cell_above = function () {
827 if (this.clipboard !== null && this.paste_enabled) {
827 if (this.clipboard !== null && this.paste_enabled) {
828 var cell_data = this.clipboard;
828 var cell_data = this.clipboard;
829 var new_cell = this.insert_cell_above(cell_data.cell_type);
829 var new_cell = this.insert_cell_above(cell_data.cell_type);
830 new_cell.fromJSON(cell_data);
830 new_cell.fromJSON(cell_data);
831 };
831 };
832 };
832 };
833
833
834
834
835 Notebook.prototype.paste_cell_below = function () {
835 Notebook.prototype.paste_cell_below = function () {
836 if (this.clipboard !== null && this.paste_enabled) {
836 if (this.clipboard !== null && this.paste_enabled) {
837 var cell_data = this.clipboard;
837 var cell_data = this.clipboard;
838 var new_cell = this.insert_cell_below(cell_data.cell_type);
838 var new_cell = this.insert_cell_below(cell_data.cell_type);
839 new_cell.fromJSON(cell_data);
839 new_cell.fromJSON(cell_data);
840 };
840 };
841 };
841 };
842
842
843 // Cell undelete
843 // Cell undelete
844
844
845 Notebook.prototype.undelete = function() {
845 Notebook.prototype.undelete = function() {
846 if (this.undelete_backup !== null && this.undelete_index !== null) {
846 if (this.undelete_backup !== null && this.undelete_index !== null) {
847 var current_index = this.get_selected_index();
847 var current_index = this.get_selected_index();
848 if (this.undelete_index < current_index) {
848 if (this.undelete_index < current_index) {
849 current_index = current_index + 1;
849 current_index = current_index + 1;
850 }
850 }
851 if (this.undelete_index >= this.ncells()) {
851 if (this.undelete_index >= this.ncells()) {
852 this.select(this.ncells() - 1);
852 this.select(this.ncells() - 1);
853 }
853 }
854 else {
854 else {
855 this.select(this.undelete_index);
855 this.select(this.undelete_index);
856 }
856 }
857 var cell_data = this.undelete_backup;
857 var cell_data = this.undelete_backup;
858 var new_cell = null;
858 var new_cell = null;
859 if (this.undelete_below) {
859 if (this.undelete_below) {
860 new_cell = this.insert_cell_below(cell_data.cell_type);
860 new_cell = this.insert_cell_below(cell_data.cell_type);
861 } else {
861 } else {
862 new_cell = this.insert_cell_above(cell_data.cell_type);
862 new_cell = this.insert_cell_above(cell_data.cell_type);
863 }
863 }
864 new_cell.fromJSON(cell_data);
864 new_cell.fromJSON(cell_data);
865 this.select(current_index);
865 this.select(current_index);
866 this.undelete_backup = null;
866 this.undelete_backup = null;
867 this.undelete_index = null;
867 this.undelete_index = null;
868 }
868 }
869 }
869 }
870
870
871 // Split/merge
871 // Split/merge
872
872
873 Notebook.prototype.split_cell = function () {
873 Notebook.prototype.split_cell = function () {
874 // Todo: implement spliting for other cell types.
874 // Todo: implement spliting for other cell types.
875 var cell = this.get_selected_cell();
875 var cell = this.get_selected_cell();
876 if (cell.is_splittable()) {
876 if (cell.is_splittable()) {
877 var texta = cell.get_pre_cursor();
877 var texta = cell.get_pre_cursor();
878 var textb = cell.get_post_cursor();
878 var textb = cell.get_post_cursor();
879 if (cell instanceof IPython.CodeCell) {
879 if (cell instanceof IPython.CodeCell) {
880 cell.set_text(texta);
880 cell.set_text(texta);
881 var new_cell = this.insert_cell_below('code');
881 var new_cell = this.insert_cell_below('code');
882 new_cell.set_text(textb);
882 new_cell.set_text(textb);
883 } else if (cell instanceof IPython.MarkdownCell) {
883 } else if (cell instanceof IPython.MarkdownCell) {
884 cell.set_text(texta);
884 cell.set_text(texta);
885 cell.render();
885 cell.render();
886 var new_cell = this.insert_cell_below('markdown');
886 var new_cell = this.insert_cell_below('markdown');
887 new_cell.edit(); // editor must be visible to call set_text
887 new_cell.edit(); // editor must be visible to call set_text
888 new_cell.set_text(textb);
888 new_cell.set_text(textb);
889 new_cell.render();
889 new_cell.render();
890 } else if (cell instanceof IPython.HTMLCell) {
890 } else if (cell instanceof IPython.HTMLCell) {
891 cell.set_text(texta);
891 cell.set_text(texta);
892 cell.render();
892 cell.render();
893 var new_cell = this.insert_cell_below('html');
893 var new_cell = this.insert_cell_below('html');
894 new_cell.edit(); // editor must be visible to call set_text
894 new_cell.edit(); // editor must be visible to call set_text
895 new_cell.set_text(textb);
895 new_cell.set_text(textb);
896 new_cell.render();
896 new_cell.render();
897 };
897 };
898 };
898 };
899 };
899 };
900
900
901
901
902 Notebook.prototype.merge_cell_above = function () {
902 Notebook.prototype.merge_cell_above = function () {
903 var index = this.get_selected_index();
903 var index = this.get_selected_index();
904 var cell = this.get_cell(index);
904 var cell = this.get_cell(index);
905 if (index > 0) {
905 if (index > 0) {
906 var upper_cell = this.get_cell(index-1);
906 var upper_cell = this.get_cell(index-1);
907 var upper_text = upper_cell.get_text();
907 var upper_text = upper_cell.get_text();
908 var text = cell.get_text();
908 var text = cell.get_text();
909 if (cell instanceof IPython.CodeCell) {
909 if (cell instanceof IPython.CodeCell) {
910 cell.set_text(upper_text+'\n'+text);
910 cell.set_text(upper_text+'\n'+text);
911 } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) {
911 } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) {
912 cell.edit();
912 cell.edit();
913 cell.set_text(upper_text+'\n'+text);
913 cell.set_text(upper_text+'\n'+text);
914 cell.render();
914 cell.render();
915 };
915 };
916 this.delete_cell(index-1);
916 this.delete_cell(index-1);
917 this.select(this.find_cell_index(cell));
917 this.select(this.find_cell_index(cell));
918 };
918 };
919 };
919 };
920
920
921
921
922 Notebook.prototype.merge_cell_below = function () {
922 Notebook.prototype.merge_cell_below = function () {
923 var index = this.get_selected_index();
923 var index = this.get_selected_index();
924 var cell = this.get_cell(index);
924 var cell = this.get_cell(index);
925 if (index < this.ncells()-1) {
925 if (index < this.ncells()-1) {
926 var lower_cell = this.get_cell(index+1);
926 var lower_cell = this.get_cell(index+1);
927 var lower_text = lower_cell.get_text();
927 var lower_text = lower_cell.get_text();
928 var text = cell.get_text();
928 var text = cell.get_text();
929 if (cell instanceof IPython.CodeCell) {
929 if (cell instanceof IPython.CodeCell) {
930 cell.set_text(text+'\n'+lower_text);
930 cell.set_text(text+'\n'+lower_text);
931 } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) {
931 } else if (cell instanceof IPython.MarkdownCell || cell instanceof IPython.HTMLCell) {
932 cell.edit();
932 cell.edit();
933 cell.set_text(text+'\n'+lower_text);
933 cell.set_text(text+'\n'+lower_text);
934 cell.render();
934 cell.render();
935 };
935 };
936 this.delete_cell(index+1);
936 this.delete_cell(index+1);
937 this.select(this.find_cell_index(cell));
937 this.select(this.find_cell_index(cell));
938 };
938 };
939 };
939 };
940
940
941
941
942 // Cell collapsing and output clearing
942 // Cell collapsing and output clearing
943
943
944 Notebook.prototype.collapse = function (index) {
944 Notebook.prototype.collapse = function (index) {
945 var i = this.index_or_selected(index);
945 var i = this.index_or_selected(index);
946 this.get_cell(i).collapse();
946 this.get_cell(i).collapse();
947 this.dirty = true;
947 this.dirty = true;
948 };
948 };
949
949
950
950
951 Notebook.prototype.expand = function (index) {
951 Notebook.prototype.expand = function (index) {
952 var i = this.index_or_selected(index);
952 var i = this.index_or_selected(index);
953 this.get_cell(i).expand();
953 this.get_cell(i).expand();
954 this.dirty = true;
954 this.dirty = true;
955 };
955 };
956
956
957
957
958 Notebook.prototype.toggle_output = function (index) {
958 Notebook.prototype.toggle_output = function (index) {
959 var i = this.index_or_selected(index);
959 var i = this.index_or_selected(index);
960 this.get_cell(i).toggle_output();
960 this.get_cell(i).toggle_output();
961 this.dirty = true;
961 this.dirty = true;
962 };
962 };
963
963
964
964
965 Notebook.prototype.toggle_output_scroll = function (index) {
965 Notebook.prototype.toggle_output_scroll = function (index) {
966 var i = this.index_or_selected(index);
966 var i = this.index_or_selected(index);
967 this.get_cell(i).toggle_output_scroll();
967 this.get_cell(i).toggle_output_scroll();
968 };
968 };
969
969
970
970
971 Notebook.prototype.collapse_all_output = function () {
971 Notebook.prototype.collapse_all_output = function () {
972 var ncells = this.ncells();
972 var ncells = this.ncells();
973 var cells = this.get_cells();
973 var cells = this.get_cells();
974 for (var i=0; i<ncells; i++) {
974 for (var i=0; i<ncells; i++) {
975 if (cells[i] instanceof IPython.CodeCell) {
975 if (cells[i] instanceof IPython.CodeCell) {
976 cells[i].output_area.collapse();
976 cells[i].output_area.collapse();
977 }
977 }
978 };
978 };
979 // this should not be set if the `collapse` key is removed from nbformat
979 // this should not be set if the `collapse` key is removed from nbformat
980 this.dirty = true;
980 this.dirty = true;
981 };
981 };
982
982
983
983
984 Notebook.prototype.scroll_all_output = function () {
984 Notebook.prototype.scroll_all_output = function () {
985 var ncells = this.ncells();
985 var ncells = this.ncells();
986 var cells = this.get_cells();
986 var cells = this.get_cells();
987 for (var i=0; i<ncells; i++) {
987 for (var i=0; i<ncells; i++) {
988 if (cells[i] instanceof IPython.CodeCell) {
988 if (cells[i] instanceof IPython.CodeCell) {
989 cells[i].output_area.expand();
989 cells[i].output_area.expand();
990 cells[i].output_area.scroll_if_long(20);
990 cells[i].output_area.scroll_if_long(20);
991 }
991 }
992 };
992 };
993 // this should not be set if the `collapse` key is removed from nbformat
993 // this should not be set if the `collapse` key is removed from nbformat
994 this.dirty = true;
994 this.dirty = true;
995 };
995 };
996
996
997
997
998 Notebook.prototype.expand_all_output = function () {
998 Notebook.prototype.expand_all_output = function () {
999 var ncells = this.ncells();
999 var ncells = this.ncells();
1000 var cells = this.get_cells();
1000 var cells = this.get_cells();
1001 for (var i=0; i<ncells; i++) {
1001 for (var i=0; i<ncells; i++) {
1002 if (cells[i] instanceof IPython.CodeCell) {
1002 if (cells[i] instanceof IPython.CodeCell) {
1003 cells[i].output_area.expand();
1003 cells[i].output_area.expand();
1004 cells[i].output_area.unscroll_area();
1004 cells[i].output_area.unscroll_area();
1005 }
1005 }
1006 };
1006 };
1007 // this should not be set if the `collapse` key is removed from nbformat
1007 // this should not be set if the `collapse` key is removed from nbformat
1008 this.dirty = true;
1008 this.dirty = true;
1009 };
1009 };
1010
1010
1011
1011
1012 Notebook.prototype.clear_all_output = function () {
1012 Notebook.prototype.clear_all_output = function () {
1013 var ncells = this.ncells();
1013 var ncells = this.ncells();
1014 var cells = this.get_cells();
1014 var cells = this.get_cells();
1015 for (var i=0; i<ncells; i++) {
1015 for (var i=0; i<ncells; i++) {
1016 if (cells[i] instanceof IPython.CodeCell) {
1016 if (cells[i] instanceof IPython.CodeCell) {
1017 cells[i].clear_output(true,true,true);
1017 cells[i].clear_output(true,true,true);
1018 // Make all In[] prompts blank, as well
1018 // Make all In[] prompts blank, as well
1019 // TODO: make this configurable (via checkbox?)
1019 // TODO: make this configurable (via checkbox?)
1020 cells[i].set_input_prompt();
1020 cells[i].set_input_prompt();
1021 }
1021 }
1022 };
1022 };
1023 this.dirty = true;
1023 this.dirty = true;
1024 };
1024 };
1025
1025
1026
1026
1027 // Other cell functions: line numbers, ...
1027 // Other cell functions: line numbers, ...
1028
1028
1029 Notebook.prototype.cell_toggle_line_numbers = function() {
1029 Notebook.prototype.cell_toggle_line_numbers = function() {
1030 this.get_selected_cell().toggle_line_numbers();
1030 this.get_selected_cell().toggle_line_numbers();
1031 };
1031 };
1032
1032
1033 // Kernel related things
1033 // Kernel related things
1034
1034
1035 Notebook.prototype.start_kernel = function () {
1035 Notebook.prototype.start_kernel = function () {
1036 var base_url = $('body').data('baseKernelUrl') + "kernels";
1036 var base_url = $('body').data('baseKernelUrl') + "kernels";
1037 this.kernel = new IPython.Kernel(base_url);
1037 this.kernel = new IPython.Kernel(base_url);
1038 this.kernel.start(this.notebook_id);
1038 this.kernel.start(this.notebook_id);
1039 // Now that the kernel has been created, tell the CodeCells about it.
1039 // Now that the kernel has been created, tell the CodeCells about it.
1040 var ncells = this.ncells();
1040 var ncells = this.ncells();
1041 for (var i=0; i<ncells; i++) {
1041 for (var i=0; i<ncells; i++) {
1042 var cell = this.get_cell(i);
1042 var cell = this.get_cell(i);
1043 if (cell instanceof IPython.CodeCell) {
1043 if (cell instanceof IPython.CodeCell) {
1044 cell.set_kernel(this.kernel)
1044 cell.set_kernel(this.kernel)
1045 };
1045 };
1046 };
1046 };
1047 };
1047 };
1048
1048
1049
1049
1050 Notebook.prototype.restart_kernel = function () {
1050 Notebook.prototype.restart_kernel = function () {
1051 var that = this;
1051 var that = this;
1052 var dialog = $('<div/>');
1052 var dialog = $('<div/>');
1053 dialog.html('Do you want to restart the current kernel? You will lose all variables defined in it.');
1053 dialog.html('Do you want to restart the current kernel? You will lose all variables defined in it.');
1054 $(document).append(dialog);
1054 $(document).append(dialog);
1055 dialog.dialog({
1055 dialog.dialog({
1056 resizable: false,
1056 resizable: false,
1057 modal: true,
1057 modal: true,
1058 title: "Restart kernel or continue running?",
1058 title: "Restart kernel or continue running?",
1059 closeText: '',
1059 closeText: '',
1060 buttons : {
1060 buttons : {
1061 "Restart": function () {
1061 "Restart": function () {
1062 that.kernel.restart();
1062 that.kernel.restart();
1063 $(this).dialog('close');
1063 $(this).dialog('close');
1064 },
1064 },
1065 "Continue running": function () {
1065 "Continue running": function () {
1066 $(this).dialog('close');
1066 $(this).dialog('close');
1067 }
1067 }
1068 }
1068 }
1069 });
1069 });
1070 };
1070 };
1071
1071
1072
1072
1073 Notebook.prototype.execute_selected_cell = function (options) {
1073 Notebook.prototype.execute_selected_cell = function (options) {
1074 // add_new: should a new cell be added if we are at the end of the nb
1074 // add_new: should a new cell be added if we are at the end of the nb
1075 // terminal: execute in terminal mode, which stays in the current cell
1075 // terminal: execute in terminal mode, which stays in the current cell
1076 var default_options = {terminal: false, add_new: true};
1076 var default_options = {terminal: false, add_new: true};
1077 $.extend(default_options, options);
1077 $.extend(default_options, options);
1078 var that = this;
1078 var that = this;
1079 var cell = that.get_selected_cell();
1079 var cell = that.get_selected_cell();
1080 var cell_index = that.find_cell_index(cell);
1080 var cell_index = that.find_cell_index(cell);
1081 if (cell instanceof IPython.CodeCell) {
1081 if (cell instanceof IPython.CodeCell) {
1082 cell.execute();
1082 cell.execute();
1083 } else if (cell instanceof IPython.HTMLCell) {
1083 } else if (cell instanceof IPython.HTMLCell) {
1084 cell.render();
1084 cell.render();
1085 }
1085 }
1086 if (default_options.terminal) {
1086 if (default_options.terminal) {
1087 cell.select_all();
1087 cell.select_all();
1088 } else {
1088 } else {
1089 if ((cell_index === (that.ncells()-1)) && default_options.add_new) {
1089 if ((cell_index === (that.ncells()-1)) && default_options.add_new) {
1090 that.insert_cell_below('code');
1090 that.insert_cell_below('code');
1091 // If we are adding a new cell at the end, scroll down to show it.
1091 // If we are adding a new cell at the end, scroll down to show it.
1092 that.scroll_to_bottom();
1092 that.scroll_to_bottom();
1093 } else {
1093 } else {
1094 that.select(cell_index+1);
1094 that.select(cell_index+1);
1095 };
1095 };
1096 };
1096 };
1097 this.dirty = true;
1097 this.dirty = true;
1098 };
1098 };
1099
1099
1100
1100
1101 Notebook.prototype.execute_cells_below = function () {
1101 Notebook.prototype.execute_cells_below = function () {
1102 this.execute_cell_range(this.get_selected_index(), this.ncells());
1102 this.execute_cell_range(this.get_selected_index(), this.ncells());
1103 this.scroll_to_bottom();
1103 this.scroll_to_bottom();
1104 };
1104 };
1105
1105
1106 Notebook.prototype.execute_cells_above = function () {
1106 Notebook.prototype.execute_cells_above = function () {
1107 this.execute_cell_range(0, this.get_selected_index());
1107 this.execute_cell_range(0, this.get_selected_index());
1108 };
1108 };
1109
1109
1110 Notebook.prototype.execute_all_cells = function () {
1110 Notebook.prototype.execute_all_cells = function () {
1111 this.execute_cell_range(0, this.ncells());
1111 this.execute_cell_range(0, this.ncells());
1112 that.scroll_to_bottom();
1112 that.scroll_to_bottom();
1113 };
1113 };
1114
1114
1115 Notebook.prototype.execute_cell_range = function (start, end) {
1115 Notebook.prototype.execute_cell_range = function (start, end) {
1116 for (var i=start; i<end; i++) {
1116 for (var i=start; i<end; i++) {
1117 this.select(i);
1117 this.select(i);
1118 this.execute_selected_cell({add_new:false});
1118 this.execute_selected_cell({add_new:false});
1119 };
1119 };
1120 };
1120 };
1121
1121
1122 // Persistance and loading
1122 // Persistance and loading
1123
1123
1124 Notebook.prototype.get_notebook_id = function () {
1124 Notebook.prototype.get_notebook_id = function () {
1125 return this.notebook_id;
1125 return this.notebook_id;
1126 };
1126 };
1127
1127
1128
1128
1129 Notebook.prototype.get_notebook_name = function () {
1129 Notebook.prototype.get_notebook_name = function () {
1130 return this.notebook_name;
1130 return this.notebook_name;
1131 };
1131 };
1132
1132
1133
1133
1134 Notebook.prototype.set_notebook_name = function (name) {
1134 Notebook.prototype.set_notebook_name = function (name) {
1135 this.notebook_name = name;
1135 this.notebook_name = name;
1136 };
1136 };
1137
1137
1138
1138
1139 Notebook.prototype.test_notebook_name = function (nbname) {
1139 Notebook.prototype.test_notebook_name = function (nbname) {
1140 nbname = nbname || '';
1140 nbname = nbname || '';
1141 if (this.notebook_name_blacklist_re.test(nbname) == false && nbname.length>0) {
1141 if (this.notebook_name_blacklist_re.test(nbname) == false && nbname.length>0) {
1142 return true;
1142 return true;
1143 } else {
1143 } else {
1144 return false;
1144 return false;
1145 };
1145 };
1146 };
1146 };
1147
1147
1148
1148
1149 Notebook.prototype.fromJSON = function (data) {
1149 Notebook.prototype.fromJSON = function (data) {
1150 var ncells = this.ncells();
1150 var ncells = this.ncells();
1151 var i;
1151 var i;
1152 for (i=0; i<ncells; i++) {
1152 for (i=0; i<ncells; i++) {
1153 // Always delete cell 0 as they get renumbered as they are deleted.
1153 // Always delete cell 0 as they get renumbered as they are deleted.
1154 this.delete_cell(0);
1154 this.delete_cell(0);
1155 };
1155 };
1156 // Save the metadata and name.
1156 // Save the metadata and name.
1157 this.metadata = data.metadata;
1157 this.metadata = data.metadata;
1158 this.notebook_name = data.metadata.name;
1158 this.notebook_name = data.metadata.name;
1159 // Only handle 1 worksheet for now.
1159 // Only handle 1 worksheet for now.
1160 var worksheet = data.worksheets[0];
1160 var worksheet = data.worksheets[0];
1161 if (worksheet !== undefined) {
1161 if (worksheet !== undefined) {
1162 if (worksheet.metadata) {
1162 if (worksheet.metadata) {
1163 this.worksheet_metadata = worksheet.metadata;
1163 this.worksheet_metadata = worksheet.metadata;
1164 }
1164 }
1165 var new_cells = worksheet.cells;
1165 var new_cells = worksheet.cells;
1166 ncells = new_cells.length;
1166 ncells = new_cells.length;
1167 var cell_data = null;
1167 var cell_data = null;
1168 var new_cell = null;
1168 var new_cell = null;
1169 for (i=0; i<ncells; i++) {
1169 for (i=0; i<ncells; i++) {
1170 cell_data = new_cells[i];
1170 cell_data = new_cells[i];
1171 // VERSIONHACK: plaintext -> raw
1171 // VERSIONHACK: plaintext -> raw
1172 // handle never-released plaintext name for raw cells
1172 // handle never-released plaintext name for raw cells
1173 if (cell_data.cell_type === 'plaintext'){
1173 if (cell_data.cell_type === 'plaintext'){
1174 cell_data.cell_type = 'raw';
1174 cell_data.cell_type = 'raw';
1175 }
1175 }
1176
1176
1177 new_cell = this.insert_cell_below(cell_data.cell_type);
1177 new_cell = this.insert_cell_below(cell_data.cell_type);
1178 new_cell.fromJSON(cell_data);
1178 new_cell.fromJSON(cell_data);
1179 };
1179 };
1180 };
1180 };
1181 if (data.worksheets.length > 1) {
1181 if (data.worksheets.length > 1) {
1182 var dialog = $('<div/>');
1182 var dialog = $('<div/>');
1183 dialog.html("This notebook has " + data.worksheets.length + " worksheets, " +
1183 dialog.html("This notebook has " + data.worksheets.length + " worksheets, " +
1184 "but this version of IPython can only handle the first. " +
1184 "but this version of IPython can only handle the first. " +
1185 "If you save this notebook, worksheets after the first will be lost."
1185 "If you save this notebook, worksheets after the first will be lost."
1186 );
1186 );
1187 this.element.append(dialog);
1187 this.element.append(dialog);
1188 dialog.dialog({
1188 dialog.dialog({
1189 resizable: false,
1189 resizable: false,
1190 modal: true,
1190 modal: true,
1191 title: "Multiple worksheets",
1191 title: "Multiple worksheets",
1192 closeText: "",
1192 closeText: "",
1193 close: function(event, ui) {$(this).dialog('destroy').remove();},
1193 close: function(event, ui) {$(this).dialog('destroy').remove();},
1194 buttons : {
1194 buttons : {
1195 "OK": function () {
1195 "OK": function () {
1196 $(this).dialog('close');
1196 $(this).dialog('close');
1197 }
1197 }
1198 },
1198 },
1199 width: 400
1199 width: 400
1200 });
1200 });
1201 }
1201 }
1202 };
1202 };
1203
1203
1204
1204
1205 Notebook.prototype.toJSON = function () {
1205 Notebook.prototype.toJSON = function () {
1206 var cells = this.get_cells();
1206 var cells = this.get_cells();
1207 var ncells = cells.length;
1207 var ncells = cells.length;
1208 var cell_array = new Array(ncells);
1208 var cell_array = new Array(ncells);
1209 for (var i=0; i<ncells; i++) {
1209 for (var i=0; i<ncells; i++) {
1210 cell_array[i] = cells[i].toJSON();
1210 cell_array[i] = cells[i].toJSON();
1211 };
1211 };
1212 var data = {
1212 var data = {
1213 // Only handle 1 worksheet for now.
1213 // Only handle 1 worksheet for now.
1214 worksheets : [{
1214 worksheets : [{
1215 cells: cell_array,
1215 cells: cell_array,
1216 metadata: this.worksheet_metadata
1216 metadata: this.worksheet_metadata
1217 }],
1217 }],
1218 metadata : this.metadata
1218 metadata : this.metadata
1219 };
1219 };
1220 return data;
1220 return data;
1221 };
1221 };
1222
1222
1223 Notebook.prototype.save_notebook = function () {
1223 Notebook.prototype.save_notebook = function () {
1224 // We may want to move the name/id/nbformat logic inside toJSON?
1224 // We may want to move the name/id/nbformat logic inside toJSON?
1225 var data = this.toJSON();
1225 var data = this.toJSON();
1226 data.metadata.name = this.notebook_name;
1226 data.metadata.name = this.notebook_name;
1227 data.nbformat = this.nbformat;
1227 data.nbformat = this.nbformat;
1228 data.nbformat_minor = this.nbformat_minor;
1228 data.nbformat_minor = this.nbformat_minor;
1229 // We do the call with settings so we can set cache to false.
1229 // We do the call with settings so we can set cache to false.
1230 var settings = {
1230 var settings = {
1231 processData : false,
1231 processData : false,
1232 cache : false,
1232 cache : false,
1233 type : "PUT",
1233 type : "PUT",
1234 data : JSON.stringify(data),
1234 data : JSON.stringify(data),
1235 headers : {'Content-Type': 'application/json'},
1235 headers : {'Content-Type': 'application/json'},
1236 success : $.proxy(this.save_notebook_success,this),
1236 success : $.proxy(this.save_notebook_success,this),
1237 error : $.proxy(this.save_notebook_error,this)
1237 error : $.proxy(this.save_notebook_error,this)
1238 };
1238 };
1239 $([IPython.events]).trigger('notebook_saving.Notebook');
1239 $([IPython.events]).trigger('notebook_saving.Notebook');
1240 var url = $('body').data('baseProjectUrl') + 'notebooks/' + this.notebook_id;
1240 var url = $('body').data('baseProjectUrl') + 'notebooks/' + this.notebook_id;
1241 $.ajax(url, settings);
1241 $.ajax(url, settings);
1242 };
1242 };
1243
1243
1244
1244
1245 Notebook.prototype.save_notebook_success = function (data, status, xhr) {
1245 Notebook.prototype.save_notebook_success = function (data, status, xhr) {
1246 this.dirty = false;
1246 this.dirty = false;
1247 $([IPython.events]).trigger('notebook_saved.Notebook');
1247 $([IPython.events]).trigger('notebook_saved.Notebook');
1248 };
1248 };
1249
1249
1250
1250
1251 Notebook.prototype.save_notebook_error = function (xhr, status, error_msg) {
1251 Notebook.prototype.save_notebook_error = function (xhr, status, error_msg) {
1252 $([IPython.events]).trigger('notebook_save_failed.Notebook');
1252 $([IPython.events]).trigger('notebook_save_failed.Notebook');
1253 };
1253 };
1254
1254
1255
1255
1256 Notebook.prototype.load_notebook = function (notebook_id) {
1256 Notebook.prototype.load_notebook = function (notebook_id) {
1257 var that = this;
1257 var that = this;
1258 this.notebook_id = notebook_id;
1258 this.notebook_id = notebook_id;
1259 // We do the call with settings so we can set cache to false.
1259 // We do the call with settings so we can set cache to false.
1260 var settings = {
1260 var settings = {
1261 processData : false,
1261 processData : false,
1262 cache : false,
1262 cache : false,
1263 type : "GET",
1263 type : "GET",
1264 dataType : "json",
1264 dataType : "json",
1265 success : $.proxy(this.load_notebook_success,this),
1265 success : $.proxy(this.load_notebook_success,this),
1266 error : $.proxy(this.load_notebook_error,this),
1266 error : $.proxy(this.load_notebook_error,this),
1267 };
1267 };
1268 $([IPython.events]).trigger('notebook_loading.Notebook');
1268 $([IPython.events]).trigger('notebook_loading.Notebook');
1269 var url = $('body').data('baseProjectUrl') + 'notebooks/' + this.notebook_id;
1269 var url = $('body').data('baseProjectUrl') + 'notebooks/' + this.notebook_id;
1270 $.ajax(url, settings);
1270 $.ajax(url, settings);
1271 };
1271 };
1272
1272
1273
1273
1274 Notebook.prototype.load_notebook_success = function (data, status, xhr) {
1274 Notebook.prototype.load_notebook_success = function (data, status, xhr) {
1275 this.fromJSON(data);
1275 this.fromJSON(data);
1276 if (this.ncells() === 0) {
1276 if (this.ncells() === 0) {
1277 this.insert_cell_below('code');
1277 this.insert_cell_below('code');
1278 };
1278 };
1279 this.dirty = false;
1279 this.dirty = false;
1280 this.select(0);
1280 this.select(0);
1281 this.scroll_to_top();
1281 this.scroll_to_top();
1282 if (data.orig_nbformat !== undefined && data.nbformat !== data.orig_nbformat) {
1282 if (data.orig_nbformat !== undefined && data.nbformat !== data.orig_nbformat) {
1283 msg = "This notebook has been converted from an older " +
1283 msg = "This notebook has been converted from an older " +
1284 "notebook format (v"+data.orig_nbformat+") to the current notebook " +
1284 "notebook format (v"+data.orig_nbformat+") to the current notebook " +
1285 "format (v"+data.nbformat+"). The next time you save this notebook, the " +
1285 "format (v"+data.nbformat+"). The next time you save this notebook, the " +
1286 "newer notebook format will be used and older verions of IPython " +
1286 "newer notebook format will be used and older verions of IPython " +
1287 "may not be able to read it. To keep the older version, close the " +
1287 "may not be able to read it. To keep the older version, close the " +
1288 "notebook without saving it.";
1288 "notebook without saving it.";
1289 var dialog = $('<div/>');
1289 var dialog = $('<div/>');
1290 dialog.html(msg);
1290 dialog.html(msg);
1291 this.element.append(dialog);
1291 this.element.append(dialog);
1292 dialog.dialog({
1292 dialog.dialog({
1293 resizable: false,
1293 resizable: false,
1294 modal: true,
1294 modal: true,
1295 title: "Notebook converted",
1295 title: "Notebook converted",
1296 closeText: "",
1296 closeText: "",
1297 close: function(event, ui) {$(this).dialog('destroy').remove();},
1297 close: function(event, ui) {$(this).dialog('destroy').remove();},
1298 buttons : {
1298 buttons : {
1299 "OK": function () {
1299 "OK": function () {
1300 $(this).dialog('close');
1300 $(this).dialog('close');
1301 }
1301 }
1302 },
1302 },
1303 width: 400
1303 width: 400
1304 });
1304 });
1305 } else if (data.orig_nbformat_minor !== undefined && data.nbformat_minor !== data.orig_nbformat_minor) {
1305 } else if (data.orig_nbformat_minor !== undefined && data.nbformat_minor !== data.orig_nbformat_minor) {
1306 var that = this;
1306 var that = this;
1307 var orig_vs = 'v' + data.nbformat + '.' + data.orig_nbformat_minor;
1307 var orig_vs = 'v' + data.nbformat + '.' + data.orig_nbformat_minor;
1308 var this_vs = 'v' + data.nbformat + '.' + this.nbformat_minor;
1308 var this_vs = 'v' + data.nbformat + '.' + this.nbformat_minor;
1309 var msg = "This notebook is version " + orig_vs + ", but we only fully support up to " +
1309 var msg = "This notebook is version " + orig_vs + ", but we only fully support up to " +
1310 this_vs + ". You can still work with this notebook, but some features " +
1310 this_vs + ". You can still work with this notebook, but some features " +
1311 "introduced in later notebook versions may not be available."
1311 "introduced in later notebook versions may not be available."
1312
1312
1313 var dialog = $('<div/>');
1313 var dialog = $('<div/>');
1314 dialog.html(msg);
1314 dialog.html(msg);
1315 this.element.append(dialog);
1315 this.element.append(dialog);
1316 dialog.dialog({
1316 dialog.dialog({
1317 resizable: false,
1317 resizable: false,
1318 modal: true,
1318 modal: true,
1319 title: "Newer Notebook",
1319 title: "Newer Notebook",
1320 closeText: "",
1320 closeText: "",
1321 close: function(event, ui) {$(this).dialog('destroy').remove();},
1321 close: function(event, ui) {$(this).dialog('destroy').remove();},
1322 buttons : {
1322 buttons : {
1323 "OK": function () {
1323 "OK": function () {
1324 $(this).dialog('close');
1324 $(this).dialog('close');
1325 }
1325 }
1326 },
1326 },
1327 width: 400
1327 width: 400
1328 });
1328 });
1329
1329
1330 }
1330 }
1331 // Create the kernel after the notebook is completely loaded to prevent
1331 // Create the kernel after the notebook is completely loaded to prevent
1332 // code execution upon loading, which is a security risk.
1332 // code execution upon loading, which is a security risk.
1333 if (! this.read_only) {
1333 if (! this.read_only) {
1334 this.start_kernel();
1334 this.start_kernel();
1335 }
1335 }
1336 $([IPython.events]).trigger('notebook_loaded.Notebook');
1336 $([IPython.events]).trigger('notebook_loaded.Notebook');
1337 };
1337 };
1338
1338
1339
1339
1340 Notebook.prototype.load_notebook_error = function (xhr, textStatus, errorThrow) {
1340 Notebook.prototype.load_notebook_error = function (xhr, textStatus, errorThrow) {
1341 if (xhr.status === 500) {
1341 if (xhr.status === 500) {
1342 var msg = "An error occurred while loading this notebook. Most likely " +
1342 var msg = "An error occurred while loading this notebook. Most likely " +
1343 "this notebook is in a newer format than is supported by this " +
1343 "this notebook is in a newer format than is supported by this " +
1344 "version of IPython. This version can load notebook formats " +
1344 "version of IPython. This version can load notebook formats " +
1345 "v"+this.nbformat+" or earlier.";
1345 "v"+this.nbformat+" or earlier.";
1346 var dialog = $('<div/>');
1346 var dialog = $('<div/>');
1347 dialog.html(msg);
1347 dialog.html(msg);
1348 this.element.append(dialog);
1348 this.element.append(dialog);
1349 dialog.dialog({
1349 dialog.dialog({
1350 resizable: false,
1350 resizable: false,
1351 modal: true,
1351 modal: true,
1352 title: "Error loading notebook",
1352 title: "Error loading notebook",
1353 closeText: "",
1353 closeText: "",
1354 close: function(event, ui) {$(this).dialog('destroy').remove();},
1354 close: function(event, ui) {$(this).dialog('destroy').remove();},
1355 buttons : {
1355 buttons : {
1356 "OK": function () {
1356 "OK": function () {
1357 $(this).dialog('close');
1357 $(this).dialog('close');
1358 }
1358 }
1359 },
1359 },
1360 width: 400
1360 width: 400
1361 });
1361 });
1362 }
1362 }
1363 }
1363 }
1364
1364
1365 IPython.Notebook = Notebook;
1365 IPython.Notebook = Notebook;
1366
1366
1367
1367
1368 return IPython;
1368 return IPython;
1369
1369
1370 }(IPython));
1370 }(IPython));
1371
1371
@@ -1,87 +1,87 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2011 The IPython Development Team
2 // Copyright (C) 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 // monkey patch CM to be able to syntax highlight cell magics
15 // monkey patch CM to be able to syntax highlight cell magics
16 // bug reported upstream,
16 // bug reported upstream,
17 // see https://github.com/marijnh/CodeMirror2/issues/670
17 // see https://github.com/marijnh/CodeMirror2/issues/670
18 if(CodeMirror.getMode(1,'text/plain').indent == undefined ){
18 if(CodeMirror.getMode(1,'text/plain').indent == undefined ){
19 console.log('patching CM for undefined indent');
19 console.log('patching CM for undefined indent');
20 CodeMirror.modes.null = function() { return {token: function(stream) {stream.skipToEnd();},indent : function(){return 0}}}
20 CodeMirror.modes.null = function() { return {token: function(stream) {stream.skipToEnd();},indent : function(){return 0}}}
21 }
21 }
22
22
23 CodeMirror.patchedGetMode = function(config, mode){
23 CodeMirror.patchedGetMode = function(config, mode){
24 var cmmode = CodeMirror.getMode(config, mode);
24 var cmmode = CodeMirror.getMode(config, mode);
25 if(cmmode.indent == null)
25 if(cmmode.indent == null)
26 {
26 {
27 console.log('patch mode "' , mode, '" on the fly');
27 console.log('patch mode "' , mode, '" on the fly');
28 cmmode.indent = function(){return 0};
28 cmmode.indent = function(){return 0};
29 }
29 }
30 return cmmode;
30 return cmmode;
31 }
31 }
32 // end monkey patching CodeMirror
32 // end monkey patching CodeMirror
33
33
34 IPython.mathjaxutils.init();
34 IPython.mathjaxutils.init();
35
35
36 IPython.read_only = $('body').data('readOnly') === 'True';
36 IPython.read_only = $('body').data('readOnly') === 'True';
37 $('div#main_app').addClass('border-box-sizing ui-widget');
37 $('#ipython-main-app').addClass('border-box-sizing ui-widget');
38 $('div#notebook_panel').addClass('border-box-sizing ui-widget');
38 $('div#notebook_panel').addClass('border-box-sizing ui-widget');
39 // The header's bottom border is provided by the menu bar so we remove it.
39 // The header's bottom border is provided by the menu bar so we remove it.
40 $('div#header').css('border-bottom-style','none');
40 $('div#header').css('border-bottom-style','none');
41
41
42 IPython.page = new IPython.Page();
42 IPython.page = new IPython.Page();
43 IPython.markdown_converter = new Markdown.Converter();
43 IPython.markdown_converter = new Markdown.Converter();
44 IPython.layout_manager = new IPython.LayoutManager();
44 IPython.layout_manager = new IPython.LayoutManager();
45 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
45 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
46 IPython.quick_help = new IPython.QuickHelp('span#quick_help_area');
46 IPython.quick_help = new IPython.QuickHelp('span#quick_help_area');
47 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
47 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
48 IPython.notebook = new IPython.Notebook('div#notebook');
48 IPython.notebook = new IPython.Notebook('div#notebook');
49 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
49 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
50 IPython.menubar = new IPython.MenuBar('#menubar')
50 IPython.menubar = new IPython.MenuBar('#menubar')
51 IPython.toolbar = new IPython.MainToolBar('#maintoolbar')
51 IPython.toolbar = new IPython.MainToolBar('#maintoolbar')
52 IPython.tooltip = new IPython.Tooltip()
52 IPython.tooltip = new IPython.Tooltip()
53 IPython.notification_area = new IPython.NotificationArea('#notification_area')
53 IPython.notification_area = new IPython.NotificationArea('#notification_area')
54 IPython.notification_area.init_notification_widgets();
54 IPython.notification_area.init_notification_widgets();
55
55
56 IPython.layout_manager.do_resize();
56 IPython.layout_manager.do_resize();
57
57
58 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
58 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
59 '<span id="test2" style="font-weight: bold;">x</span>'+
59 '<span id="test2" style="font-weight: bold;">x</span>'+
60 '<span id="test3" style="font-style: italic;">x</span></pre></div>')
60 '<span id="test3" style="font-style: italic;">x</span></pre></div>')
61 var nh = $('#test1').innerHeight();
61 var nh = $('#test1').innerHeight();
62 var bh = $('#test2').innerHeight();
62 var bh = $('#test2').innerHeight();
63 var ih = $('#test3').innerHeight();
63 var ih = $('#test3').innerHeight();
64 if(nh != bh || nh != ih) {
64 if(nh != bh || nh != ih) {
65 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
65 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
66 }
66 }
67 $('#fonttest').remove();
67 $('#fonttest').remove();
68
68
69 if(IPython.read_only){
69 if(IPython.read_only){
70 // hide various elements from read-only view
70 // hide various elements from read-only view
71 $('div#pager').remove();
71 $('div#pager').remove();
72 $('div#pager_splitter').remove();
72 $('div#pager_splitter').remove();
73
73
74 // set the notebook name field as not modifiable
74 // set the notebook name field as not modifiable
75 $('#notebook_name').attr('disabled','disabled')
75 $('#notebook_name').attr('disabled','disabled')
76 }
76 }
77
77
78 IPython.page.show();
78 IPython.page.show();
79
79
80 IPython.layout_manager.do_resize();
80 IPython.layout_manager.do_resize();
81 $([IPython.events]).on('notebook_loaded.Notebook', function () {
81 $([IPython.events]).on('notebook_loaded.Notebook', function () {
82 IPython.layout_manager.do_resize();
82 IPython.layout_manager.do_resize();
83 });
83 });
84 IPython.notebook.load_notebook($('body').data('notebookId'));
84 IPython.notebook.load_notebook($('body').data('notebookId'));
85
85
86 });
86 });
87
87
@@ -1,30 +1,30 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.mathjaxutils.init();
15 IPython.mathjaxutils.init();
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 $('#ipython-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
20
21 IPython.page = new IPython.Page();
21 IPython.page = new IPython.Page();
22 IPython.markdown_converter = new Markdown.Converter();
22 IPython.markdown_converter = new Markdown.Converter();
23 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
23 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
24 IPython.notebook = new IPython.Notebook('div#notebook');
24 IPython.notebook = new IPython.Notebook('div#notebook');
25 IPython.page.show_site();
25 IPython.page.show_site();
26
26
27 IPython.notebook.load_notebook($('body').data('notebookId'));
27 IPython.notebook.load_notebook($('body').data('notebookId'));
28
28
29 });
29 });
30
30
@@ -1,82 +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 // 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.page = new IPython.Page();
15 IPython.page = new IPython.Page();
16
16
17 $('div#tabs').tabs();
17 $('div#tabs').tabs();
18 $('div#tabs').on('tabsselect', function (event, ui) {
18 $('div#tabs').on('tabsselect', function (event, ui) {
19 var new_url = $('body').data('baseProjectUrl') + '#' + ui.panel.id;
19 var new_url = $('body').data('baseProjectUrl') + '#' + ui.panel.id;
20 window.history.replaceState({}, '', new_url);
20 window.history.replaceState({}, '', new_url);
21 });
21 });
22 $('div#main_app').addClass('border-box-sizing ui-widget');
22 $('#ipython-main-app').addClass('border-box-sizing ui-widget');
23 $('div#notebooks_toolbar').addClass('ui-widget ui-helper-clearfix');
23 $('div#notebooks_toolbar').addClass('ui-widget ui-helper-clearfix');
24 $('#new_notebook').button().click(function (e) {
24 $('#new_notebook').button().click(function (e) {
25 window.open($('body').data('baseProjectUrl')+'new');
25 window.open($('body').data('baseProjectUrl')+'new');
26 });
26 });
27
27
28 IPython.read_only = $('body').data('readOnly') === 'True';
28 IPython.read_only = $('body').data('readOnly') === 'True';
29 IPython.notebook_list = new IPython.NotebookList('div#notebook_list');
29 IPython.notebook_list = new IPython.NotebookList('div#notebook_list');
30 IPython.cluster_list = new IPython.ClusterList('div#cluster_list');
30 IPython.cluster_list = new IPython.ClusterList('div#cluster_list');
31 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
31 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
32
32
33 var interval_id=0;
33 var interval_id=0;
34 // auto refresh every xx secondes, no need to be fast,
34 // auto refresh every xx secondes, no need to be fast,
35 // update is done at least when page get focus
35 // update is done at least when page get focus
36 var time_refresh = 60; // in sec
36 var time_refresh = 60; // in sec
37
37
38 var enable_autorefresh = function(){
38 var enable_autorefresh = function(){
39 //refresh immediately , then start interval
39 //refresh immediately , then start interval
40 if($('.upload_button').length == 0)
40 if($('.upload_button').length == 0)
41 {
41 {
42 IPython.notebook_list.load_list();
42 IPython.notebook_list.load_list();
43 IPython.cluster_list.load_list();
43 IPython.cluster_list.load_list();
44 }
44 }
45 if (!interval_id){
45 if (!interval_id){
46 interval_id = setInterval(function(){
46 interval_id = setInterval(function(){
47 if($('.upload_button').length == 0)
47 if($('.upload_button').length == 0)
48 {
48 {
49 IPython.notebook_list.load_list();
49 IPython.notebook_list.load_list();
50 IPython.cluster_list.load_list();
50 IPython.cluster_list.load_list();
51 }
51 }
52 }, time_refresh*1000);
52 }, time_refresh*1000);
53 }
53 }
54 }
54 }
55
55
56 var disable_autorefresh = function(){
56 var disable_autorefresh = function(){
57 clearInterval(interval_id);
57 clearInterval(interval_id);
58 interval_id = 0;
58 interval_id = 0;
59 }
59 }
60
60
61 // stop autorefresh when page lose focus
61 // stop autorefresh when page lose focus
62 $(window).blur(function() {
62 $(window).blur(function() {
63 disable_autorefresh();
63 disable_autorefresh();
64 })
64 })
65
65
66 //re-enable when page get focus back
66 //re-enable when page get focus back
67 $(window).focus(function() {
67 $(window).focus(function() {
68 enable_autorefresh();
68 enable_autorefresh();
69 });
69 });
70
70
71 // finally start it, it will refresh immediately
71 // finally start it, it will refresh immediately
72 enable_autorefresh();
72 enable_autorefresh();
73
73
74 IPython.page.show();
74 IPython.page.show();
75
75
76 // bound the upload method to the on change of the file select list
76 // bound the upload method to the on change of the file select list
77 $("#alternate_upload").change(function (event){
77 $("#alternate_upload").change(function (event){
78 IPython.notebook_list.handelFilesUpload(event,'form');
78 IPython.notebook_list.handelFilesUpload(event,'form');
79 });
79 });
80
80
81 });
81 });
82
82
@@ -1,42 +1,42 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 <link rel="stylesheet" href="{{static_url("css/login.css") }}" type="text/css"/>
5 <link rel="stylesheet" href="{{static_url("css/login.css") }}" type="text/css"/>
6
6
7 {% endblock %}
7 {% endblock %}
8
8
9
9
10 {% block login_widget %}
10 {% block login_widget %}
11 {% endblock %}
11 {% endblock %}
12
12
13
13
14 {% block site %}
14 {% block site %}
15
15
16 <div id="main_app">
16 <div id="ipython-main-app">
17
17
18 {% if login_available %}
18 {% if login_available %}
19 <form action="{{base_project_url}}login?next={{next}}" method="post">
19 <form action="{{base_project_url}}login?next={{next}}" method="post">
20 Password: <input type="password" class='ui-widget ui-widget-content' name="password" id="password_input">
20 Password: <input type="password" class='ui-widget ui-widget-content' name="password" id="password_input">
21 <input type="submit" value="Log in" id="login_submit">
21 <input type="submit" value="Log in" id="login_submit">
22 </form>
22 </form>
23 {% endif %}
23 {% endif %}
24
24
25 {% if message %}
25 {% if message %}
26 {% for key in message %}
26 {% for key in message %}
27 <div class="message {{key}}">
27 <div class="message {{key}}">
28 {{message[key]}}
28 {{message[key]}}
29 </div>
29 </div>
30 {% endfor %}
30 {% endfor %}
31 {% endif %}
31 {% endif %}
32
32
33 <div/>
33 <div/>
34
34
35 {% endblock %}
35 {% endblock %}
36
36
37
37
38 {% block script %}
38 {% block script %}
39
39
40 <script src="{{static_url("js/loginmain.js") }}" type="text/javascript" charset="utf-8"></script>
40 <script src="{{static_url("js/loginmain.js") }}" type="text/javascript" charset="utf-8"></script>
41
41
42 {% endblock %}
42 {% endblock %}
@@ -1,40 +1,40 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 <link rel="stylesheet" href="{{static_url("css/logout.css") }}" type="text/css"/>
5 <link rel="stylesheet" href="{{static_url("css/logout.css") }}" type="text/css"/>
6
6
7 {% endblock %}
7 {% endblock %}
8
8
9
9
10 {% block login_widget %}
10 {% block login_widget %}
11 {% endblock %}
11 {% endblock %}
12
12
13 {% block site %}
13 {% block site %}
14
14
15 <div id="main_app">
15 <div id="ipython-main-app">
16
16
17 {% if message %}
17 {% if message %}
18 {% for key in message %}
18 {% for key in message %}
19 <div class="message {{key}}">
19 <div class="message {{key}}">
20 {{message[key]}}
20 {{message[key]}}
21 </div>
21 </div>
22 {% endfor %}
22 {% endfor %}
23 {% endif %}
23 {% endif %}
24
24
25 {% if read_only or not login_available %}
25 {% if read_only or not login_available %}
26 Proceed to the <a href="{{base_project_url}}">dashboard</a>.
26 Proceed to the <a href="{{base_project_url}}">dashboard</a>.
27 {% else %}
27 {% else %}
28 Proceed to the <a href="{{base_project_url}}login">login page</a>.
28 Proceed to the <a href="{{base_project_url}}login">login page</a>.
29 {% endif %}
29 {% endif %}
30
30
31
31
32 <div/>
32 <div/>
33
33
34 {% endblock %}
34 {% endblock %}
35
35
36 {% block script %}
36 {% block script %}
37
37
38 <script src="{{static_url("js/logoutmain.js") }}" type="text/javascript" charset="utf-8"></script>
38 <script src="{{static_url("js/logoutmain.js") }}" type="text/javascript" charset="utf-8"></script>
39
39
40 {% endblock %}
40 {% endblock %}
@@ -1,231 +1,231 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 {% if mathjax_url %}
5 {% if mathjax_url %}
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 {% endif %}
7 {% endif %}
8 <script type="text/javascript">
8 <script type="text/javascript">
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
10 // where it will be undefined, and should prompt a dialog later.
10 // where it will be undefined, and should prompt a dialog later.
11 window.mathjax_url = "{{mathjax_url}}";
11 window.mathjax_url = "{{mathjax_url}}";
12 </script>
12 </script>
13
13
14 <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}">
14 <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}">
15 <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}">
16
16
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
18
18
19 <link rel="stylesheet" href="{{ static_url("css/celltoolbar.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("css/celltoolbar.css") }}" type="text/css" />
20 <link rel="stylesheet/less" href="{{ static_url("css/notebook.less") }}" type="text/css" />
20 <link rel="stylesheet/less" href="{{ static_url("css/notebook.less") }}" type="text/css" />
21 <link rel="stylesheet/less" href="{{ static_url("css/tooltip.less") }}" type="text/css" />
21 <link rel="stylesheet/less" href="{{ static_url("css/tooltip.less") }}" type="text/css" />
22 <link rel="stylesheet/less" href="{{ static_url("css/renderedhtml.less") }}" type="text/css" />
22 <link rel="stylesheet/less" href="{{ static_url("css/renderedhtml.less") }}" type="text/css" />
23
23
24 <link rel="stylesheet/less" href="{{ static_url("css/printnotebook.less") }}" type="text/css" media="print"/>
24 <link rel="stylesheet/less" href="{{ static_url("css/printnotebook.less") }}" type="text/css" media="print"/>
25 {% endblock %}
25 {% endblock %}
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 {% endblock %}
35 {% endblock %}
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 {% endblock %}
45 {% endblock %}
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_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li>
78 <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li>
79 <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li>
79 <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li>
80 <li id="paste_cell_replace" class="ui-state-disabled"><a href="#">Paste Cell &amp; Replace</a></li>
80 <li id="paste_cell_replace" class="ui-state-disabled"><a href="#">Paste Cell &amp; Replace</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 <li id="run_all_cells_above"><a href="#">Run All Above</a></li>
111 <li id="run_all_cells_above"><a href="#">Run All Above</a></li>
112 <li id="run_all_cells_below"><a href="#">Run All Below</a></li>
112 <li id="run_all_cells_below"><a href="#">Run All Below</a></li>
113 <hr/>
113 <hr/>
114 <li id="to_code"><a href="#">Code</a></li>
114 <li id="to_code"><a href="#">Code</a></li>
115 <li id="to_markdown"><a href="#">Markdown </a></li>
115 <li id="to_markdown"><a href="#">Markdown </a></li>
116 <li id="to_raw"><a href="#">Raw Text</a></li>
116 <li id="to_raw"><a href="#">Raw Text</a></li>
117 <li id="to_heading1"><a href="#">Heading 1</a></li>
117 <li id="to_heading1"><a href="#">Heading 1</a></li>
118 <li id="to_heading2"><a href="#">Heading 2</a></li>
118 <li id="to_heading2"><a href="#">Heading 2</a></li>
119 <li id="to_heading3"><a href="#">Heading 3</a></li>
119 <li id="to_heading3"><a href="#">Heading 3</a></li>
120 <li id="to_heading4"><a href="#">Heading 4</a></li>
120 <li id="to_heading4"><a href="#">Heading 4</a></li>
121 <li id="to_heading5"><a href="#">Heading 5</a></li>
121 <li id="to_heading5"><a href="#">Heading 5</a></li>
122 <li id="to_heading6"><a href="#">Heading 6</a></li>
122 <li id="to_heading6"><a href="#">Heading 6</a></li>
123 <hr/>
123 <hr/>
124 <li id="toggle_output"><a href="#">Toggle Current Output</a></li>
124 <li id="toggle_output"><a href="#">Toggle Current Output</a></li>
125 <li id="all_outputs"><a href="#">All Output</a>
125 <li id="all_outputs"><a href="#">All Output</a>
126 <ul>
126 <ul>
127 <li id="expand_all_output"><a href="#">Expand</a></li>
127 <li id="expand_all_output"><a href="#">Expand</a></li>
128 <li id="scroll_all_output"><a href="#">Scroll Long</a></li>
128 <li id="scroll_all_output"><a href="#">Scroll Long</a></li>
129 <li id="collapse_all_output"><a href="#">Collapse</a></li>
129 <li id="collapse_all_output"><a href="#">Collapse</a></li>
130 <li id="clear_all_output"><a href="#">Clear</a></li>
130 <li id="clear_all_output"><a href="#">Clear</a></li>
131 </ul>
131 </ul>
132 </li>
132 </li>
133 </ul>
133 </ul>
134 </li>
134 </li>
135 <li><a href="#">Kernel</a>
135 <li><a href="#">Kernel</a>
136 <ul>
136 <ul>
137 <li id="int_kernel"><a href="#">Interrupt</a></li>
137 <li id="int_kernel"><a href="#">Interrupt</a></li>
138 <li id="restart_kernel"><a href="#">Restart</a></li>
138 <li id="restart_kernel"><a href="#">Restart</a></li>
139 </ul>
139 </ul>
140 </li>
140 </li>
141 <li><a href="#">Help</a>
141 <li><a href="#">Help</a>
142 <ul>
142 <ul>
143 <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li>
143 <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li>
144 <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li>
144 <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li>
145 <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li>
145 <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li>
146 <hr/>
146 <hr/>
147 <li><a href="http://docs.python.org" target="_blank">Python</a></li>
147 <li><a href="http://docs.python.org" target="_blank">Python</a></li>
148 <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li>
148 <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li>
149 <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li>
149 <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li>
150 <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li>
150 <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li>
151 <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li>
151 <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li>
152 </ul>
152 </ul>
153 </li>
153 </li>
154 </ul>
154 </ul>
155
155
156 </div>
156 </div>
157 <div id="notification_area">
157 <div id="notification_area">
158 </div>
158 </div>
159 </div>
159 </div>
160
160
161
161
162 <div id="maintoolbar"></div>
162 <div id="maintoolbar"></div>
163
163
164 <div id="main_app">
164 <div id="ipython-main-app">
165
165
166 <div id="notebook_panel">
166 <div id="notebook_panel">
167 <div id="notebook"></div>
167 <div id="notebook"></div>
168 <div id="pager_splitter"></div>
168 <div id="pager_splitter"></div>
169 <div id="pager_container">
169 <div id="pager_container">
170 <div id='pager_button_area'>
170 <div id='pager_button_area'>
171 </div>
171 </div>
172 <div id="pager"></div>
172 <div id="pager"></div>
173 </div>
173 </div>
174 </div>
174 </div>
175
175
176 </div>
176 </div>
177 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
177 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
178
178
179
179
180 {% endblock %}
180 {% endblock %}
181
181
182
182
183 {% block script %}
183 {% block script %}
184
184
185 <script src="{{ static_url("js/less/less-1.3.1.min.js") }}" charset="utf-8"></script>
185 <script src="{{ static_url("js/less/less-1.3.1.min.js") }}" charset="utf-8"></script>
186 <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
186 <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
187 <script src="{{ static_url("codemirror/lib/util/loadmode.js") }}" charset="utf-8"></script>
187 <script src="{{ static_url("codemirror/lib/util/loadmode.js") }}" charset="utf-8"></script>
188 <script src="{{ static_url("codemirror/lib/util/multiplex.js") }}" charset="utf-8"></script>
188 <script src="{{ static_url("codemirror/lib/util/multiplex.js") }}" charset="utf-8"></script>
189 <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script>
189 <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script>
190 <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
190 <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
191 <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
191 <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
192 <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
192 <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
193 <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script>
193 <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script>
194 <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
194 <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
195 <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
195 <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
196
196
197 <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script>
197 <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script>
198
198
199 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
199 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
200 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
200 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
201
201
202 <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script>
202 <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script>
203 <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
203 <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
204 <script src="{{ static_url("js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
204 <script src="{{ static_url("js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
205 <script src="{{ static_url("js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
205 <script src="{{ static_url("js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
206 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
206 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
207 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
207 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
208 <script src="{{ static_url("js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
208 <script src="{{ static_url("js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
209 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
209 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
210 <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
210 <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
211 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
211 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
212 <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
212 <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
213 <script src="{{ static_url("js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
213 <script src="{{ static_url("js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
214 <script src="{{ static_url("js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
214 <script src="{{ static_url("js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
215 <script src="{{ static_url("js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
215 <script src="{{ static_url("js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
216 <script src="{{ static_url("js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
216 <script src="{{ static_url("js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
217 <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
217 <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
218 <script src="{{ static_url("js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
218 <script src="{{ static_url("js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
219 <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
219 <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
220 <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
220 <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
221 <script src="{{ static_url("js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
221 <script src="{{ static_url("js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
222 <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
222 <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
223 <script src="{{ static_url("js/config.js") }}" type="text/javascript" charset="utf-8"></script>
223 <script src="{{ static_url("js/config.js") }}" type="text/javascript" charset="utf-8"></script>
224 <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
224 <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
225
225
226 <script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script>
226 <script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script>
227
227
228 <script src="{{ static_url("js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
228 <script src="{{ static_url("js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
229 <script src="{{ static_url("js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
229 <script src="{{ static_url("js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
230
230
231 {% endblock %}
231 {% endblock %}
@@ -1,81 +1,81 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 {% if mathjax_url %}
5 {% if mathjax_url %}
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 {% endif %}
7 {% endif %}
8 <script type="text/javascript">
8 <script type="text/javascript">
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
10 // where it will be undefined, and should prompt a dialog later.
10 // where it will be undefined, and should prompt a dialog later.
11 window.mathjax_url = "{{mathjax_url}}";
11 window.mathjax_url = "{{mathjax_url}}";
12 </script>
12 </script>
13
13
14 <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}">
14 <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}">
15 <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}">
16
16
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
18
18
19 <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" />
20 <link rel="stylesheet" href="{{ static_url("css/printnotebook.css") }}" type="text/css" />
20 <link rel="stylesheet" href="{{ static_url("css/printnotebook.css") }}" type="text/css" />
21 <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" />
21 <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" />
22
22
23 {% endblock %}
23 {% endblock %}
24
24
25
25
26 {% block params %}
26 {% block params %}
27
27
28 data-project={{project}}
28 data-project={{project}}
29 data-base-project-url={{base_project_url}}
29 data-base-project-url={{base_project_url}}
30 data-base-kernel-url={{base_kernel_url}}
30 data-base-kernel-url={{base_kernel_url}}
31 data-read-only={{read_only and not logged_in}}
31 data-read-only={{read_only and not logged_in}}
32 data-notebook-id={{notebook_id}}
32 data-notebook-id={{notebook_id}}
33
33
34 {% endblock %}
34 {% endblock %}
35
35
36
36
37 {% block header %}
37 {% block header %}
38 {% endblock %}
38 {% endblock %}
39
39
40
40
41 {% block site %}
41 {% block site %}
42
42
43 <div id="main_app">
43 <div id="ipython-main-app">
44
44
45 <div id="notebook_panel">
45 <div id="notebook_panel">
46 <div id="notebook"></div>
46 <div id="notebook"></div>
47 </div>
47 </div>
48
48
49 </div>
49 </div>
50
50
51 {% endblock %}
51 {% endblock %}
52
52
53
53
54 {% block script %}
54 {% block script %}
55
55
56 <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
56 <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
57 <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script>
57 <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script>
58 <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
58 <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
59 <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
59 <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
60 <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
60 <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
61 <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script>
61 <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script>
62 <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
62 <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
63 <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
63 <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
64
64
65 <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script>
65 <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script>
66
66
67 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
67 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
68 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
68 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
69
69
70 <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script>
70 <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script>
71 <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
71 <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
72 <script src="{{ static_url("js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
72 <script src="{{ static_url("js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
73 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
73 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
74 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
74 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
75 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
75 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
76 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
76 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
77 <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
77 <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
78 <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
78 <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
79 <script src="{{ static_url("js/printnotebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
79 <script src="{{ static_url("js/printnotebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
80
80
81 {% endblock %}
81 {% endblock %}
@@ -1,81 +1,81 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block title %}IPython Dashboard{% endblock %}
3 {% block title %}IPython Dashboard{% endblock %}
4
4
5 {% block stylesheet %}
5 {% block stylesheet %}
6 <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" />
6 <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" />
7 <link rel="stylesheet" href="{{static_url("css/alternateuploadform.css") }}" type="text/css" />
7 <link rel="stylesheet" href="{{static_url("css/alternateuploadform.css") }}" type="text/css" />
8 {% endblock %}
8 {% endblock %}
9
9
10
10
11 {% block params %}
11 {% block params %}
12
12
13 data-project={{project}}
13 data-project={{project}}
14 data-base-project-url={{base_project_url}}
14 data-base-project-url={{base_project_url}}
15 data-base-kernel-url={{base_kernel_url}}
15 data-base-kernel-url={{base_kernel_url}}
16 data-read-only={{read_only}}
16 data-read-only={{read_only}}
17
17
18 {% endblock %}
18 {% endblock %}
19
19
20
20
21 {% block site %}
21 {% block site %}
22
22
23 <div id="main_app">
23 <div id="ipython-main-app">
24
24
25 <div id="tabs">
25 <div id="tabs">
26 <ul>
26 <ul>
27 <li><a href="#tab1">Notebooks</a></li>
27 <li><a href="#tab1">Notebooks</a></li>
28 <li><a href="#tab2">Clusters</a></li>
28 <li><a href="#tab2">Clusters</a></li>
29 </ul>
29 </ul>
30
30
31 <div id="tab1">
31 <div id="tab1">
32 {% if logged_in or not read_only %}
32 {% if logged_in or not read_only %}
33 <div id="notebook_toolbar">
33 <div id="notebook_toolbar">
34 <form id='alternate_upload' class='alternate_upload' >
34 <form id='alternate_upload' class='alternate_upload' >
35 <span id="drag_info" style="position:absolute" >
35 <span id="drag_info" style="position:absolute" >
36 To import a notebook, drag the file onto the listing below or <strong>click here</strong>.
36 To import a notebook, drag the file onto the listing below or <strong>click here</strong>.
37 </span>
37 </span>
38 <input type="file" name="datafile" class="fileinput" multiple='multiple'>
38 <input type="file" name="datafile" class="fileinput" multiple='multiple'>
39 </form>
39 </form>
40 <span id="notebook_buttons">
40 <span id="notebook_buttons">
41 <button id="refresh_notebook_list" title="Refresh notebook list">Refresh</button>
41 <button id="refresh_notebook_list" title="Refresh notebook list">Refresh</button>
42 <button id="new_notebook" title="Create new notebook">New Notebook</button>
42 <button id="new_notebook" title="Create new notebook">New Notebook</button>
43 </span>
43 </span>
44 </div>
44 </div>
45 {% endif %}
45 {% endif %}
46
46
47 <div id="notebook_list">
47 <div id="notebook_list">
48 <div id="project_name"><h2>{{project}}</h2></div>
48 <div id="project_name"><h2>{{project}}</h2></div>
49 </div>
49 </div>
50 </div>
50 </div>
51 <div id="tab2">
51 <div id="tab2">
52
52
53 <div id="cluster_toolbar">
53 <div id="cluster_toolbar">
54 <span id="cluster_list_info">IPython parallel computing clusters</span>
54 <span id="cluster_list_info">IPython parallel computing clusters</span>
55
55
56 <span id="cluster_buttons">
56 <span id="cluster_buttons">
57 <button id="refresh_cluster_list" title="Refresh cluster list">Refresh</button>
57 <button id="refresh_cluster_list" title="Refresh cluster list">Refresh</button>
58 </span>
58 </span>
59 </div>
59 </div>
60
60
61 <div id="cluster_list">
61 <div id="cluster_list">
62 <div id="cluster_header">
62 <div id="cluster_header">
63 <span>profile</span>
63 <span>profile</span>
64 <span>action</span>
64 <span>action</span>
65 <span title="Enter the number of engines to start or empty for default"># of engines</span>
65 <span title="Enter the number of engines to start or empty for default"># of engines</span>
66 <span>status</span>
66 <span>status</span>
67 </div>
67 </div>
68 </div>
68 </div>
69
69
70 </div>
70 </div>
71 </div>
71 </div>
72
72
73 </div>
73 </div>
74
74
75 {% endblock %}
75 {% endblock %}
76
76
77 {% block script %}
77 {% block script %}
78 <script src="{{static_url("js/notebooklist.js") }}" type="text/javascript" charset="utf-8"></script>
78 <script src="{{static_url("js/notebooklist.js") }}" type="text/javascript" charset="utf-8"></script>
79 <script src="{{static_url("js/clusterlist.js") }}" type="text/javascript" charset="utf-8"></script>
79 <script src="{{static_url("js/clusterlist.js") }}" type="text/javascript" charset="utf-8"></script>
80 <script src="{{static_url("js/projectdashboardmain.js") }}" type="text/javascript" charset="utf-8"></script>
80 <script src="{{static_url("js/projectdashboardmain.js") }}" type="text/javascript" charset="utf-8"></script>
81 {% endblock %}
81 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now