Show More
@@ -1,147 +1,147 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 | // SaveWidget |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var utils = IPython.utils; |
|
15 | 15 | |
|
16 | 16 | var SaveWidget = function (selector) { |
|
17 | 17 | this.selector = selector; |
|
18 | 18 | this.notebook_name_re = /[^/\\]+/ |
|
19 | 19 | this.last_saved_name = ''; |
|
20 | 20 | if (this.selector !== undefined) { |
|
21 | 21 | this.element = $(selector); |
|
22 | 22 | this.style(); |
|
23 | 23 | this.bind_events(); |
|
24 | 24 | } |
|
25 | 25 | }; |
|
26 | 26 | |
|
27 | 27 | |
|
28 | 28 | SaveWidget.prototype.style = function () { |
|
29 | 29 | this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); |
|
30 | 30 | this.element.find('input#notebook_name').attr('tabindex','1'); |
|
31 | 31 | this.element.find('button#save_notebook').button(); |
|
32 | 32 | var left_panel_width = $('div#left_panel').outerWidth(); |
|
33 | 33 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); |
|
34 | 34 | $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); |
|
35 | 35 | |
|
36 | 36 | }; |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | SaveWidget.prototype.bind_events = function () { |
|
40 | 40 | var that = this; |
|
41 | 41 | this.element.find('button#save_notebook').click(function () { |
|
42 | 42 | that.save_notebook(); |
|
43 | 43 | }); |
|
44 | 44 | this.element.find('input#notebook_name').keyup(function () { |
|
45 | 45 | that.is_renaming(); |
|
46 | 46 | }); |
|
47 | 47 | }; |
|
48 | 48 | |
|
49 | 49 | |
|
50 | 50 | SaveWidget.prototype.save_notebook = function () { |
|
51 | 51 | IPython.notebook.save_notebook(); |
|
52 | 52 | this.set_document_title(); |
|
53 | 53 | this.last_saved_name = this.get_notebook_name(); |
|
54 | 54 | }; |
|
55 | 55 | |
|
56 | 56 | |
|
57 | 57 | SaveWidget.prototype.is_renaming = function () { |
|
58 | 58 | if (this.get_notebook_name() !== this.last_saved_name) { |
|
59 | 59 | this.status_rename(); |
|
60 | 60 | } else { |
|
61 | 61 | this.status_save(); |
|
62 | 62 | }; |
|
63 | 63 | }; |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | SaveWidget.prototype.get_notebook_name = function () { |
|
67 | 67 | return this.element.find('input#notebook_name').attr('value'); |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | |
|
71 | 71 | SaveWidget.prototype.set_notebook_name = function (nbname) { |
|
72 | 72 | this.element.find('input#notebook_name').attr('value',nbname); |
|
73 | 73 | this.set_document_title(); |
|
74 | 74 | this.last_saved_name = nbname; |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | |
|
78 | 78 | SaveWidget.prototype.set_document_title = function () { |
|
79 | 79 | nbname = this.get_notebook_name(); |
|
80 | 80 | document.title = 'IPy: ' + nbname; |
|
81 | 81 | }; |
|
82 | 82 | |
|
83 | 83 | |
|
84 | 84 | SaveWidget.prototype.get_notebook_id = function () { |
|
85 | 85 | return this.element.find('span#notebook_id').text() |
|
86 | 86 | }; |
|
87 | 87 | |
|
88 | 88 | |
|
89 | 89 | SaveWidget.prototype.update_url = function () { |
|
90 | 90 | var notebook_id = this.get_notebook_id(); |
|
91 | 91 | if (notebook_id !== '') { |
|
92 | 92 | window.history.replaceState({}, '', notebook_id); |
|
93 | 93 | }; |
|
94 | 94 | }; |
|
95 | 95 | |
|
96 | 96 | |
|
97 | 97 | SaveWidget.prototype.test_notebook_name = function () { |
|
98 | 98 | var nbname = this.get_notebook_name(); |
|
99 | 99 | if (this.notebook_name_re.test(nbname)) { |
|
100 | 100 | return true; |
|
101 | 101 | } else { |
|
102 | 102 | var bad_name = $('<div/>'); |
|
103 | 103 | bad_name.html( |
|
104 | 104 | "The notebook name you entered (" + |
|
105 | 105 | nbname + |
|
106 | 106 | ") is not valid. Notebook names can contain any characters except / and \\" |
|
107 | 107 | ); |
|
108 | 108 | bad_name.dialog({title: 'Invalid name', modal: true}); |
|
109 | 109 | return false; |
|
110 | 110 | }; |
|
111 | 111 | }; |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | SaveWidget.prototype.status_save = function () { |
|
115 | this.element.find('button#save_notebook').button('option', 'label', 'Save'); | |
|
115 | this.element.find('button#save_notebook').button('option', 'label', '<u>S</u>ave'); | |
|
116 | 116 | this.element.find('button#save_notebook').button('enable'); |
|
117 | 117 | IPython.print_widget.enable(); |
|
118 | 118 | }; |
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | SaveWidget.prototype.status_saving = function () { |
|
122 | 122 | this.element.find('button#save_notebook').button('option', 'label', 'Saving'); |
|
123 | 123 | this.element.find('button#save_notebook').button('disable'); |
|
124 | 124 | IPython.print_widget.disable(); |
|
125 | 125 | }; |
|
126 | 126 | |
|
127 | 127 | |
|
128 | 128 | SaveWidget.prototype.status_loading = function () { |
|
129 | 129 | this.element.find('button#save_notebook').button('option', 'label', 'Loading'); |
|
130 | 130 | this.element.find('button#save_notebook').button('disable'); |
|
131 | 131 | IPython.print_widget.disable(); |
|
132 | 132 | }; |
|
133 | 133 | |
|
134 | 134 | |
|
135 | 135 | SaveWidget.prototype.status_rename = function () { |
|
136 | 136 | this.element.find('button#save_notebook').button('option', 'label', 'Rename'); |
|
137 | 137 | this.element.find('button#save_notebook').button('enable'); |
|
138 | 138 | IPython.print_widget.enable(); |
|
139 | 139 | }; |
|
140 | 140 | |
|
141 | 141 | |
|
142 | 142 | IPython.SaveWidget = SaveWidget; |
|
143 | 143 | |
|
144 | 144 | return IPython; |
|
145 | 145 | |
|
146 | 146 | }(IPython)); |
|
147 | 147 |
@@ -1,242 +1,242 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/prettify/prettify.css"/> |
|
28 | 28 | |
|
29 | 29 | <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" /> |
|
30 | 30 | <link rel="stylesheet" href="static/css/layout.css" type="text/css" /> |
|
31 | 31 | <link rel="stylesheet" href="static/css/base.css" type="text/css" /> |
|
32 | 32 | <link rel="stylesheet" href="static/css/notebook.css" type="text/css" /> |
|
33 | 33 | <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" /> |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | </head> |
|
37 | 37 | |
|
38 | 38 | <body> |
|
39 | 39 | |
|
40 | 40 | <div id="header"> |
|
41 | 41 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> |
|
42 | 42 | <span id="save_widget"> |
|
43 | 43 | <input type="text" id="notebook_name" size="20"></textarea> |
|
44 | 44 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> |
|
45 | <button id="save_notebook">Save</button> | |
|
45 | <button id="save_notebook"><u>S</u>ave</button> | |
|
46 | 46 | </span> |
|
47 | 47 | <span id="kernel_status">Idle</span> |
|
48 | 48 | </div> |
|
49 | 49 | |
|
50 | 50 | <div id="main_app"> |
|
51 | 51 | |
|
52 | 52 | <div id="left_panel"> |
|
53 | 53 | |
|
54 | 54 | <div id="notebook_section"> |
|
55 | 55 | <h3 class="section_header">Notebook</h3> |
|
56 | 56 | <div class="section_content"> |
|
57 | 57 | <div class="section_row"> |
|
58 | 58 | <span id="new_open" class="section_row_buttons"> |
|
59 | 59 | <button id="new_notebook">New</button> |
|
60 | 60 | <button id="open_notebook">Open</button> |
|
61 | 61 | </span> |
|
62 | 62 | <span class="section_row_header">Actions</span> |
|
63 | 63 | </div> |
|
64 | 64 | <div class="section_row"> |
|
65 | 65 | <span> |
|
66 | 66 | <select id="download_format"> |
|
67 | 67 | <option value="json">ipynb</option> |
|
68 | 68 | <option value="py">py</option> |
|
69 | 69 | </select> |
|
70 | 70 | </span> |
|
71 | 71 | <span class="section_row_buttons"> |
|
72 | 72 | <button id="download_notebook">Download</button> |
|
73 | 73 | </span> |
|
74 | 74 | </div> |
|
75 | 75 | <div class="section_row"> |
|
76 | 76 | <span class="section_row_buttons"> |
|
77 | 77 | <span id="print_widget"> |
|
78 | 78 | <button id="print_notebook">Print</button> |
|
79 | 79 | </span> |
|
80 | 80 | </span> |
|
81 | 81 | </div> |
|
82 | 82 | </div> |
|
83 | 83 | </div> |
|
84 | 84 | |
|
85 | 85 | <div id="cell_section"> |
|
86 | 86 | <h3 class="section_header">Cell</h3> |
|
87 | 87 | <div class="section_content"> |
|
88 | 88 | <div class="section_row"> |
|
89 | 89 | <span class="section_row_buttons"> |
|
90 | <button id="delete_cell">Delete</button> | |
|
90 | <button id="delete_cell"><u>D</u>elete</button> | |
|
91 | 91 | </span> |
|
92 | 92 | <span class="section_row_header">Actions</span> |
|
93 | 93 | </div> |
|
94 | 94 | <div class="section_row"> |
|
95 | 95 | <span id="cell_type" class="section_row_buttons"> |
|
96 | <button id="to_code">Code</button> | |
|
96 | <button id="to_code"><u>C</u>ode</button> | |
|
97 | 97 | <!-- <button id="to_html">HTML</button>--> |
|
98 | <button id="to_markdown">Markdown</button> | |
|
98 | <button id="to_markdown"><u>M</u>arkdown</button> | |
|
99 | 99 | </span> |
|
100 | 100 | <span class="button_label">Format</span> |
|
101 | 101 | </div> |
|
102 | 102 | <div class="section_row"> |
|
103 | 103 | <span id="cell_output" class="section_row_buttons"> |
|
104 | <button id="toggle_output">Toggle</button> | |
|
104 | <button id="toggle_output"><u>T</u>oggle</button> | |
|
105 | 105 | <button id="clear_all_output">ClearAll</button> |
|
106 | 106 | </span> |
|
107 | 107 | <span class="button_label">Output</span> |
|
108 | 108 | </div> |
|
109 | 109 | <div class="section_row"> |
|
110 | 110 | <span id="insert" class="section_row_buttons"> |
|
111 | <button id="insert_cell_above">Above</button> | |
|
112 | <button id="insert_cell_below">Below</button> | |
|
111 | <button id="insert_cell_above"><u>A</u>bove</button> | |
|
112 | <button id="insert_cell_below"><u>B</u>elow</button> | |
|
113 | 113 | </span> |
|
114 | 114 | <span class="button_label">Insert</span> |
|
115 | 115 | </div> |
|
116 | 116 | <div class="section_row"> |
|
117 | 117 | <span id="move" class="section_row_buttons"> |
|
118 | 118 | <button id="move_cell_up">Up</button> |
|
119 | 119 | <button id="move_cell_down">Down</button> |
|
120 | 120 | </span> |
|
121 | 121 | <span class="button_label">Move</span> |
|
122 | 122 | </div> |
|
123 | 123 | <div class="section_row"> |
|
124 | 124 | <span id="run_cells" class="section_row_buttons"> |
|
125 | 125 | <button id="run_selected_cell">Selected</button> |
|
126 | 126 | <button id="run_all_cells">All</button> |
|
127 | 127 | </span> |
|
128 | 128 | <span class="button_label">Run</span> |
|
129 | 129 | </div> |
|
130 | 130 | <div class="section_row"> |
|
131 | 131 | <span id="autoindent_span"> |
|
132 | 132 | <input type="checkbox" id="autoindent" checked="true"></input> |
|
133 | 133 | </span> |
|
134 | 134 | <span class="checkbox_label">Autoindent:</span> |
|
135 | 135 | </div> |
|
136 | 136 | </div> |
|
137 | 137 | </div> |
|
138 | 138 | |
|
139 | 139 | <div id="kernel_section"> |
|
140 | 140 | <h3 class="section_header">Kernel</h3> |
|
141 | 141 | <div class="section_content"> |
|
142 | 142 | <div class="section_row"> |
|
143 | 143 | <span id="int_restart" class="section_row_buttons"> |
|
144 | 144 | <button id="int_kernel">Interrupt</button> |
|
145 | 145 | <button id="restart_kernel">Restart</button> |
|
146 | 146 | </span> |
|
147 | 147 | <span class="section_row_header">Actions</span> |
|
148 | 148 | </div> |
|
149 | 149 | <div class="section_row"> |
|
150 | 150 | <span id="kernel_persist"> |
|
151 | 151 | <input type="checkbox" id="kill_kernel"></input> |
|
152 | 152 | </span> |
|
153 | 153 | <span class="checkbox_label">Kill kernel upon exit:</span> |
|
154 | 154 | </div> |
|
155 | 155 | </div> |
|
156 | 156 | </div> |
|
157 | 157 | |
|
158 | 158 | <div id="help_section"> |
|
159 | 159 | <h3 class="section_header">Help</h3> |
|
160 | 160 | <div class="section_content"> |
|
161 | 161 | <div class="section_row"> |
|
162 | 162 | <span id="help_buttons0" class="section_row_buttons"> |
|
163 | 163 | <a id="python_help" href="http://docs.python.org" target="_blank">Python</a> |
|
164 | 164 | <a id="ipython_help" href="http://ipython.org/documentation.html" target="_blank">IPython</a> |
|
165 | 165 | </span> |
|
166 | 166 | <span class="section_row_header">Links</span> |
|
167 | 167 | </div> |
|
168 | 168 | <div class="section_row"> |
|
169 | 169 | <span id="help_buttons1" class="section_row_buttons"> |
|
170 | 170 | <a id="numpy_help" href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a> |
|
171 | 171 | <a id="scipy_help" href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a> |
|
172 | 172 | </span> |
|
173 | 173 | </div> |
|
174 | 174 | <div class="section_row"> |
|
175 | 175 | <span id="help_buttons2" class="section_row_buttons"> |
|
176 | 176 | <a id="matplotlib_help" href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a> |
|
177 | 177 | <a id="sympy_help" href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a> |
|
178 | 178 | </span> |
|
179 | 179 | </div> |
|
180 | 180 | <div class="section_row"> |
|
181 | 181 | <span class="help_string">run selected cell</span> |
|
182 | 182 | <span class="help_string_label">Shift-Enter :</span> |
|
183 | 183 | </div> |
|
184 | 184 | <div class="section_row"> |
|
185 | 185 | <span class="help_string">run in terminal mode</span> |
|
186 | 186 | <span class="help_string_label">Ctrl-Enter :</span> |
|
187 | 187 | </div> |
|
188 | 188 | <div class="section_row"> |
|
189 | 189 | <span class="help_string">show keyboard shortcuts</span> |
|
190 | 190 | <span class="help_string_label">Ctrl-m h :</span> |
|
191 | 191 | </div> |
|
192 | 192 | </div> |
|
193 | 193 | </div> |
|
194 | 194 | |
|
195 | 195 | </div> |
|
196 | 196 | <div id="left_panel_splitter"></div> |
|
197 | 197 | <div id="notebook_panel"> |
|
198 | 198 | <div id="notebook"></div> |
|
199 | 199 | <div id="pager_splitter"></div> |
|
200 | 200 | <div id="pager"></div> |
|
201 | 201 | </div> |
|
202 | 202 | |
|
203 | 203 | </div> |
|
204 | 204 | |
|
205 | 205 | <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script> |
|
206 | 206 | <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script> |
|
207 | 207 | <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script> |
|
208 | 208 | |
|
209 | 209 | <script src="static/codemirror-2.12/lib/codemirror.js" charset="utf-8"></script> |
|
210 | 210 | <script src="static/codemirror-2.12/mode/python/python.js" charset="utf-8"></script> |
|
211 | 211 | <script src="static/codemirror-2.12/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> |
|
212 | 212 | <script src="static/codemirror-2.12/mode/xml/xml.js" charset="utf-8"></script> |
|
213 | 213 | <script src="static/codemirror-2.12/mode/javascript/javascript.js" charset="utf-8"></script> |
|
214 | 214 | <script src="static/codemirror-2.12/mode/css/css.js" charset="utf-8"></script> |
|
215 | 215 | <script src="static/codemirror-2.12/mode/rst/rst.js" charset="utf-8"></script> |
|
216 | 216 | |
|
217 | 217 | <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script> |
|
218 | 218 | |
|
219 | 219 | <script src="static/prettify/prettify.js" charset="utf-8"></script> |
|
220 | 220 | |
|
221 | 221 | <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
222 | 222 | <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script> |
|
223 | 223 | <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script> |
|
224 | 224 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> |
|
225 | 225 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> |
|
226 | 226 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> |
|
227 | 227 | <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> |
|
228 | 228 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> |
|
229 | 229 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
230 | 230 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
231 | 231 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> |
|
232 | 232 | <script src="static/js/printwidget.js" type="text/javascript" charset="utf-8"></script> |
|
233 | 233 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> |
|
234 | 234 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
235 | 235 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
|
236 | 236 | |
|
237 | 237 | |
|
238 | 238 | </body> |
|
239 | 239 | |
|
240 | 240 | </html> |
|
241 | 241 | |
|
242 | 242 |
General Comments 0
You need to be logged in to leave comments.
Login now