##// END OF EJS Templates
Adding page break logic to the print css....
Brian E. Granger -
Show More
@@ -1,297 +1,307 b''
1 1
2 2 /**
3 3 * Primary styles
4 4 *
5 5 * Author: IPython Development Team
6 6 */
7 7
8 8
9 9 body {
10 10 background-color: white;
11 11 /* This makes sure that the body covers the entire window and needs to
12 12 be in a different element than the display: box in wrapper below */
13 13 position: absolute;
14 14 left: 0px;
15 15 right: 0px;
16 16 top: 0px;
17 17 bottom: 0px;
18 18 overflow: hidden;
19 19 }
20 20
21 21 span#save_widget {
22 22 position: absolute;
23 23 left: 0px;
24 24 padding: 5px 0px;
25 25 margin: 0px 0px 0px 0px;
26 26 }
27 27
28 28 input#notebook_name {
29 29 height: 1em;
30 30 line-height: 1em;
31 31 padding: 5px;
32 32 }
33 33
34 34 span#kernel_status {
35 35 position: absolute;
36 36 padding: 8px 5px 5px 5px;
37 37 right: 10px;
38 38 font-weight: bold;
39 39 }
40 40
41 41 .status_idle {
42 42 color: gray;
43 43 }
44 44
45 45 .status_busy {
46 46 color: red;
47 47 }
48 48
49 49 .status_restarting {
50 50 color: black;
51 51 }
52 52
53 53 div#left_panel {
54 54 overflow-y: auto;
55 55 top: 0px;
56 56 left: 0px;
57 57 margin: 0px;
58 58 padding: 0px;
59 59 position: absolute;
60 60 }
61 61
62 62 h3.section_header {
63 63 padding: 5px;
64 64 }
65 65
66 66 div.section_content {
67 67 padding: 5px;
68 68 }
69 69
70 70 span.section_row_buttons > button {
71 71 width: 70px;
72 72 }
73 73
74 74 .section_row {
75 75 margin: 5px 0px;
76 76 }
77 77
78 78 .section_row_buttons {
79 79 float: right;
80 80 }
81 81
82 82 #kernel_persist {
83 83 float: right;
84 84 }
85 85
86 86 .help_string {
87 87 float: right;
88 88 width: 170px;
89 89 padding: 0px 5px;
90 90 text-align: center;
91 91 }
92 92
93 93 .help_string_label {
94 94 float: right;
95 95 }
96 96
97 97 #autoindent_span {
98 98 float: right;
99 99 }
100 100
101 101 .checkbox_label {
102 102 font-size: 85%;
103 103 float: right;
104 104 padding: 0.3em;
105 105 }
106 106
107 107 .section_row_header {
108 108 float: left;
109 109 font-size: 85%;
110 110 padding: 0.4em 0em;
111 111 font-weight: bold;
112 112 }
113 113
114 114 span.button_label {
115 115 padding: 0.2em 1em;
116 116 font-size: 77%;
117 117 float: right;
118 118 }
119 119
120 120 /* This is needed because FF was adding a 2px margin top and bottom. */
121 121 .section_row .ui-button {
122 122 margin-top: 0px;
123 123 margin-bottom: 0px;
124 124 }
125 125
126 126 #download_format {
127 127 float: right;
128 128 font-size: 85%;
129 129 width: 62px;
130 130 margin: 1px 5px;
131 131 }
132 132
133 133 div#left_panel_splitter {
134 134 width: 8px;
135 135 top: 0px;
136 136 left: 202px;
137 137 margin: 0px;
138 138 padding: 0px;
139 139 position: absolute;
140 140 }
141 141
142 142 div#notebook_panel {
143 143 /* The L margin will be set in the Javascript code*/
144 144 margin: 0px 0px 0px 0px;
145 145 padding: 0px;
146 146 }
147 147
148 148 div#notebook {
149 149 overflow-y: scroll;
150 150 overflow-x: auto;
151 151 width: 100%;
152 152 /* This spaces the cell away from the edge of the notebook area */
153 153 padding: 15px 15px 15px 15px;
154 154 margin: 0px
155 155 background-color: white;
156 156 }
157 157
158 158 div#pager_splitter {
159 159 height: 8px;
160 160 }
161 161
162 162 div#pager {
163 163 padding: 15px;
164 164 overflow: auto;
165 165 }
166 166
167 167 div.cell {
168 168 width: 100%;
169 169 padding: 5px;
170 170 /* This acts as a spacer between cells, that is outside the border */
171 171 margin: 5px 0px 5px 0px;
172 172 }
173 173
174 174 div.code_cell {
175 175 background-color: white;
176 176 }
177 177
178 178 div.prompt {
179 179 /* No width is used so the prompt area can expand as the prompt number
180 180 increases in width */
181 181 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
182 182 padding: 0.4em;
183 183 margin: 0px;
184 184 font-family: monospace;
185 185 }
186 186
187 div.input {
188 page-break-inside: avoid;
189 }
190
187 191 div.input_area {
188 192 color: black;
189 193 }
190 194
191 195 div.input_prompt {
192 196 color: navy;
193 197 }
194 198
195 199 div.output {
196 200 /* This is a spacer between the input and output of each cell */
197 201 margin-top: 5px;
198 202 }
199 203
200 204 div.output_prompt {
201 205 color: darkred;
202 206 }
203 207
204 208 /* This class is applied to all types of output (pyout, pyerr, stream, display_data) */
205 209 div.output_area {
206 padding: 0px 0.4em
210 padding: 0px 0.4em;
211 page-break-inside: avoid;
207 212 }
208 213
209 214 /* This is the output area after the Out[] prompt of type pyout */
210 215 div.pyout_area {
211 216 padding: 0.4em;
212 217 }
213 218
214 219 /* The rest of the output_* classes are for special styling of the different
215 220 output types */
216 221
217 222 div.output_pyout {
218 223 padding: 0px;
219 224 }
220 225
221 226 div.output_stream {
222 227 text-align: left;
223 228 color: black;
224 229 font-family: monospace;
225 230 }
226 231
227 232 div.output_latex {
228 233 text-align: left;
229 234 color: black;
230 235 }
231 236
232 237 div.output_html {
233 238 }
234 239
235 240 div.output_png {
236 241 }
237 242
238 243 div.output_jpeg {
239 244 }
240 245
241 246 div.text_cell {
242 247 background-color: white;
243 248 }
244 249
245 250 div.text_cell_input {
246 251 color: black;
247 252 }
248 253
249 254 div.text_cell_render {
250 255 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
251 256 outline: none;
252 257 resize: none;
253 258 width: inherit;
254 259 border-style: none;
255 260 padding: 5px;
256 261 color: black;
257 262 }
258 263
259 264 .CodeMirror {
260 265 line-height: 1.231; /* Changed from 1em to our global default */
261 266 }
262 267
263 268 .CodeMirror-scroll {
264 269 height: auto; /* Changed to auto to autogrow */
265 270 overflow-y: visible; /* Changed from auto to remove scrollbar */
266 271 overflow-x: auto; /* Changed from auto to remove scrollbar */
267 272 }
268 273
269 274 /* CSS font colors for translated ANSI colors. */
270 275
271 276
272 277 .ansiblack {color: black;}
273 278 .ansired {color: darkred;}
274 279 .ansigreen {color: darkgreen;}
275 280 .ansiyellow {color: brown;}
276 281 .ansiblue {color: darkblue;}
277 282 .ansipurple {color: darkviolet;}
278 283 .ansicyan {color: steelblue;}
279 284 .ansigrey {color: grey;}
280 285 .ansibold {font-weight: bold;}
281 286
282 287 .completions {
283 288 position: absolute;
284 289 z-index: 10;
285 290 overflow: auto;
286 291 border: 1px solid black;
287 292 }
288 293
289 294 .completions select {
290 295 background: white;
291 296 outline: none;
292 297 border: none;
293 298 padding: 0px;
294 299 margin: 0px;
295 300 font-family: monospace;
296 301 }
297 302
303 @media print {
304 body { overflow: visible !important; }
305 .ui-widget-content { border: 0px; }
306 }
307
@@ -1,439 +1,439 b''
1 1 //----------------------------------------------------------------------------
2 2 // Copyright (C) 2008-2011 The IPython Development Team
3 3 //
4 4 // Distributed under the terms of the BSD License. The full license is in
5 5 // the file COPYING, distributed as part of this software.
6 6 //----------------------------------------------------------------------------
7 7
8 8 //============================================================================
9 9 // CodeCell
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var utils = IPython.utils;
15 15
16 16 var CodeCell = function (notebook) {
17 17 this.code_mirror = null;
18 18 this.input_prompt_number = ' ';
19 19 this.is_completing = false;
20 20 this.completion_cursor = null;
21 21 this.outputs = [];
22 22 this.collapsed = false;
23 23 IPython.Cell.apply(this, arguments);
24 24 };
25 25
26 26
27 27 CodeCell.prototype = new IPython.Cell();
28 28
29 29
30 30 CodeCell.prototype.create_element = function () {
31 31 var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox');
32 32 var input = $('<div></div>').addClass('input hbox');
33 33 input.append($('<div/>').addClass('prompt input_prompt'));
34 34 var input_area = $('<div/>').addClass('input_area box-flex1');
35 35 this.code_mirror = CodeMirror(input_area.get(0), {
36 36 indentUnit : 4,
37 37 mode: 'python',
38 38 theme: 'ipython',
39 39 onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
40 40 });
41 41 input.append(input_area);
42 42 var output = $('<div></div>').addClass('output vbox');
43 43 cell.append(input).append(output);
44 44 this.element = cell;
45 45 this.collapse()
46 46 };
47 47
48 48
49 49 CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) {
50 50 // This method gets called in CodeMirror's onKeyDown/onKeyPress handlers and
51 51 // is used to provide custom key handling. Its return value is used to determine
52 52 // if CodeMirror should ignore the event: true = ignore, false = don't ignore.
53 53 if (event.keyCode === 13 && event.shiftKey) {
54 54 // Always ignore shift-enter in CodeMirror as we handle it.
55 55 return true;
56 56 } else if (event.keyCode === 9 && event.type == 'keydown') {
57 57 // Tab completion.
58 58 var cur = editor.getCursor();
59 59 var pre_cursor = editor.getRange({line:cur.line,ch:0},cur).trim();
60 60 if (pre_cursor === "") {
61 61 // Don't autocomplete if the part of the line before the cursor is empty.
62 62 // In this case, let CodeMirror handle indentation.
63 63 return false;
64 64 } else {
65 65 // Autocomplete the current line.
66 66 event.stop();
67 67 var line = editor.getLine(cur.line);
68 68 this.is_completing = true;
69 69 this.completion_cursor = cur;
70 70 IPython.notebook.complete_cell(this, line, cur.ch);
71 71 return true;
72 72 }
73 73 } else if (event.keyCode === 8 && event.type == 'keydown') {
74 74 // If backspace and the line ends with 4 spaces, remove them.
75 75 var cur = editor.getCursor();
76 76 var line = editor.getLine(cur.line);
77 77 var ending = line.slice(-4);
78 78 if (ending === ' ') {
79 79 editor.replaceRange('',
80 80 {line: cur.line, ch: cur.ch-4},
81 81 {line: cur.line, ch: cur.ch}
82 82 );
83 83 event.stop();
84 84 return true;
85 85 } else {
86 86 return false;
87 87 };
88 88 } else {
89 89 // keypress/keyup also trigger on TAB press, and we don't want to use those
90 90 // to disable tab completion.
91 91 if (this.is_completing && event.keyCode !== 9) {
92 92 var ed_cur = editor.getCursor();
93 93 var cc_cur = this.completion_cursor;
94 94 if (ed_cur.line !== cc_cur.line || ed_cur.ch !== cc_cur.ch) {
95 95 this.is_completing = false;
96 96 this.completion_cursor = null;
97 97 };
98 98 };
99 99 return false;
100 100 };
101 101 };
102 102
103 103
104 104 CodeCell.prototype.finish_completing = function (matched_text, matches) {
105 105 // console.log("Got matches", matched_text, matches);
106 106 if (!this.is_completing || matches.length === 0) {return;}
107 107
108 108 var that = this;
109 109 var cur = this.completion_cursor;
110 110
111 111 var insert = function (selected_text) {
112 112 that.code_mirror.replaceRange(
113 113 selected_text,
114 114 {line: cur.line, ch: (cur.ch-matched_text.length)},
115 115 {line: cur.line, ch: cur.ch}
116 116 );
117 117 };
118 118
119 119 if (matches.length === 1) {
120 120 insert(matches[0]);
121 121 setTimeout(function(){that.code_mirror.focus();}, 50);
122 122 return;
123 123 };
124 124
125 125 var complete = $('<div/>').addClass('completions');
126 126 var select = $('<select/>').attr('multiple','true');
127 127 for (var i=0; i<matches.length; ++i) {
128 128 select.append($('<option/>').text(matches[i]));
129 129 }
130 130 select.children().first().attr('selected','true');
131 131 select.attr('size',Math.min(10,matches.length));
132 132 var pos = this.code_mirror.cursorCoords();
133 133 complete.css('left',pos.x+'px');
134 134 complete.css('top',pos.yBot+'px');
135 135 complete.append(select);
136 136
137 137 $('body').append(complete);
138 138 var done = false;
139 139
140 140 var close = function () {
141 141 if (done) return;
142 142 done = true;
143 143 complete.remove();
144 144 that.is_completing = false;
145 145 that.completion_cursor = null;
146 146 };
147 147
148 148 var pick = function () {
149 149 insert(select.val()[0]);
150 150 close();
151 151 setTimeout(function(){that.code_mirror.focus();}, 50);
152 152 };
153 153
154 154 select.blur(close);
155 155 select.keydown(function (event) {
156 156 var code = event.which;
157 157 if (code === 13 || code === 32) {
158 158 // Pressing SPACE or ENTER will cause a pick
159 159 event.stopPropagation();
160 160 event.preventDefault();
161 161 pick();
162 162 } else if (code === 38 || code === 40) {
163 163 // We don't want the document keydown handler to handle UP/DOWN,
164 164 // but we want the default action.
165 165 event.stopPropagation();
166 166 } else {
167 167 // All other key presses exit completion.
168 168 event.stopPropagation();
169 169 event.preventDefault();
170 170 close();
171 171 that.code_mirror.focus();
172 172 }
173 173 });
174 174 // Double click also causes a pick.
175 175 select.dblclick(pick);
176 176 select.focus();
177 177 };
178 178
179 179
180 180 CodeCell.prototype.select = function () {
181 181 IPython.Cell.prototype.select.apply(this);
182 182 // Todo: this dance is needed because as of CodeMirror 2.12, focus is
183 183 // not causing the cursor to blink if the editor is empty initially.
184 184 // While this seems to fix the issue, this should be fixed
185 185 // in CodeMirror proper.
186 186 var s = this.code_mirror.getValue();
187 187 this.code_mirror.focus();
188 188 if (s === '') this.code_mirror.setValue('');
189 189 };
190 190
191 191
192 192 CodeCell.prototype.append_output = function (json) {
193 193 this.expand();
194 194 if (json.output_type === 'pyout') {
195 195 this.append_pyout(json);
196 196 } else if (json.output_type === 'pyerr') {
197 197 this.append_pyerr(json);
198 198 } else if (json.output_type === 'display_data') {
199 199 this.append_display_data(json);
200 200 } else if (json.output_type === 'stream') {
201 201 this.append_stream(json);
202 202 };
203 203 this.outputs.push(json);
204 204 };
205 205
206 206
207 207 CodeCell.prototype.append_pyout = function (json) {
208 208 n = json.prompt_number || ' ';
209 var toinsert = $("<div/>").addClass("output_pyout hbox");
209 var toinsert = $("<div/>").addClass("output_pyout hbox output_area");
210 210 toinsert.append($('<div/>').
211 211 addClass('prompt output_prompt').
212 212 html('Out[' + n + ']:')
213 213 );
214 this.append_mime_type(json, toinsert).addClass('output_area');
214 this.append_mime_type(json, toinsert);
215 215 toinsert.children().last().addClass("box_flex1 pyout_area");
216 216 this.element.find("div.output").append(toinsert);
217 217 // If we just output latex, typeset it.
218 218 if (json.latex !== undefined) {
219 219 MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
220 220 };
221 221 };
222 222
223 223
224 224 CodeCell.prototype.append_pyerr = function (json) {
225 225 var tb = json.traceback;
226 226 if (tb !== undefined && tb.length > 0) {
227 227 var s = '';
228 228 var len = tb.length;
229 229 for (var i=0; i<len; i++) {
230 230 s = s + tb[i] + '\n';
231 231 }
232 232 s = s + '\n';
233 233 this.append_text(s).addClass('output_area');
234 234 };
235 235 };
236 236
237 237
238 238 CodeCell.prototype.append_stream = function (json) {
239 239 this.append_text(json.text).addClass('output_area');
240 240 };
241 241
242 242
243 243 CodeCell.prototype.append_display_data = function (json) {
244 244 this.append_mime_type(json).addClass('output_area');
245 245 // If we just output latex, typeset it.
246 246 if (json.latex !== undefined) {
247 247 MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
248 248 };
249 249 };
250 250
251 251
252 252 CodeCell.prototype.append_mime_type = function (json, element) {
253 253 element = element || this.element.find("div.output");
254 254 if (json.html !== undefined) {
255 this.append_html(json.html, element);
255 inserted = this.append_html(json.html, element);
256 256 } else if (json.latex !== undefined) {
257 this.append_latex(json.latex, element);
257 inserted = this.append_latex(json.latex, element);
258 258 } else if (json.svg !== undefined) {
259 this.append_svg(json.svg, element);
259 inserted = this.append_svg(json.svg, element);
260 260 } else if (json.png !== undefined) {
261 this.append_png(json.png, element);
261 inserted = this.append_png(json.png, element);
262 262 } else if (json.jpeg !== undefined) {
263 this.append_jpeg(json.jpeg, element);
263 inserted = this.append_jpeg(json.jpeg, element);
264 264 } else if (json.text !== undefined) {
265 this.append_text(json.text, element);
265 inserted = this.append_text(json.text, element);
266 266 };
267 return element;
267 return inserted;
268 268 };
269 269
270 270
271 271 CodeCell.prototype.append_html = function (html, element) {
272 272 element = element || this.element.find("div.output");
273 273 var toinsert = $("<div/>").addClass("output_html rendered_html");
274 274 toinsert.append(html);
275 275 element.append(toinsert);
276 return element;
276 return toinsert;
277 277 }
278 278
279 279
280 280 CodeCell.prototype.append_text = function (data, element) {
281 281 element = element || this.element.find("div.output");
282 282 var toinsert = $("<div/>").addClass("output_stream");
283 283 toinsert.append($("<pre/>").html(data));
284 284 element.append(toinsert);
285 return element;
285 return toinsert;
286 286 };
287 287
288 288
289 289 CodeCell.prototype.append_svg = function (svg, element) {
290 290 element = element || this.element.find("div.output");
291 291 var toinsert = $("<div/>").addClass("output_svg");
292 292 toinsert.append(svg);
293 293 element.append(toinsert);
294 return element;
294 return toinsert;
295 295 };
296 296
297 297
298 298 CodeCell.prototype.append_png = function (png, element) {
299 299 element = element || this.element.find("div.output");
300 300 var toinsert = $("<div/>").addClass("output_png");
301 301 toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png));
302 302 element.append(toinsert);
303 return element;
303 return toinsert;
304 304 };
305 305
306 306
307 307 CodeCell.prototype.append_jpeg = function (jpeg, element) {
308 308 element = element || this.element.find("div.output");
309 309 var toinsert = $("<div/>").addClass("output_jpeg");
310 310 toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg));
311 311 element.append(toinsert);
312 return element;
312 return toinsert;
313 313 };
314 314
315 315
316 316 CodeCell.prototype.append_latex = function (latex, element) {
317 317 // This method cannot do the typesetting because the latex first has to
318 318 // be on the page.
319 319 element = element || this.element.find("div.output");
320 320 var toinsert = $("<div/>").addClass("output_latex");
321 321 toinsert.append(latex);
322 322 element.append(toinsert);
323 return element;
323 return toinsert;
324 324 }
325 325
326 326
327 327 CodeCell.prototype.clear_output = function () {
328 328 this.element.find("div.output").html("");
329 329 this.outputs = [];
330 330 };
331 331
332 332
333 333 CodeCell.prototype.clear_input = function () {
334 334 this.code_mirror.setValue('');
335 335 };
336 336
337 337
338 338 CodeCell.prototype.collapse = function () {
339 339 if (!this.collapsed) {
340 340 this.element.find('div.output').hide();
341 341 this.collapsed = true;
342 342 };
343 343 };
344 344
345 345
346 346 CodeCell.prototype.expand = function () {
347 347 if (this.collapsed) {
348 348 this.element.find('div.output').show();
349 349 this.collapsed = false;
350 350 };
351 351 };
352 352
353 353
354 354 CodeCell.prototype.set_input_prompt = function (number) {
355 355 var n = number || ' ';
356 356 this.input_prompt_number = n
357 357 this.element.find('div.input_prompt').html('In&nbsp;[' + n + ']:');
358 358 };
359 359
360 360
361 361 CodeCell.prototype.get_code = function () {
362 362 return this.code_mirror.getValue();
363 363 };
364 364
365 365
366 366 CodeCell.prototype.set_code = function (code) {
367 367 return this.code_mirror.setValue(code);
368 368 };
369 369
370 370
371 371 CodeCell.prototype.at_top = function () {
372 372 var cursor = this.code_mirror.getCursor();
373 373 if (cursor.line === 0) {
374 374 return true;
375 375 } else {
376 376 return false;
377 377 }
378 378 };
379 379
380 380
381 381 CodeCell.prototype.at_bottom = function () {
382 382 var cursor = this.code_mirror.getCursor();
383 383 if (cursor.line === (this.code_mirror.lineCount()-1)) {
384 384 return true;
385 385 } else {
386 386 return false;
387 387 }
388 388 };
389 389
390 390
391 391 CodeCell.prototype.fromJSON = function (data) {
392 392 // console.log('Import from JSON:', data);
393 393 if (data.cell_type === 'code') {
394 394 if (data.input !== undefined) {
395 395 this.set_code(data.input);
396 396 }
397 397 if (data.prompt_number !== undefined) {
398 398 this.set_input_prompt(data.prompt_number);
399 399 } else {
400 400 this.set_input_prompt();
401 401 };
402 402 var len = data.outputs.length;
403 403 for (var i=0; i<len; i++) {
404 404 this.append_output(data.outputs[i]);
405 405 };
406 406 if (data.collapsed !== undefined) {
407 407 if (data.collapsed) {
408 408 this.collapse();
409 409 };
410 410 };
411 411 };
412 412 };
413 413
414 414
415 415 CodeCell.prototype.toJSON = function () {
416 416 var data = {};
417 417 data.input = this.get_code();
418 418 data.cell_type = 'code';
419 419 if (this.input_prompt_number !== ' ') {
420 420 data.prompt_number = this.input_prompt_number
421 421 };
422 422 var outputs = [];
423 423 var len = this.outputs.length;
424 424 for (var i=0; i<len; i++) {
425 425 outputs[i] = this.outputs[i];
426 426 };
427 427 data.outputs = outputs;
428 428 data.language = 'python';
429 429 data.collapsed = this.collapsed;
430 430 // console.log('Export to JSON:',data);
431 431 return data;
432 432 };
433 433
434 434
435 435 IPython.CodeCell = CodeCell;
436 436
437 437 return IPython;
438 438 }(IPython));
439 439
@@ -1,54 +1,54 b''
1 1 var IPython = (function (IPython) {
2 2
3 3 var PrintWidget = function (selector) {
4 4 this.selector = selector;
5 5 if (this.selector !== undefined) {
6 6 this.element = $(selector);
7 7 this.style();
8 8 this.bind_events();
9 9 }
10 10 };
11 11
12 12 PrintWidget.prototype.style = function () {
13 13 this.element.find('button#print_notebook').button();
14 14 };
15 15
16 16 PrintWidget.prototype.bind_events = function () {
17 17 var that = this;
18 18 this.element.find('button#print_notebook').click(function () {
19 19 that.print_notebook();
20 20 });
21 21 };
22 22
23 23 PrintWidget.prototype.enable = function () {
24 24 this.element.find('button#print_notebook').button('enable');
25 25 };
26 26
27 27 PrintWidget.prototype.disable = function () {
28 28 this.element.find('button#print_notebook').button('disable');
29 29 };
30 30
31 31 PrintWidget.prototype.print_notebook = function () {
32 32 var w = window.open('', '_blank', 'scrollbars=1,menubar=1');
33 33 var html = '<html><head>' +
34 34 $('head').clone().html() +
35 35 '<style type="text/css">' +
36 36 '@media print { body { overflow: visible !important; } }' +
37 37 '.ui-widget-content { border: 0px; }' +
38 38 '</style>' +
39 39 '</head><body style="overflow: auto;">' +
40 40 $('#notebook').clone().html() +
41 41 '</body></html>';
42 42
43 43 w.document.open();
44 44 w.document.write(html);
45 45 w.document.close();
46 46
47 47 return false;
48 48 };
49 49
50 50 IPython.PrintWidget = PrintWidget;
51 51
52 52 return IPython;
53 53
54 }(IPython)); No newline at end of file
54 }(IPython));
@@ -1,229 +1,229 b''
1 1 <!DOCTYPE HTML>
2 2 <html>
3 3
4 4 <head>
5 5 <meta charset="utf-8">
6 6
7 7 <title>IPython Notebook</title>
8 8
9 9 <link rel="stylesheet" href="static/jquery/css/themes/aristo/jquery-wijmo.css" type="text/css" />
10 10 <!-- <link rel="stylesheet" href="static/jquery/css/themes/rocket/jquery-wijmo.css" type="text/css" /> -->
11 11 <!-- <link rel="stylesheet" href="static/jquery/css/themes/smoothness/jquery-ui-1.8.14.custom.css" type="text/css" />-->
12 12
13 13 <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script>
14 14 <!-- <script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script> -->
15 15 <script type="text/javascript">
16 16 if (typeof MathJax == 'undefined') {
17 17 console.log("Trying to load local copy of MathJax");
18 18 document.write(unescape("%3Cscript type='text/javascript' src='static/mathjax/MathJax.js%3Fconfig=TeX-AMS_HTML' charset='utf-8'%3E%3C/script%3E"));
19 19 }
20 20 </script>
21 21
22 22 <link rel="stylesheet" href="static/codemirror-2.12/lib/codemirror.css">
23 23 <link rel="stylesheet" href="static/codemirror-2.12/mode/rst/rst.css">
24 24 <link rel="stylesheet" href="static/codemirror-2.12/theme/ipython.css">
25 25 <link rel="stylesheet" href="static/codemirror-2.12/theme/default.css">
26 26
27 27 <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
28 28 <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
29 29 <link rel="stylesheet" href="static/css/base.css" type="text/css" />
30 30 <link rel="stylesheet" href="static/css/notebook.css" type="text/css" />
31 31 <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" />
32 32
33 33
34 34 </head>
35 35
36 36 <body>
37 37
38 38 <div id="header">
39 39 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
40 40 <span id="save_widget">
41 41 <input type="text" id="notebook_name" size="20"></textarea>
42 42 <span id="notebook_id" style="display:none">{{notebook_id}}</span>
43 43 <button id="save_notebook">Save</button>
44 44 </span>
45 45 <span id="kernel_status">Idle</span>
46 46 </div>
47 47
48 48 <div id="main_app">
49 49
50 50 <div id="left_panel">
51 51
52 52 <div id="notebook_section">
53 53 <h3 class="section_header">Notebook</h3>
54 54 <div class="section_content">
55 55 <div class="section_row">
56 56 <span id="new_open" class="section_row_buttons">
57 57 <button id="new_notebook">New</button>
58 58 <button id="open_notebook">Open</button>
59 59 </span>
60 60 <span class="section_row_header">Actions</span>
61 61 </div>
62 62 <div class="section_row">
63 63 <span>
64 64 <select id="download_format">
65 65 <option value="xml">xml</option>
66 66 <option value="json">json</option>
67 67 <option value="py">py</option>
68 68 </select>
69 69 </span>
70 70 <span class="section_row_buttons">
71 71 <span id="print_widget">
72 <button id="print_notebook">Print/HTML</button>
72 <button id="print_notebook">Print</button>
73 73 </span>
74 74
75 75 <button id="download_notebook">Export</button>
76 76 </span>
77 77 </div>
78 78 </div>
79 79 </div>
80 80
81 81 <div id="cell_section">
82 82 <h3 class="section_header">Cell</h3>
83 83 <div class="section_content">
84 84 <div class="section_row">
85 85 <span class="section_row_buttons">
86 86 <button id="delete_cell">Delete</button>
87 87 </span>
88 88 <span class="section_row_header">Actions</span>
89 89 </div>
90 90 <div class="section_row">
91 91 <span id="cell_type" class="section_row_buttons">
92 92 <button id="to_code">Code</button>
93 93 <!-- <button id="to_html">HTML</button>-->
94 94 <button id="to_markdown">Markdown</button>
95 95 </span>
96 96 <span class="button_label">Format</span>
97 97 </div>
98 98 <div class="section_row">
99 99 <span id="toggle_output" class="section_row_buttons">
100 100 <button id="collapse_cell">Collapse</button>
101 101 <button id="expand_cell">Expand</button>
102 102 <button id="clear_all_output">ClearAll</button>
103 103 </span>
104 104 <span class="button_label">Output</span>
105 105 </div>
106 106 <div class="section_row">
107 107 <span id="insert" class="section_row_buttons">
108 108 <button id="insert_cell_above">Above</button>
109 109 <button id="insert_cell_below">Below</button>
110 110 </span>
111 111 <span class="button_label">Insert</span>
112 112 </div>
113 113 <div class="section_row">
114 114 <span id="move" class="section_row_buttons">
115 115 <button id="move_cell_up">Up</button>
116 116 <button id="move_cell_down">Down</button>
117 117 </span>
118 118 <span class="button_label">Move</span>
119 119 </div>
120 120 <div class="section_row">
121 121 <span id="run_cells" class="section_row_buttons">
122 122 <button id="run_selected_cell">Selected</button>
123 123 <button id="run_all_cells">All</button>
124 124 </span>
125 125 <span class="button_label">Run</span>
126 126 </div>
127 127 <div class="section_row">
128 128 <span id="autoindent_span">
129 129 <input type="checkbox" id="autoindent" checked="true"></input>
130 130 </span>
131 131 <span class="checkbox_label">Autoindent:</span>
132 132 </div>
133 133 </div>
134 134 </div>
135 135
136 136 <div id="kernel_section">
137 137 <h3 class="section_header">Kernel</h3>
138 138 <div class="section_content">
139 139 <div class="section_row">
140 140 <span id="int_restart" class="section_row_buttons">
141 141 <button id="int_kernel">Interrupt</button>
142 142 <button id="restart_kernel">Restart</button>
143 143 </span>
144 144 <span class="section_row_header">Actions</span>
145 145 </div>
146 146 <div class="section_row">
147 147 <span id="kernel_persist">
148 148 <input type="checkbox" id="kill_kernel"></input>
149 149 </span>
150 150 <span class="checkbox_label">Kill kernel upon exit:</span>
151 151 </div>
152 152 </div>
153 153 </div>
154 154
155 155 <div id="help_section">
156 156 <h3 class="section_header">Help</h3>
157 157 <div class="section_content">
158 158 <div class="section_row">
159 159 <span id="help_buttons0" class="section_row_buttons">
160 160 <button id="python_help"><a href="http://docs.python.org" target="_blank">Python</a></button>
161 161 <button id="ipython_help"><a href="http://ipython.org/documentation.html" target="_blank">IPython</a></button>
162 162 <button id="numpy_help"><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button>
163 163 </span>
164 164 <span class="section_row_header">Links</span>
165 165 </div>
166 166 <div class="section_row">
167 167 <span id="help_buttons1" class="section_row_buttons">
168 168 <button id="matplotlib_help"><a href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a></button>
169 169 <button id="scipy_help"><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button>
170 170 <button id="sympy_help"><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button>
171 171 </span>
172 172 </div>
173 173 <div class="section_row">
174 174 <span class="help_string">run selected cell</span>
175 175 <span class="help_string_label">Shift-Enter |</span>
176 176 </div>
177 177 <div class="section_row">
178 178 <span class="help_string">run in terminal mode</span>
179 179 <span class="help_string_label">Ctrl-Enter |</span>
180 180 </div>
181 181 </div>
182 182 </div>
183 183
184 184 </div>
185 185 <div id="left_panel_splitter"></div>
186 186 <div id="notebook_panel">
187 187 <div id="notebook"></div>
188 188 <div id="pager_splitter"></div>
189 189 <div id="pager"></div>
190 190 </div>
191 191
192 192 </div>
193 193
194 194 <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
195 195 <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
196 196 <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script>
197 197
198 198 <script src="static/codemirror-2.12/lib/codemirror.js" charset="utf-8"></script>
199 199 <script src="static/codemirror-2.12/mode/python/python.js" charset="utf-8"></script>
200 200 <script src="static/codemirror-2.12/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script>
201 201 <script src="static/codemirror-2.12/mode/xml/xml.js" charset="utf-8"></script>
202 202 <script src="static/codemirror-2.12/mode/javascript/javascript.js" charset="utf-8"></script>
203 203 <script src="static/codemirror-2.12/mode/css/css.js" charset="utf-8"></script>
204 204 <script src="static/codemirror-2.12/mode/rst/rst.js" charset="utf-8"></script>
205 205
206 206 <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script>
207 207
208 208 <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
209 209 <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script>
210 210 <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script>
211 211 <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script>
212 212 <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script>
213 213 <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script>
214 214 <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script>
215 215 <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script>
216 216 <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script>
217 217 <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script>
218 218 <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script>
219 219 <script src="static/js/printwidget.js" type="text/javascript" charset="utf-8"></script>
220 220 <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script>
221 221 <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script>
222 222 <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script>
223 223
224 224
225 225 </body>
226 226
227 227 </html>
228 228
229 229
General Comments 0
You need to be logged in to leave comments. Login now