##// END OF EJS Templates
Add tooltips to the notebook via 'title' attr....
MinRK -
Show More
@@ -1,60 +1,63 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 // Kernel Status widget
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var utils = IPython.utils;
15 15
16 16 var KernelStatusWidget = function (selector) {
17 17 this.selector = selector;
18 18 if (this.selector !== undefined) {
19 19 this.element = $(selector);
20 20 this.style();
21 21 }
22 22 };
23 23
24 24
25 25 KernelStatusWidget.prototype.style = function () {
26 26 this.element.addClass('ui-widget');
27 this.element.attr('title', "The kernel execution status." +
28 " If 'Busy', the kernel is currently running code." +
29 " If 'Idle', it is available for execution.")
27 30 };
28 31
29 32
30 33 KernelStatusWidget.prototype.status_busy = function () {
31 34 this.element.removeClass("status_idle");
32 35 this.element.removeClass("status_restarting");
33 36 this.element.addClass("status_busy");
34 37 this.element.text("Busy");
35 38 };
36 39
37 40
38 41 KernelStatusWidget.prototype.status_idle = function () {
39 42 this.element.removeClass("status_busy");
40 43 this.element.removeClass("status_restarting");
41 44 this.element.addClass("status_idle");
42 45 this.element.text("Idle");
43 46 };
44 47
45 48 KernelStatusWidget.prototype.status_restarting = function () {
46 49 this.element.removeClass("status_busy");
47 50 this.element.removeClass("status_idle");
48 51 this.element.addClass("status_restarting");
49 52 this.element.text("Restarting");
50 53 };
51 54
52 55
53 56
54 57
55 58 IPython.KernelStatusWidget = KernelStatusWidget;
56 59
57 60 return IPython;
58 61
59 62 }(IPython));
60 63
@@ -1,101 +1,102 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 // LeftPanel
10 10 //============================================================================
11 11
12 12
13 13 var IPython = (function (IPython) {
14 14
15 15 var utils = IPython.utils;
16 16
17 17 var LeftPanel = function (left_panel_selector, left_panel_splitter_selector) {
18 18 this.left_panel_element = $(left_panel_selector);
19 19 this.left_panel_splitter_element = $(left_panel_splitter_selector);
20 20 this.expanded = true;
21 21 this.width = 300;
22 22 this.style();
23 23 this.bind_events();
24 24 this.create_children();
25 25 };
26 26
27 27
28 28 LeftPanel.prototype.style = function () {
29 29 this.left_panel_splitter_element.addClass('border-box-sizing ui-widget ui-state-default');
30 30 this.left_panel_element.addClass('border-box-sizing ui-widget');
31 31 this.left_panel_element.width(this.width);
32 32 this.left_panel_splitter_element.css({left : this.width});
33 this.left_panel_splitter_element.attr('title', 'Click to Show/Hide left panel');
33 34 };
34 35
35 36
36 37 LeftPanel.prototype.bind_events = function () {
37 38 var that = this;
38 39
39 40 this.left_panel_element.bind('collapse_left_panel', function () {
40 41 that.left_panel_element.hide('fast');
41 42 that.left_panel_splitter_element.animate({left : 0}, 'fast');
42 43 });
43 44
44 45 this.left_panel_element.bind('expand_left_panel', function () {
45 46 that.left_panel_element.show('fast');
46 47 that.left_panel_splitter_element.animate({left : that.width}, 'fast');
47 48 });
48 49
49 50 this.left_panel_splitter_element.hover(
50 51 function () {
51 52 that.left_panel_splitter_element.addClass('ui-state-hover');
52 53 },
53 54 function () {
54 55 that.left_panel_splitter_element.removeClass('ui-state-hover');
55 56 }
56 57 );
57 58
58 59 this.left_panel_splitter_element.click(function () {
59 60 that.toggle();
60 61 });
61 62
62 63 };
63 64
64 65
65 66 LeftPanel.prototype.create_children = function () {
66 67 this.notebook_section = new IPython.NotebookSection('div#notebook_section');
67 68 this.cell_section = new IPython.CellSection('div#cell_section');
68 69 this.kernel_section = new IPython.KernelSection('div#kernel_section');
69 70 this.help_section = new IPython.HelpSection('div#help_section');
70 71 }
71 72
72 73 LeftPanel.prototype.collapse = function () {
73 74 if (this.expanded === true) {
74 75 this.left_panel_element.add($('div#notebook')).trigger('collapse_left_panel');
75 76 this.expanded = false;
76 77 };
77 78 };
78 79
79 80
80 81 LeftPanel.prototype.expand = function () {
81 82 if (this.expanded !== true) {
82 83 this.left_panel_element.add($('div#notebook')).trigger('expand_left_panel');
83 84 this.expanded = true;
84 85 };
85 86 };
86 87
87 88
88 89 LeftPanel.prototype.toggle = function () {
89 90 if (this.expanded === true) {
90 91 this.collapse();
91 92 } else {
92 93 this.expand();
93 94 };
94 95 };
95 96
96 97 IPython.LeftPanel = LeftPanel;
97 98
98 99 return IPython;
99 100
100 101 }(IPython));
101 102
@@ -1,101 +1,102 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 // Pager
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var utils = IPython.utils;
15 15
16 16 var Pager = function (pager_selector, pager_splitter_selector) {
17 17 this.pager_element = $(pager_selector);
18 18 this.pager_splitter_element = $(pager_splitter_selector);
19 19 this.expanded = true;
20 20 this.percentage_height = 0.40;
21 21 this.style();
22 22 this.bind_events();
23 23 };
24 24
25 25
26 26 Pager.prototype.style = function () {
27 27 this.pager_splitter_element.addClass('border-box-sizing ui-widget ui-state-default');
28 28 this.pager_element.addClass('border-box-sizing ui-widget');
29 this.pager_splitter_element.attr('title', 'Click to Show/Hide pager area');
29 30 };
30 31
31 32
32 33 Pager.prototype.bind_events = function () {
33 34 var that = this;
34 35
35 36 this.pager_element.bind('collapse_pager', function () {
36 37 that.pager_element.hide('fast');
37 38 });
38 39
39 40 this.pager_element.bind('expand_pager', function () {
40 41 that.pager_element.show('fast');
41 42 });
42 43
43 44 this.pager_splitter_element.hover(
44 45 function () {
45 46 that.pager_splitter_element.addClass('ui-state-hover');
46 47 },
47 48 function () {
48 49 that.pager_splitter_element.removeClass('ui-state-hover');
49 50 }
50 51 );
51 52
52 53 this.pager_splitter_element.click(function () {
53 54 that.toggle();
54 55 });
55 56
56 57 };
57 58
58 59
59 60 Pager.prototype.collapse = function () {
60 61 if (this.expanded === true) {
61 62 this.pager_element.add($('div#notebook')).trigger('collapse_pager');
62 63 this.expanded = false;
63 64 };
64 65 };
65 66
66 67
67 68 Pager.prototype.expand = function () {
68 69 if (this.expanded !== true) {
69 70 this.pager_element.add($('div#notebook')).trigger('expand_pager');
70 71 this.expanded = true;
71 72 };
72 73 };
73 74
74 75
75 76 Pager.prototype.toggle = function () {
76 77 if (this.expanded === true) {
77 78 this.collapse();
78 79 } else {
79 80 this.expand();
80 81 };
81 82 };
82 83
83 84
84 85 Pager.prototype.clear = function (text) {
85 86 this.pager_element.empty();
86 87 };
87 88
88 89
89 90 Pager.prototype.append_text = function (text) {
90 91 var toinsert = $("<div/>").addClass("output_area output_stream");
91 92 toinsert.append($('<pre/>').html(utils.fixConsole(text)));
92 93 this.pager_element.append(toinsert);
93 94 };
94 95
95 96
96 97 IPython.Pager = Pager;
97 98
98 99 return IPython;
99 100
100 101 }(IPython));
101 102
@@ -1,246 +1,287 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 // PanelSection
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var utils = IPython.utils;
15 15
16 16 // Base PanelSection class
17 17
18 18 var PanelSection = function (selector) {
19 19 this.selector = selector;
20 20 if (this.selector !== undefined) {
21 21 this.element = $(selector);
22 22 this.header = this.element.find('h3.section_header');
23 23 this.content = this.element.find('div.section_content');
24 24 this.style();
25 25 this.bind_events();
26 26 }
27 27 this.expanded = true;
28 28 };
29 29
30 30
31 31 PanelSection.prototype.style = function () {
32 32 this.header.addClass('ui-widget ui-state-default');
33 this.header.attr('title', "Click to Show/Hide Section");
33 34 this.content.addClass('ui-widget section_content');
34 35 };
35 36
36 37
37 38 PanelSection.prototype.bind_events = function () {
38 39 var that = this;
39 40 this.header.click(function () {
40 41 that.toggle();
41 42 });
42 43 this.header.hover(function () {
43 44 that.header.toggleClass('ui-state-hover');
44 45 });
45 46 };
46 47
47 48
48 49 PanelSection.prototype.expand = function () {
49 50 if (!this.expanded) {
50 51 this.content.slideDown('fast');
51 52 this.expanded = true;
52 53 };
53 54 };
54 55
55 56
56 57 PanelSection.prototype.collapse = function () {
57 58 if (this.expanded) {
58 59 this.content.slideUp('fast');
59 60 this.expanded = false;
60 61 };
61 62 };
62 63
63 64
64 65 PanelSection.prototype.toggle = function () {
65 66 if (this.expanded === true) {
66 67 this.collapse();
67 68 } else {
68 69 this.expand();
69 70 };
70 71 };
71 72
72 73
73 74 PanelSection.prototype.create_children = function () {};
74 75
75 76
76 77 // NotebookSection
77 78
78 79 var NotebookSection = function () {
79 80 PanelSection.apply(this, arguments);
80 81 };
81 82
82 83
83 84 NotebookSection.prototype = new PanelSection();
84 85
85 86
86 87 NotebookSection.prototype.style = function () {
87 88 PanelSection.prototype.style.apply(this);
88 89 this.content.addClass('ui-helper-clearfix');
89 90 this.content.find('div.section_row').addClass('ui-helper-clearfix');
90 91 this.content.find('#new_open').buttonset();
92 this.content.find('#new_notebook').attr('title', "Create a new notebook");
93 this.content.find('#open_notebook').attr('title', "Open an existing notebook");
91 94 this.content.find('#download_notebook').button();
95 this.content.find('#download_notebook').attr('title',
96 "Download the notebook in the specified format," +
97 " either full ipynb notebook or as a Python script.");
98 // upload notebook doesn't exist:
92 99 this.content.find('#upload_notebook').button();
93 100 this.content.find('#download_format').addClass('ui-widget ui-widget-content');
94 101 this.content.find('#download_format option').addClass('ui-widget ui-widget-content');
95 102 };
96 103
97 104
98 105 NotebookSection.prototype.bind_events = function () {
99 106 PanelSection.prototype.bind_events.apply(this);
100 107 var that = this;
101 108 this.content.find('#new_notebook').click(function () {
102 109 window.open('/new');
103 110 });
104 111 this.content.find('#open_notebook').click(function () {
105 112 window.open('/');
106 113 });
107 114 this.content.find('#download_notebook').click(function () {
108 115 var format = that.content.find('#download_format').val();
109 116 var notebook_id = IPython.save_widget.get_notebook_id();
110 117 var url = '/notebooks/' + notebook_id + '?format=' + format;
111 118 window.open(url,'_newtab');
112 119 });
113 120 };
114 121
115 122 // CellSection
116 123
117 124 var CellSection = function () {
118 125 PanelSection.apply(this, arguments);
119 126 };
120 127
121 128
122 129 CellSection.prototype = new PanelSection();
123 130
124 131
125 132 CellSection.prototype.style = function () {
126 133 PanelSection.prototype.style.apply(this);
127 134 this.content.addClass('ui-helper-clearfix');
128 135 this.content.find('div.section_row').addClass('ui-helper-clearfix');
129 136 this.content.find('#delete_cell').button();
137 this.content.find('#delete_cell').attr('title', "Delete the selected cell");
138
130 139 this.content.find('#insert').buttonset();
140 this.content.find('#insert_cell_above').attr('title', "Insert new cell above selected");
141 this.content.find('#insert_cell_below').attr('title', "Insert new cell below selected");
142
131 143 this.content.find('#move').buttonset();
144 this.content.find('#move_cell_up').attr('title', "Move selected cell up one in the Notebook");
145 this.content.find('#move_cell_down').attr('title', "Move selected cell down one in the Notebook");
146
132 147 this.content.find('#cell_type').buttonset();
148 this.content.find('#to_markdown').attr('title', 'Change selected cell to markdown (for text)')
149 this.content.find('#to_code').attr('title', 'Change selected cell to code (for execution)')
150
133 151 this.content.find('#cell_output').buttonset();
152 this.content.find('#toggle_output').attr('title', 'Toggle visibility of the output of code cells')
153 this.content.find('#clear_all_output').attr('title', 'Clear output of all code cells (actually removes the data, unlike toggle)')
154
134 155 this.content.find('#run_cells').buttonset();
156 this.content.find('#run_selected_cell').attr('title', 'Submit the selected cell for execution')
157 this.content.find('#run_all_cells').attr('title', 'Run *all* code cells in the notebook in order')
158 this.content.find('#autoindent').attr('title', 'Autoindent code as-you-type')
159 this.content.find('#autoindent_label').attr('title', 'Autoindent code as-you-type')
135 160 };
136 161
137 162
138 163 CellSection.prototype.bind_events = function () {
139 164 PanelSection.prototype.bind_events.apply(this);
140 165 this.content.find('#toggle_output').click(function () {
141 166 IPython.notebook.toggle_output();
142 167 });
143 168 this.content.find('#clear_all_output').click(function () {
144 169 IPython.notebook.clear_all_output();
145 170 });
146 171 this.content.find('#delete_cell').click(function () {
147 172 IPython.notebook.delete_cell();
148 173 });
149 174 this.content.find('#insert_cell_above').click(function () {
150 175 IPython.notebook.insert_code_cell_above();
151 176 });
152 177 this.content.find('#insert_cell_below').click(function () {
153 178 IPython.notebook.insert_code_cell_below();
154 179 });
155 180 this.content.find('#move_cell_up').click(function () {
156 181 IPython.notebook.move_cell_up();
157 182 });
158 183 this.content.find('#move_cell_down').click(function () {
159 184 IPython.notebook.move_cell_down();
160 185 });
161 186 this.content.find('#to_code').click(function () {
162 187 IPython.notebook.to_code();
163 188 });
164 189 this.content.find('#to_markdown').click(function () {
165 190 IPython.notebook.to_markdown();
166 191 });
167 192 this.content.find('#run_selected_cell').click(function () {
168 193 IPython.notebook.execute_selected_cell();
169 194 });
170 195 this.content.find('#run_all_cells').click(function () {
171 196 IPython.notebook.execute_all_cells();
172 197 });
173 198 this.content.find('#autoindent').change(function () {
174 199 var state = $('#autoindent').prop('checked');
175 200 IPython.notebook.set_autoindent(state);
176 201 });
177 202 };
178 203
179 204
180 205 // KernelSection
181 206
182 207 var KernelSection = function () {
183 208 PanelSection.apply(this, arguments);
184 209 };
185 210
186 211
187 212 KernelSection.prototype = new PanelSection();
188 213
189 214
190 215 KernelSection.prototype.style = function () {
191 216 PanelSection.prototype.style.apply(this);
192 217 this.content.addClass('ui-helper-clearfix');
193 218 this.content.find('div.section_row').addClass('ui-helper-clearfix');
194 219 this.content.find('#int_restart').buttonset();
220 this.content.find("#int_kernel").attr('title', "Interrupt the kernel with SIGINT/Ctrl-C");
221 this.content.find("#restart_kernel").attr('title',
222 "Restart the kernel. This will shutdown the current kernel," +
223 " and start a new, clean kernel in its place, connected to this Notebook." +
224 " This may break the connection of other clients connected to this kernel." );
225 var kill_tip = "Kill the kernel on exit. If unchecked, the kernel will remain" +
226 " active after closing the session, allowing you to reconnect and resume later.";
227 this.content.find('#kill_kernel').attr('title', kill_tip);
228 this.content.find('#kill_kernel_label').attr('title', kill_tip);
229
195 230 };
196 231
197 232
198 233 KernelSection.prototype.bind_events = function () {
199 234 PanelSection.prototype.bind_events.apply(this);
200 235 this.content.find('#restart_kernel').click(function () {
201 236 IPython.notebook.restart_kernel();
202 237 });
203 238 this.content.find('#int_kernel').click(function () {
204 239 IPython.notebook.kernel.interrupt();
205 240 });
206 241 };
207 242
208 243
209 244 // HelpSection
210 245
211 246 var HelpSection = function () {
212 247 PanelSection.apply(this, arguments);
213 248 };
214 249
215 250
216 251 HelpSection.prototype = new PanelSection();
217 252
218 253
219 254 HelpSection.prototype.style = function () {
220 255 PanelSection.prototype.style.apply(this);
221 256 PanelSection.prototype.style.apply(this);
222 257 this.content.addClass('ui-helper-clearfix');
223 258 this.content.find('div.section_row').addClass('ui-helper-clearfix');
224 259 this.content.find('#help_buttons0').buttonset();
225 260 this.content.find('#help_buttons1').buttonset();
226 261 this.content.find('#help_buttons2').buttonset();
262 this.content.find('#python_help').attr('title', "Open the online Python documentation in a new tab")
263 this.content.find('#ipython_help').attr('title', "Open the online IPython documentation in a new tab")
264 this.content.find('#numpy_help').attr('title', "Open the online NumPy documentation in a new tab")
265 this.content.find('#scipy_help').attr('title', "Open the online SciPy documentation in a new tab")
266 this.content.find('#matplotlib_help').attr('title', "Open the online Matplotlib documentation in a new tab")
267 this.content.find('#sympy_help').attr('title', "Open the online SymPy documentation in a new tab")
227 268 };
228 269
229 270
230 271 HelpSection.prototype.bind_events = function () {
231 272 PanelSection.prototype.bind_events.apply(this);
232 273 };
233 274
234 275
235 276 // Set module variables
236 277
237 278 IPython.PanelSection = PanelSection;
238 279 IPython.NotebookSection = NotebookSection;
239 280 IPython.CellSection = CellSection;
240 281 IPython.KernelSection = KernelSection;
241 282 IPython.HelpSection = HelpSection;
242 283
243 284 return IPython;
244 285
245 286 }(IPython));
246 287
@@ -1,54 +1,58 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 this.element.find('button#print_notebook').attr('title',
15 "Open a new window with printer-friendly HTML of the Notebook." +
16 " Note that this is incomplete, and may not produce perfect" +
17 " printed output.");
14 18 };
15 19
16 20 PrintWidget.prototype.bind_events = function () {
17 21 var that = this;
18 22 this.element.find('button#print_notebook').click(function () {
19 23 that.print_notebook();
20 24 });
21 25 };
22 26
23 27 PrintWidget.prototype.enable = function () {
24 28 this.element.find('button#print_notebook').button('enable');
25 29 };
26 30
27 31 PrintWidget.prototype.disable = function () {
28 32 this.element.find('button#print_notebook').button('disable');
29 33 };
30 34
31 35 PrintWidget.prototype.print_notebook = function () {
32 36 var w = window.open('', '_blank', 'scrollbars=1,menubar=1');
33 37 var html = '<html><head>' +
34 38 $('head').clone().html() +
35 39 '<style type="text/css">' +
36 40 '@media print { body { overflow: visible !important; } }' +
37 41 '.ui-widget-content { border: 0px; }' +
38 42 '</style>' +
39 43 '</head><body style="overflow: auto;">' +
40 44 $('#notebook').clone().html() +
41 45 '</body></html>';
42 46
43 47 w.document.open();
44 48 w.document.write(html);
45 49 w.document.close();
46 50
47 51 return false;
48 52 };
49 53
50 54 IPython.PrintWidget = PrintWidget;
51 55
52 56 return IPython;
53 57
54 58 }(IPython));
@@ -1,39 +1,40 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 // QuickHelp button
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var QuickHelp = function (selector) {
15 15 this.selector = selector;
16 16 if (this.selector !== undefined) {
17 17 this.element = $(selector);
18 18 this.style();
19 19 this.bind_events();
20 20 }
21 21 };
22 22
23 23 QuickHelp.prototype.style = function () {
24 24 this.element.find('button#quick_help').button();
25 this.element.find('button#quick_help').attr('title', "Show/Hide the keyboard shortcuts for the IPython Notebook");
25 26 };
26 27
27 28 QuickHelp.prototype.bind_events = function () {
28 29 var that = this;
29 30 this.element.find("button#quick_help").click(function () {
30 31 IPython.notebook.toggle_keyboard_shortcuts();
31 32 });
32 33 };
33 34
34 35 // Set module variables
35 36 IPython.QuickHelp = QuickHelp;
36 37
37 38 return IPython;
38 39
39 40 }(IPython));
@@ -1,156 +1,157 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_blacklist_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 this.element.find('button#save_notebook').attr('title', 'Save the Notebook');
32 33 var left_panel_width = $('div#left_panel').outerWidth();
33 34 var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth();
34 35 $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width});
35 36
36 37 };
37 38
38 39
39 40 SaveWidget.prototype.bind_events = function () {
40 41 var that = this;
41 42 this.element.find('button#save_notebook').click(function () {
42 43 that.save_notebook();
43 44 });
44 45 this.element.find('input#notebook_name').keyup(function () {
45 46 that.is_renaming();
46 47 });
47 48 };
48 49
49 50
50 51 SaveWidget.prototype.save_notebook = function () {
51 52 IPython.notebook.save_notebook();
52 53 };
53 54
54 55
55 56 SaveWidget.prototype.notebook_saved = function () {
56 57 this.set_document_title();
57 58 this.last_saved_name = this.get_notebook_name();
58 59 };
59 60
60 61
61 62 SaveWidget.prototype.is_renaming = function () {
62 63 if (this.get_notebook_name() !== this.last_saved_name) {
63 64 this.status_rename();
64 65 } else {
65 66 this.status_save();
66 67 };
67 68 };
68 69
69 70
70 71 SaveWidget.prototype.get_notebook_name = function () {
71 72 return this.element.find('input#notebook_name').attr('value');
72 73 }
73 74
74 75
75 76 SaveWidget.prototype.set_notebook_name = function (nbname) {
76 77 this.element.find('input#notebook_name').attr('value',nbname);
77 78 this.set_document_title();
78 79 this.last_saved_name = nbname;
79 80 }
80 81
81 82
82 83 SaveWidget.prototype.set_document_title = function () {
83 84 nbname = this.get_notebook_name();
84 85 document.title = 'IPy: ' + nbname;
85 86 };
86 87
87 88
88 89 SaveWidget.prototype.get_notebook_id = function () {
89 90 return this.element.find('span#notebook_id').text()
90 91 };
91 92
92 93
93 94 SaveWidget.prototype.update_url = function () {
94 95 var notebook_id = this.get_notebook_id();
95 96 if (notebook_id !== '') {
96 97 window.history.replaceState({}, '', notebook_id);
97 98 };
98 99 };
99 100
100 101
101 102 SaveWidget.prototype.test_notebook_name = function () {
102 103 var nbname = this.get_notebook_name();
103 104 if (this.notebook_name_blacklist_re.test(nbname) == false) {
104 105 return true;
105 106 } else {
106 107 var bad_name = $('<div/>');
107 108 bad_name.html(
108 109 "The notebook name you entered (" +
109 110 nbname +
110 111 ") is not valid. Notebook names can contain any characters except / and \\."
111 112 );
112 113 bad_name.dialog({title: 'Invalid name', modal: true});
113 114 return false;
114 115 };
115 116 };
116 117
117 118
118 119 SaveWidget.prototype.reset_status = function () {
119 120 this.is_renaming();
120 121 };
121 122
122 123
123 124 SaveWidget.prototype.status_save = function () {
124 125 this.element.find('button#save_notebook').button('option', 'label', '<u>S</u>ave');
125 126 this.element.find('button#save_notebook').button('enable');
126 127 IPython.print_widget.enable();
127 128 };
128 129
129 130
130 131 SaveWidget.prototype.status_saving = function () {
131 132 this.element.find('button#save_notebook').button('option', 'label', 'Saving');
132 133 this.element.find('button#save_notebook').button('disable');
133 134 IPython.print_widget.disable();
134 135 };
135 136
136 137
137 138 SaveWidget.prototype.status_loading = function () {
138 139 this.element.find('button#save_notebook').button('option', 'label', 'Loading');
139 140 this.element.find('button#save_notebook').button('disable');
140 141 IPython.print_widget.disable();
141 142 };
142 143
143 144
144 145 SaveWidget.prototype.status_rename = function () {
145 146 this.element.find('button#save_notebook').button('option', 'label', 'Rename');
146 147 this.element.find('button#save_notebook').button('enable');
147 148 IPython.print_widget.enable();
148 149 };
149 150
150 151
151 152 IPython.SaveWidget = SaveWidget;
152 153
153 154 return IPython;
154 155
155 156 }(IPython));
156 157
@@ -1,280 +1,280 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 function CheckMathJax(){
17 17 var div=document.getElementById("MathJaxFetchingWarning")
18 18 if(window.MathJax){
19 19 document.body.removeChild(div)
20 20 }
21 21 else{
22 22 div.style.display = "block";
23 23 }
24 24 }
25 25 if (typeof MathJax == 'undefined') {
26 26 console.log("No local MathJax, loading from CDN");
27 27 document.write(unescape("%3Cscript type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js%3Fconfig=TeX-AMS_HTML' charset='utf-8'%3E%3C/script%3E"));
28 28 }else{
29 29 console.log("Using local MathJax");
30 30 }
31 31 </script>
32 32
33 33 <link rel="stylesheet" href="static/codemirror/lib/codemirror.css">
34 34 <link rel="stylesheet" href="static/codemirror/mode/markdown/markdown.css">
35 35 <link rel="stylesheet" href="static/codemirror/mode/rst/rst.css">
36 36 <link rel="stylesheet" href="static/codemirror/theme/ipython.css">
37 37 <link rel="stylesheet" href="static/codemirror/theme/default.css">
38 38
39 39 <link rel="stylesheet" href="static/prettify/prettify.css"/>
40 40
41 41 <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
42 42 <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
43 43 <link rel="stylesheet" href="static/css/base.css" type="text/css" />
44 44 <link rel="stylesheet" href="static/css/notebook.css" type="text/css" />
45 45 <link rel="stylesheet" href="static/css/renderedhtml.css" type="text/css" />
46 46
47 47
48 48 </head>
49 49
50 50 <body onload='CheckMathJax();'>
51 51
52 52 <div id="header">
53 53 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
54 54 <span id="save_widget">
55 55 <input type="text" id="notebook_name" size="20"></textarea>
56 56 <span id="notebook_id" style="display:none">{{notebook_id}}</span>
57 57 <button id="save_notebook"><u>S</u>ave</button>
58 58 </span>
59 59 <span id="quick_help_area">
60 60 <button id="quick_help">Quick<u>H</u>elp</button>
61 61 </span>
62 62 <span id="kernel_status">Idle</span>
63 63 </div>
64 64
65 65 <div id="MathJaxFetchingWarning"
66 66 style="width:80%; margin:auto;padding-top:20%;text-align: justify; display:none">
67 67 <p style="font-size:26px;">There was an issue trying to fetch MathJax.js
68 68 from the internet.</p>
69 69
70 70 <p style="padding:0.2em"> With a working internet connection, you can run
71 71 the following at a Python or IPython prompt, which will install a local
72 72 copy of MathJax:</p>
73 73
74 74 <pre style="background-color:lightblue;border:thin silver solid;padding:0.4em">
75 75 from IPython.external import mathjax; mathjax.install_mathjax()
76 76 </pre>
77 77 This will try to install MathJax into the directory where you installed
78 78 IPython. If you installed IPython to a location that requires
79 79 administrative privileges to write, you will need to make this call as
80 80 an administrator. On OSX/Linux/Unix, this can be done at the
81 81 command-line via:
82 82 <pre style="background-color:lightblue;border:thin silver solid;padding:0.4em">
83 83 sudo python -c "from IPython.external import mathjax; mathjax.install_mathjax()"
84 84 </pre>
85 85 </p>
86 86 </div>
87 87
88 88 <div id="main_app">
89 89
90 90 <div id="left_panel">
91 91
92 92 <div id="notebook_section">
93 93 <h3 class="section_header">Notebook</h3>
94 94 <div class="section_content">
95 95 <div class="section_row">
96 96 <span id="new_open" class="section_row_buttons">
97 97 <button id="new_notebook">New</button>
98 98 <button id="open_notebook">Open</button>
99 99 </span>
100 100 <span class="section_row_header">Actions</span>
101 101 </div>
102 102 <div class="section_row">
103 103 <span>
104 104 <select id="download_format">
105 105 <option value="json">ipynb</option>
106 106 <option value="py">py</option>
107 107 </select>
108 108 </span>
109 109 <span class="section_row_buttons">
110 110 <button id="download_notebook">Download</button>
111 111 </span>
112 112 </div>
113 113 <div class="section_row">
114 114 <span class="section_row_buttons">
115 115 <span id="print_widget">
116 116 <button id="print_notebook">Print</button>
117 117 </span>
118 118 </span>
119 119 </div>
120 120 </div>
121 121 </div>
122 122
123 123 <div id="cell_section">
124 124 <h3 class="section_header">Cell</h3>
125 125 <div class="section_content">
126 126 <div class="section_row">
127 127 <span class="section_row_buttons">
128 128 <button id="delete_cell"><u>D</u>elete</button>
129 129 </span>
130 130 <span class="section_row_header">Actions</span>
131 131 </div>
132 132 <div class="section_row">
133 133 <span id="cell_type" class="section_row_buttons">
134 134 <button id="to_code"><u>C</u>ode</button>
135 135 <!-- <button id="to_html">HTML</button>-->
136 136 <button id="to_markdown"><u>M</u>arkdown</button>
137 137 </span>
138 138 <span class="button_label">Format</span>
139 139 </div>
140 140 <div class="section_row">
141 141 <span id="cell_output" class="section_row_buttons">
142 142 <button id="toggle_output"><u>T</u>oggle</button>
143 143 <button id="clear_all_output">ClearAll</button>
144 144 </span>
145 145 <span class="button_label">Output</span>
146 146 </div>
147 147 <div class="section_row">
148 148 <span id="insert" class="section_row_buttons">
149 149 <button id="insert_cell_above"><u>A</u>bove</button>
150 150 <button id="insert_cell_below"><u>B</u>elow</button>
151 151 </span>
152 152 <span class="button_label">Insert</span>
153 153 </div>
154 154 <div class="section_row">
155 155 <span id="move" class="section_row_buttons">
156 156 <button id="move_cell_up">Up</button>
157 157 <button id="move_cell_down">Down</button>
158 158 </span>
159 159 <span class="button_label">Move</span>
160 160 </div>
161 161 <div class="section_row">
162 162 <span id="run_cells" class="section_row_buttons">
163 163 <button id="run_selected_cell">Selected</button>
164 164 <button id="run_all_cells">All</button>
165 165 </span>
166 166 <span class="button_label">Run</span>
167 167 </div>
168 168 <div class="section_row">
169 169 <span id="autoindent_span">
170 170 <input type="checkbox" id="autoindent" checked="true"></input>
171 171 </span>
172 <span class="checkbox_label">Autoindent:</span>
172 <span class="checkbox_label" id="autoindent_label">Autoindent:</span>
173 173 </div>
174 174 </div>
175 175 </div>
176 176
177 177 <div id="kernel_section">
178 178 <h3 class="section_header">Kernel</h3>
179 179 <div class="section_content">
180 180 <div class="section_row">
181 181 <span id="int_restart" class="section_row_buttons">
182 182 <button id="int_kernel"><u>I</u>nterrupt</button>
183 183 <button id="restart_kernel">Restart</button>
184 184 </span>
185 185 <span class="section_row_header">Actions</span>
186 186 </div>
187 187 <div class="section_row">
188 188 <span id="kernel_persist">
189 189 <input type="checkbox" id="kill_kernel"></input>
190 190 </span>
191 <span class="checkbox_label">Kill kernel upon exit:</span>
191 <span class="checkbox_label" id="kill_kernel_label">Kill kernel upon exit:</span>
192 192 </div>
193 193 </div>
194 194 </div>
195 195
196 196 <div id="help_section">
197 197 <h3 class="section_header">Help</h3>
198 198 <div class="section_content">
199 199 <div class="section_row">
200 200 <span id="help_buttons0" class="section_row_buttons">
201 201 <a id="python_help" href="http://docs.python.org" target="_blank">Python</a>
202 202 <a id="ipython_help" href="http://ipython.org/documentation.html" target="_blank">IPython</a>
203 203 </span>
204 204 <span class="section_row_header">Links</span>
205 205 </div>
206 206 <div class="section_row">
207 207 <span id="help_buttons1" class="section_row_buttons">
208 208 <a id="numpy_help" href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a>
209 209 <a id="scipy_help" href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a>
210 210 </span>
211 211 </div>
212 212 <div class="section_row">
213 213 <span id="help_buttons2" class="section_row_buttons">
214 214 <a id="matplotlib_help" href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a>
215 215 <a id="sympy_help" href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a>
216 216 </span>
217 217 </div>
218 218 <div class="section_row">
219 219 <span class="help_string">run selected cell</span>
220 220 <span class="help_string_label">Shift-Enter :</span>
221 221 </div>
222 222 <div class="section_row">
223 223 <span class="help_string">run selected cell in-place</span>
224 224 <span class="help_string_label">Ctrl-Enter :</span>
225 225 </div>
226 226 <div class="section_row">
227 227 <span class="help_string">show keyboard shortcuts</span>
228 228 <span class="help_string_label">Ctrl-m h :</span>
229 229 </div>
230 230 </div>
231 231 </div>
232 232
233 233 </div>
234 234 <div id="left_panel_splitter"></div>
235 235 <div id="notebook_panel">
236 236 <div id="notebook"></div>
237 237 <div id="pager_splitter"></div>
238 238 <div id="pager"></div>
239 239 </div>
240 240
241 241 </div>
242 242
243 243 <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
244 244 <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
245 245 <script src="static/jquery/js/jquery.autogrow.js" type="text/javascript" charset="utf-8"></script>
246 246
247 247 <script src="static/codemirror/lib/codemirror.js" charset="utf-8"></script>
248 248 <script src="static/codemirror/mode/python/python.js" charset="utf-8"></script>
249 249 <script src="static/codemirror/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script>
250 250 <script src="static/codemirror/mode/xml/xml.js" charset="utf-8"></script>
251 251 <script src="static/codemirror/mode/javascript/javascript.js" charset="utf-8"></script>
252 252 <script src="static/codemirror/mode/css/css.js" charset="utf-8"></script>
253 253 <script src="static/codemirror/mode/rst/rst.js" charset="utf-8"></script>
254 254 <script src="static/codemirror/mode/markdown/markdown.js" charset="utf-8"></script>
255 255
256 256 <script src="static/pagedown/Markdown.Converter.js" charset="utf-8"></script>
257 257
258 258 <script src="static/prettify/prettify.js" charset="utf-8"></script>
259 259
260 260 <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
261 261 <script src="static/js/utils.js" type="text/javascript" charset="utf-8"></script>
262 262 <script src="static/js/cell.js" type="text/javascript" charset="utf-8"></script>
263 263 <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script>
264 264 <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script>
265 265 <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script>
266 266 <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script>
267 267 <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script>
268 268 <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script>
269 269 <script src="static/js/quickhelp.js" type="text/javascript" charset="utf-8"></script>
270 270 <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script>
271 271 <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script>
272 272 <script src="static/js/printwidget.js" type="text/javascript" charset="utf-8"></script>
273 273 <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script>
274 274 <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script>
275 275 <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script>
276 276
277 277
278 278 </body>
279 279
280 280 </html>
General Comments 0
You need to be logged in to leave comments. Login now