Show More
@@ -0,0 +1,54 b'' | |||||
|
1 | var IPython = (function (IPython) { | |||
|
2 | ||||
|
3 | var PrintWidget = function (selector) { | |||
|
4 | this.selector = selector; | |||
|
5 | if (this.selector !== undefined) { | |||
|
6 | this.element = $(selector); | |||
|
7 | this.style(); | |||
|
8 | this.bind_events(); | |||
|
9 | } | |||
|
10 | }; | |||
|
11 | ||||
|
12 | PrintWidget.prototype.style = function () { | |||
|
13 | this.element.find('button#print_notebook').button(); | |||
|
14 | }; | |||
|
15 | ||||
|
16 | PrintWidget.prototype.bind_events = function () { | |||
|
17 | var that = this; | |||
|
18 | this.element.find('button#print_notebook').click(function () { | |||
|
19 | that.print_notebook(); | |||
|
20 | }); | |||
|
21 | }; | |||
|
22 | ||||
|
23 | PrintWidget.prototype.enable = function () { | |||
|
24 | this.element.find('button#print_notebook').button('enable'); | |||
|
25 | }; | |||
|
26 | ||||
|
27 | PrintWidget.prototype.disable = function () { | |||
|
28 | this.element.find('button#print_notebook').button('disable'); | |||
|
29 | }; | |||
|
30 | ||||
|
31 | PrintWidget.prototype.print_notebook = function () { | |||
|
32 | var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); | |||
|
33 | var html = '<html><head>' + | |||
|
34 | $('head').clone().html() + | |||
|
35 | '<style type="text/css">' + | |||
|
36 | '@media print { body { overflow: visible !important; } }' + | |||
|
37 | '.ui-widget-content { border: 0px; }' + | |||
|
38 | '</style>' + | |||
|
39 | '</head><body style="overflow: auto;">' + | |||
|
40 | $('#notebook').clone().html() + | |||
|
41 | '</body></html>'; | |||
|
42 | ||||
|
43 | w.document.open(); | |||
|
44 | w.document.write(html); | |||
|
45 | w.document.close(); | |||
|
46 | ||||
|
47 | return false; | |||
|
48 | }; | |||
|
49 | ||||
|
50 | IPython.PrintWidget = PrintWidget; | |||
|
51 | ||||
|
52 | return IPython; | |||
|
53 | ||||
|
54 | }(IPython)); |
@@ -184,6 +184,10 b' div.prompt {' | |||||
184 | font-family: monospace; |
|
184 | font-family: monospace; | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
|
187 | div.input { | |||
|
188 | page-break-inside: avoid; | |||
|
189 | } | |||
|
190 | ||||
187 | div.input_area { |
|
191 | div.input_area { | |
188 | color: black; |
|
192 | color: black; | |
189 | } |
|
193 | } | |
@@ -203,7 +207,8 b' div.output_prompt {' | |||||
203 |
|
207 | |||
204 | /* This class is applied to all types of output (pyout, pyerr, stream, display_data) */ |
|
208 | /* This class is applied to all types of output (pyout, pyerr, stream, display_data) */ | |
205 | div.output_area { |
|
209 | div.output_area { | |
206 | padding: 0px 0.4em |
|
210 | padding: 0px 0.4em; | |
|
211 | page-break-inside: avoid; | |||
207 | } |
|
212 | } | |
208 |
|
213 | |||
209 | /* This is the output area after the Out[] prompt of type pyout */ |
|
214 | /* This is the output area after the Out[] prompt of type pyout */ | |
@@ -295,3 +300,8 b' div.text_cell_render {' | |||||
295 | font-family: monospace; |
|
300 | font-family: monospace; | |
296 | } |
|
301 | } | |
297 |
|
302 | |||
|
303 | @media print { | |||
|
304 | body { overflow: visible !important; } | |||
|
305 | .ui-widget-content { border: 0px; } | |||
|
306 | } | |||
|
307 |
@@ -206,12 +206,12 b' var IPython = (function (IPython) {' | |||||
206 |
|
206 | |||
207 | CodeCell.prototype.append_pyout = function (json) { |
|
207 | CodeCell.prototype.append_pyout = function (json) { | |
208 | n = json.prompt_number || ' '; |
|
208 | n = json.prompt_number || ' '; | |
209 | var toinsert = $("<div/>").addClass("output_pyout hbox"); |
|
209 | var toinsert = $("<div/>").addClass("output_pyout hbox output_area"); | |
210 | toinsert.append($('<div/>'). |
|
210 | toinsert.append($('<div/>'). | |
211 | addClass('prompt output_prompt'). |
|
211 | addClass('prompt output_prompt'). | |
212 | html('Out[' + n + ']:') |
|
212 | html('Out[' + n + ']:') | |
213 | ); |
|
213 | ); | |
214 |
this.append_mime_type(json, toinsert) |
|
214 | this.append_mime_type(json, toinsert); | |
215 | toinsert.children().last().addClass("box_flex1 pyout_area"); |
|
215 | toinsert.children().last().addClass("box_flex1 pyout_area"); | |
216 | this.element.find("div.output").append(toinsert); |
|
216 | this.element.find("div.output").append(toinsert); | |
217 | // If we just output latex, typeset it. |
|
217 | // If we just output latex, typeset it. | |
@@ -252,19 +252,19 b' var IPython = (function (IPython) {' | |||||
252 | CodeCell.prototype.append_mime_type = function (json, element) { |
|
252 | CodeCell.prototype.append_mime_type = function (json, element) { | |
253 | element = element || this.element.find("div.output"); |
|
253 | element = element || this.element.find("div.output"); | |
254 | if (json.html !== undefined) { |
|
254 | if (json.html !== undefined) { | |
255 | this.append_html(json.html, element); |
|
255 | inserted = this.append_html(json.html, element); | |
256 | } else if (json.latex !== undefined) { |
|
256 | } else if (json.latex !== undefined) { | |
257 | this.append_latex(json.latex, element); |
|
257 | inserted = this.append_latex(json.latex, element); | |
258 | } else if (json.svg !== undefined) { |
|
258 | } else if (json.svg !== undefined) { | |
259 | this.append_svg(json.svg, element); |
|
259 | inserted = this.append_svg(json.svg, element); | |
260 | } else if (json.png !== undefined) { |
|
260 | } else if (json.png !== undefined) { | |
261 | this.append_png(json.png, element); |
|
261 | inserted = this.append_png(json.png, element); | |
262 | } else if (json.jpeg !== undefined) { |
|
262 | } else if (json.jpeg !== undefined) { | |
263 | this.append_jpeg(json.jpeg, element); |
|
263 | inserted = this.append_jpeg(json.jpeg, element); | |
264 | } else if (json.text !== undefined) { |
|
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 |
|
267 | return inserted; | |
268 | }; |
|
268 | }; | |
269 |
|
269 | |||
270 |
|
270 | |||
@@ -273,7 +273,7 b' var IPython = (function (IPython) {' | |||||
273 | var toinsert = $("<div/>").addClass("output_html rendered_html"); |
|
273 | var toinsert = $("<div/>").addClass("output_html rendered_html"); | |
274 | toinsert.append(html); |
|
274 | toinsert.append(html); | |
275 | element.append(toinsert); |
|
275 | element.append(toinsert); | |
276 |
return |
|
276 | return toinsert; | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 |
|
279 | |||
@@ -282,7 +282,7 b' var IPython = (function (IPython) {' | |||||
282 | var toinsert = $("<div/>").addClass("output_stream"); |
|
282 | var toinsert = $("<div/>").addClass("output_stream"); | |
283 | toinsert.append($("<pre/>").html(data)); |
|
283 | toinsert.append($("<pre/>").html(data)); | |
284 | element.append(toinsert); |
|
284 | element.append(toinsert); | |
285 |
return |
|
285 | return toinsert; | |
286 | }; |
|
286 | }; | |
287 |
|
287 | |||
288 |
|
288 | |||
@@ -291,7 +291,7 b' var IPython = (function (IPython) {' | |||||
291 | var toinsert = $("<div/>").addClass("output_svg"); |
|
291 | var toinsert = $("<div/>").addClass("output_svg"); | |
292 | toinsert.append(svg); |
|
292 | toinsert.append(svg); | |
293 | element.append(toinsert); |
|
293 | element.append(toinsert); | |
294 |
return |
|
294 | return toinsert; | |
295 | }; |
|
295 | }; | |
296 |
|
296 | |||
297 |
|
297 | |||
@@ -300,7 +300,7 b' var IPython = (function (IPython) {' | |||||
300 | var toinsert = $("<div/>").addClass("output_png"); |
|
300 | var toinsert = $("<div/>").addClass("output_png"); | |
301 | toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png)); |
|
301 | toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png)); | |
302 | element.append(toinsert); |
|
302 | element.append(toinsert); | |
303 |
return |
|
303 | return toinsert; | |
304 | }; |
|
304 | }; | |
305 |
|
305 | |||
306 |
|
306 | |||
@@ -309,7 +309,7 b' var IPython = (function (IPython) {' | |||||
309 | var toinsert = $("<div/>").addClass("output_jpeg"); |
|
309 | var toinsert = $("<div/>").addClass("output_jpeg"); | |
310 | toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg)); |
|
310 | toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg)); | |
311 | element.append(toinsert); |
|
311 | element.append(toinsert); | |
312 |
return |
|
312 | return toinsert; | |
313 | }; |
|
313 | }; | |
314 |
|
314 | |||
315 |
|
315 | |||
@@ -320,7 +320,7 b' var IPython = (function (IPython) {' | |||||
320 | var toinsert = $("<div/>").addClass("output_latex"); |
|
320 | var toinsert = $("<div/>").addClass("output_latex"); | |
321 | toinsert.append(latex); |
|
321 | toinsert.append(latex); | |
322 | element.append(toinsert); |
|
322 | element.append(toinsert); | |
323 |
return |
|
323 | return toinsert; | |
324 | } |
|
324 | } | |
325 |
|
325 | |||
326 |
|
326 |
@@ -32,6 +32,7 b' $(document).ready(function () {' | |||||
32 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); |
|
32 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); | |
33 | IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); |
|
33 | IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); | |
34 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
34 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |
|
35 | IPython.print_widget = new IPython.PrintWidget('span#print_widget'); | |||
35 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
36 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
36 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); |
|
37 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); | |
37 | IPython.kernel_status_widget.status_idle(); |
|
38 | IPython.kernel_status_widget.status_idle(); |
@@ -90,20 +90,23 b' var IPython = (function (IPython) {' | |||||
90 |
|
90 | |||
91 |
|
91 | |||
92 | SaveWidget.prototype.status_save = function () { |
|
92 | SaveWidget.prototype.status_save = function () { | |
93 |
this.element.find(' |
|
93 | this.element.find('button#save_notebook').button('option', 'label', 'Save'); | |
94 | this.element.find('button#save_notebook').button('enable'); |
|
94 | this.element.find('button#save_notebook').button('enable'); | |
95 | }; |
|
95 | IPython.print_widget.enable(); | |
|
96 | }; | |||
96 |
|
97 | |||
97 |
|
98 | |||
98 | SaveWidget.prototype.status_saving = function () { |
|
99 | SaveWidget.prototype.status_saving = function () { | |
99 |
this.element.find(' |
|
100 | this.element.find('button#save_notebook').button('option', 'label', 'Saving'); | |
100 | this.element.find('button#save_notebook').button('disable'); |
|
101 | this.element.find('button#save_notebook').button('disable'); | |
101 | }; |
|
102 | IPython.print_widget.disable(); | |
|
103 | }; | |||
102 |
|
104 | |||
103 |
|
105 | |||
104 | SaveWidget.prototype.status_loading = function () { |
|
106 | SaveWidget.prototype.status_loading = function () { | |
105 |
this.element.find(' |
|
107 | this.element.find('button#save_notebook').button('option', 'label', 'Loading'); | |
106 | this.element.find('button#save_notebook').button('disable'); |
|
108 | this.element.find('button#save_notebook').button('disable'); | |
|
109 | IPython.print_widget.disable(); | |||
107 | }; |
|
110 | }; | |
108 |
|
111 | |||
109 |
|
112 |
@@ -68,6 +68,10 b'' | |||||
68 | </select> |
|
68 | </select> | |
69 | </span> |
|
69 | </span> | |
70 | <span class="section_row_buttons"> |
|
70 | <span class="section_row_buttons"> | |
|
71 | <span id="print_widget"> | |||
|
72 | <button id="print_notebook">Print</button> | |||
|
73 | </span> | |||
|
74 | ||||
71 | <button id="download_notebook">Export</button> |
|
75 | <button id="download_notebook">Export</button> | |
72 | </span> |
|
76 | </span> | |
73 | </div> |
|
77 | </div> | |
@@ -212,6 +216,7 b'' | |||||
212 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
216 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |
213 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
217 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> | |
214 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> |
|
218 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> | |
|
219 | <script src="static/js/printwidget.js" type="text/javascript" charset="utf-8"></script> | |||
215 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> |
|
220 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> | |
216 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
221 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |
217 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
|
222 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
General Comments 0
You need to be logged in to leave comments.
Login now