Show More
@@ -154,5 +154,5 b' define([' | |||
|
154 | 154 | // Backwards compatability. |
|
155 | 155 | IPython.Dialog = Dialog; |
|
156 | 156 | |
|
157 |
return |
|
|
157 | return Dialog; | |
|
158 | 158 | }); |
@@ -5,7 +5,7 b' define([' | |||
|
5 | 5 | 'base/js/namespace', |
|
6 | 6 | 'jquery', |
|
7 | 7 | 'notebook/js/textcell', |
|
8 |
], function(IPython, $, |
|
|
8 | ], function(IPython, $, textcell) { | |
|
9 | 9 | "use strict"; |
|
10 | 10 | |
|
11 | 11 | /** |
@@ -276,7 +276,7 b' define([' | |||
|
276 | 276 | } |
|
277 | 277 | |
|
278 | 278 | // If there are no controls or the cell is a rendered TextCell hide the toolbar. |
|
279 | if (!this.ui_controls_list.length || (this.cell instanceof TextCell && this.cell.rendered)) { | |
|
279 | if (!this.ui_controls_list.length || (this.cell instanceof textcell.TextCell && this.cell.rendered)) { | |
|
280 | 280 | this.hide(); |
|
281 | 281 | } else { |
|
282 | 282 | this.show(); |
@@ -57,7 +57,7 b' define([' | |||
|
57 | 57 | this.kernel = kernel || null; |
|
58 | 58 | this.notebook = notebook; |
|
59 | 59 | this.collapsed = false; |
|
60 | this.tooltip = new Tooltip(events); | |
|
60 | this.tooltip = new tooltip.Tooltip(events); | |
|
61 | 61 | this.events = events; |
|
62 | 62 | this.config = config; |
|
63 | 63 | |
@@ -76,7 +76,7 b' define([' | |||
|
76 | 76 | |
|
77 | 77 | options = this.mergeopt(CodeCell, options, {cm_config:cm_overwrite_options}); |
|
78 | 78 | |
|
79 | Cell.apply(this,[options, keyboard_manager, events]); | |
|
79 | cell.Cell.apply(this,[options, keyboard_manager, events]); | |
|
80 | 80 | |
|
81 | 81 | // Attributes we want to override in this subclass. |
|
82 | 82 | this.cell_type = "code"; |
@@ -106,7 +106,7 b' define([' | |||
|
106 | 106 | |
|
107 | 107 | CodeCell.msg_cells = {}; |
|
108 | 108 | |
|
109 | CodeCell.prototype = new Cell(); | |
|
109 | CodeCell.prototype = new cell.Cell(); | |
|
110 | 110 | |
|
111 | 111 | /** |
|
112 | 112 | * @method auto_highlight |
@@ -117,7 +117,7 b' define([' | |||
|
117 | 117 | |
|
118 | 118 | /** @method create_element */ |
|
119 | 119 | CodeCell.prototype.create_element = function () { |
|
120 | Cell.prototype.create_element.apply(this, arguments); | |
|
120 | cell.Cell.prototype.create_element.apply(this, arguments); | |
|
121 | 121 | |
|
122 | 122 | var cell = $('<div></div>').addClass('cell border-box-sizing code_cell'); |
|
123 | 123 | cell.attr('tabindex','2'); |
@@ -125,7 +125,7 b' define([' | |||
|
125 | 125 | var input = $('<div></div>').addClass('input'); |
|
126 | 126 | var prompt = $('<div/>').addClass('prompt input_prompt'); |
|
127 | 127 | var inner_cell = $('<div/>').addClass('inner_cell'); |
|
128 | this.celltoolbar = new CellToolbar(this, this.events, this.notebook); | |
|
128 | this.celltoolbar = new celltoolbar.CellToolbar(this, this.events, this.notebook); | |
|
129 | 129 | inner_cell.append(this.celltoolbar.element); |
|
130 | 130 | var input_area = $('<div/>').addClass('input_area'); |
|
131 | 131 | this.code_mirror = CodeMirror(input_area.get(0), this.cm_config); |
@@ -155,13 +155,13 b' define([' | |||
|
155 | 155 | var output = $('<div></div>'); |
|
156 | 156 | cell.append(input).append(widget_area).append(output); |
|
157 | 157 | this.element = cell; |
|
158 | this.output_area = new OutputArea(output, true, this.events, this.keyboard_manager); | |
|
159 | this.completer = new Completer(this, this.events); | |
|
158 | this.output_area = new outputarea.OutputArea(output, true, this.events, this.keyboard_manager); | |
|
159 | this.completer = new completer.Completer(this, this.events); | |
|
160 | 160 | }; |
|
161 | 161 | |
|
162 | 162 | /** @method bind_events */ |
|
163 | 163 | CodeCell.prototype.bind_events = function () { |
|
164 | Cell.prototype.bind_events.apply(this); | |
|
164 | cell.Cell.prototype.bind_events.apply(this); | |
|
165 | 165 | var that = this; |
|
166 | 166 | |
|
167 | 167 | this.element.focusout( |
@@ -243,7 +243,7 b' define([' | |||
|
243 | 243 | |
|
244 | 244 | // keyboard event wasn't one of those unique to code cells, let's see |
|
245 | 245 | // if it's one of the generic ones (i.e. check edit mode shortcuts) |
|
246 | return Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]); | |
|
246 | return cell.Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]); | |
|
247 | 247 | }; |
|
248 | 248 | |
|
249 | 249 | // Kernel related calls. |
@@ -336,7 +336,7 b' define([' | |||
|
336 | 336 | // Basic cell manipulation. |
|
337 | 337 | |
|
338 | 338 | CodeCell.prototype.select = function () { |
|
339 | var cont = Cell.prototype.select.apply(this); | |
|
339 | var cont = cell.Cell.prototype.select.apply(this); | |
|
340 | 340 | if (cont) { |
|
341 | 341 | this.code_mirror.refresh(); |
|
342 | 342 | this.auto_highlight(); |
@@ -345,7 +345,7 b' define([' | |||
|
345 | 345 | }; |
|
346 | 346 | |
|
347 | 347 | CodeCell.prototype.render = function () { |
|
348 | var cont = Cell.prototype.render.apply(this); | |
|
348 | var cont = cell.Cell.prototype.render.apply(this); | |
|
349 | 349 | // Always execute, even if we are already in the rendered state |
|
350 | 350 | return cont; |
|
351 | 351 | }; |
@@ -448,7 +448,7 b' define([' | |||
|
448 | 448 | // JSON serialization |
|
449 | 449 | |
|
450 | 450 | CodeCell.prototype.fromJSON = function (data) { |
|
451 | Cell.prototype.fromJSON.apply(this, arguments); | |
|
451 | cell.Cell.prototype.fromJSON.apply(this, arguments); | |
|
452 | 452 | if (data.cell_type === 'code') { |
|
453 | 453 | if (data.input !== undefined) { |
|
454 | 454 | this.set_text(data.input); |
@@ -476,7 +476,7 b' define([' | |||
|
476 | 476 | |
|
477 | 477 | |
|
478 | 478 | CodeCell.prototype.toJSON = function () { |
|
479 | var data = Cell.prototype.toJSON.apply(this); | |
|
479 | var data = cell.Cell.prototype.toJSON.apply(this); | |
|
480 | 480 | data.input = this.get_text(); |
|
481 | 481 | // is finite protect against undefined and '*' value |
|
482 | 482 | if (isFinite(this.input_prompt_number)) { |
@@ -496,7 +496,7 b' define([' | |||
|
496 | 496 | * @return is the action being taken |
|
497 | 497 | */ |
|
498 | 498 | CodeCell.prototype.unselect = function () { |
|
499 | var cont = Cell.prototype.unselect.apply(this); | |
|
499 | var cont = cell.Cell.prototype.unselect.apply(this); | |
|
500 | 500 | if (cont) { |
|
501 | 501 | // When a code cell is usnelected, make sure that the corresponding |
|
502 | 502 | // tooltip and completer to that cell is closed. |
@@ -49,18 +49,18 b' require([' | |||
|
49 | 49 | }; |
|
50 | 50 | |
|
51 | 51 | var user_config = $.extend({}, config.default_config); |
|
52 | var page = new Page(); | |
|
53 | var layout_manager = new LayoutManager(); | |
|
54 | var events = $([new Events()]); | |
|
55 | var pager = new Pager('div#pager', 'div#pager_splitter', layout_manager, events); | |
|
56 | var keyboard_manager = new KeyboardManager(pager, events); | |
|
57 | var save_widget = new SaveWidget('span#save_widget', events); | |
|
58 | var notebook = new Notebook('div#notebook', options, events, keyboard_manager, save_widget, user_config); | |
|
59 | var login_widget = new LoginWidget('span#login_widget', options); | |
|
60 | var toolbar = new MainToolBar('#maintoolbar-container', layout_manager, notebook, events); | |
|
61 | var quick_help = new QuickHelp(undefined, keyboard_manager, events); | |
|
62 | var menubar = new MenuBar('#menubar', options, notebook, layout_manager, events, save_widget, quick_help); | |
|
63 | var notification_area = new NotificationArea('#notification_area', events, save_widget, notebook); | |
|
52 | var page = new page.Page(); | |
|
53 | var layout_manager = new layoutmanager.LayoutManager(); | |
|
54 | var events = $([new events.Events()]); | |
|
55 | var pager = new pager.Pager('div#pager', 'div#pager_splitter', layout_manager, events); | |
|
56 | var keyboard_manager = new keyboardmanager.KeyboardManager(pager, events); | |
|
57 | var save_widget = new savewidget.SaveWidget('span#save_widget', events); | |
|
58 | var notebook = new notebook.Notebook('div#notebook', options, events, keyboard_manager, save_widget, user_config); | |
|
59 | var login_widget = new loginwidget.LoginWidget('span#login_widget', options); | |
|
60 | var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', layout_manager, notebook, events); | |
|
61 | var quick_help = new quickhelp.QuickHelp(undefined, keyboard_manager, events); | |
|
62 | var menubar = new menubar.MenuBar('#menubar', options, notebook, layout_manager, events, save_widget, quick_help); | |
|
63 | var notification_area = new notificationarea.NotificationArea('#notification_area', events, save_widget, notebook); | |
|
64 | 64 | notification_area.init_notification_widgets(); |
|
65 | 65 | |
|
66 | 66 | layout_manager.do_resize(); |
@@ -10,7 +10,7 b' define([' | |||
|
10 | 10 | "use strict"; |
|
11 | 11 | |
|
12 | 12 | var MainToolBar = function (selector, layout_manager, notebook, events) { |
|
13 | Toolbar.apply(this, arguments); | |
|
13 | toolbar.Toolbar.apply(this, arguments); | |
|
14 | 14 | this.events = events; |
|
15 | 15 | this.notebook = notebook; |
|
16 | 16 | this.construct(); |
@@ -19,7 +19,7 b' define([' | |||
|
19 | 19 | this.bind_events(); |
|
20 | 20 | }; |
|
21 | 21 | |
|
22 | MainToolBar.prototype = new Toolbar(); | |
|
22 | MainToolBar.prototype = new toolbar.Toolbar(); | |
|
23 | 23 | |
|
24 | 24 | MainToolBar.prototype.construct = function () { |
|
25 | 25 | this.add_buttons_group([ |
@@ -152,16 +152,16 b' define([' | |||
|
152 | 152 | select.change(function() { |
|
153 | 153 | var val = $(this).val(); |
|
154 | 154 | if (val ==='') { |
|
155 | CellToolbar.global_hide(); | |
|
155 | celltoolbar.CellToolbar.global_hide(); | |
|
156 | 156 | delete this.notebook.metadata.celltoolbar; |
|
157 | 157 | } else { |
|
158 | CellToolbar.global_show(); | |
|
159 | CellToolbar.activate_preset(val); | |
|
158 | celltoolbar.CellToolbar.global_show(); | |
|
159 | celltoolbar.CellToolbar.activate_preset(val); | |
|
160 | 160 | this.notebook.metadata.celltoolbar = val; |
|
161 | 161 | } |
|
162 | 162 | }); |
|
163 | 163 | // Setup the currently registered presets. |
|
164 | var presets = CellToolbar.list_presets(); | |
|
164 | var presets = celltoolbar.CellToolbar.list_presets(); | |
|
165 | 165 | for (var i=0; i<presets.length; i++) { |
|
166 | 166 | var name = presets[i]; |
|
167 | 167 | select.append($('<option/>').attr('value', name).text(name)); |
@@ -5,7 +5,7 b' define([' | |||
|
5 | 5 | 'jquery', |
|
6 | 6 | 'base/js/utils', |
|
7 | 7 | 'base/js/dialog', |
|
8 |
], function($, utils, |
|
|
8 | ], function($, utils, dialog) { | |
|
9 | 9 | "use strict"; |
|
10 | 10 | |
|
11 | 11 | var init = function () { |
@@ -68,7 +68,7 b' define([' | |||
|
68 | 68 | "which will prevent this dialog from appearing." |
|
69 | 69 | ) |
|
70 | 70 | ); |
|
71 |
|
|
|
71 | dialog.modal({ | |
|
72 | 72 | title : "Failed to retrieve MathJax from '" + window.mathjax_url + "'", |
|
73 | 73 | body : message, |
|
74 | 74 | buttons : { |
@@ -7,7 +7,7 b' define([' | |||
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'notebook/js/tour', |
|
9 | 9 | 'components/bootstrap-tour/build/js/bootstrap-tour.min', |
|
10 |
], function(IPython, $, utils, |
|
|
10 | ], function(IPython, $, utils, tour) { | |
|
11 | 11 | "use strict"; |
|
12 | 12 | |
|
13 | 13 | /** |
@@ -35,7 +35,7 b' define([' | |||
|
35 | 35 | this.quick_help = quick_help; |
|
36 | 36 | |
|
37 | 37 | try { |
|
38 | this.tour = new Tour(notebook, events); | |
|
38 | this.tour = new tour.Tour(notebook, events); | |
|
39 | 39 | } catch (e) { |
|
40 | 40 | this.tour = undefined; |
|
41 | 41 | console.log("Failed to instantiate Notebook Tour", e); |
@@ -19,11 +19,11 b' define([' | |||
|
19 | 19 | IPython, |
|
20 | 20 | $, |
|
21 | 21 | utils, |
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
22 | dialog, | |
|
23 | cells, | |
|
24 | codecell, | |
|
25 | session, | |
|
26 | celltoolbar, | |
|
27 | 27 | marked, |
|
28 | 28 | mathjaxutils, |
|
29 | 29 | keyboard |
@@ -184,7 +184,7 b' define([' | |||
|
184 | 184 | }); |
|
185 | 185 | |
|
186 | 186 | this.events.on('status_autorestarting.Kernel', function () { |
|
187 |
|
|
|
187 | dialog.modal({ | |
|
188 | 188 | title: "Kernel Restarting", |
|
189 | 189 | body: "The kernel appears to have died. It will restart automatically.", |
|
190 | 190 | buttons: { |
@@ -307,7 +307,7 b' define([' | |||
|
307 | 307 | |
|
308 | 308 | Notebook.prototype.edit_metadata = function () { |
|
309 | 309 | var that = this; |
|
310 |
|
|
|
310 | dialog.edit_metadata(this.metadata, function (md) { | |
|
311 | 311 | that.metadata = md; |
|
312 | 312 | }, 'Notebook'); |
|
313 | 313 | }; |
@@ -348,7 +348,7 b' define([' | |||
|
348 | 348 | * @return {Cell} Cell or null if no cell was found. |
|
349 | 349 | */ |
|
350 | 350 | Notebook.prototype.get_msg_cell = function (msg_id) { |
|
351 | return CodeCell.msg_cells[msg_id] || null; | |
|
351 | return codecell.CodeCell.msg_cells[msg_id] || null; | |
|
352 | 352 | }; |
|
353 | 353 | |
|
354 | 354 | /** |
@@ -807,14 +807,14 b' define([' | |||
|
807 | 807 | |
|
808 | 808 | if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { |
|
809 | 809 | if (type === 'code') { |
|
810 | cell = new CodeCell(this.kernel, this.options, this.events, this.config, this.keyboard_manager, this); | |
|
810 | cell = new codecell.CodeCell(this.kernel, this.options, this.events, this.config, this.keyboard_manager, this); | |
|
811 | 811 | cell.set_input_prompt(); |
|
812 | 812 | } else if (type === 'markdown') { |
|
813 | cell = new Cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this); | |
|
813 | cell = new cells.Cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this); | |
|
814 | 814 | } else if (type === 'raw') { |
|
815 | cell = new Cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this); | |
|
815 | cell = new cells.Cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this); | |
|
816 | 816 | } else if (type === 'heading') { |
|
817 | cell = new Cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this); | |
|
817 | cell = new cells.Cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this); | |
|
818 | 818 | } |
|
819 | 819 | |
|
820 | 820 | if(this._insert_element_at_index(cell.element,index)) { |
@@ -959,7 +959,7 b' define([' | |||
|
959 | 959 | if (this.is_valid_cell_index(i)) { |
|
960 | 960 | var source_element = this.get_cell_element(i); |
|
961 | 961 | var source_cell = source_element.data("cell"); |
|
962 | if (!(source_cell instanceof Cells.MarkdownCell)) { | |
|
962 | if (!(source_cell instanceof cells.Cells.MarkdownCell)) { | |
|
963 | 963 | var target_cell = this.insert_cell_below('markdown',i); |
|
964 | 964 | var text = source_cell.get_text(); |
|
965 | 965 | if (text === source_cell.placeholder) { |
@@ -973,7 +973,7 b' define([' | |||
|
973 | 973 | target_cell.code_mirror.clearHistory(); |
|
974 | 974 | source_element.remove(); |
|
975 | 975 | this.select(i); |
|
976 | if ((source_cell instanceof Cells.TextCell) && source_cell.rendered) { | |
|
976 | if ((source_cell instanceof cells.Cells.TextCell) && source_cell.rendered) { | |
|
977 | 977 | target_cell.render(); |
|
978 | 978 | } |
|
979 | 979 | var cursor = source_cell.code_mirror.getCursor(); |
@@ -995,7 +995,7 b' define([' | |||
|
995 | 995 | var source_element = this.get_cell_element(i); |
|
996 | 996 | var source_cell = source_element.data("cell"); |
|
997 | 997 | var target_cell = null; |
|
998 | if (!(source_cell instanceof Cells.RawCell)) { | |
|
998 | if (!(source_cell instanceof cells.Cells.RawCell)) { | |
|
999 | 999 | target_cell = this.insert_cell_below('raw',i); |
|
1000 | 1000 | var text = source_cell.get_text(); |
|
1001 | 1001 | if (text === source_cell.placeholder) { |
@@ -1030,7 +1030,7 b' define([' | |||
|
1030 | 1030 | var source_element = this.get_cell_element(i); |
|
1031 | 1031 | var source_cell = source_element.data("cell"); |
|
1032 | 1032 | var target_cell = null; |
|
1033 | if (source_cell instanceof Cells.HeadingCell) { | |
|
1033 | if (source_cell instanceof cells.Cells.HeadingCell) { | |
|
1034 | 1034 | source_cell.set_level(level); |
|
1035 | 1035 | } else { |
|
1036 | 1036 | target_cell = this.insert_cell_below('heading',i); |
@@ -1049,7 +1049,7 b' define([' | |||
|
1049 | 1049 | this.select(i); |
|
1050 | 1050 | var cursor = source_cell.code_mirror.getCursor(); |
|
1051 | 1051 | target_cell.code_mirror.setCursor(cursor); |
|
1052 | if ((source_cell instanceof Cells.TextCell) && source_cell.rendered) { | |
|
1052 | if ((source_cell instanceof cells.Cells.TextCell) && source_cell.rendered) { | |
|
1053 | 1053 | target_cell.render(); |
|
1054 | 1054 | } |
|
1055 | 1055 | } |
@@ -1168,8 +1168,8 b' define([' | |||
|
1168 | 1168 | * @method split_cell |
|
1169 | 1169 | */ |
|
1170 | 1170 | Notebook.prototype.split_cell = function () { |
|
1171 | var mdc = Cells.MarkdownCell; | |
|
1172 | var rc = Cells.RawCell; | |
|
1171 | var mdc = cells.Cells.MarkdownCell; | |
|
1172 | var rc = cells.Cells.RawCell; | |
|
1173 | 1173 | var cell = this.get_selected_cell(); |
|
1174 | 1174 | if (cell.is_splittable()) { |
|
1175 | 1175 | var texta = cell.get_pre_cursor(); |
@@ -1197,8 +1197,8 b' define([' | |||
|
1197 | 1197 | * @method merge_cell_above |
|
1198 | 1198 | */ |
|
1199 | 1199 | Notebook.prototype.merge_cell_above = function () { |
|
1200 | var mdc = Cells.MarkdownCell; | |
|
1201 | var rc = Cells.RawCell; | |
|
1200 | var mdc = cells.Cells.MarkdownCell; | |
|
1201 | var rc = cells.Cells.RawCell; | |
|
1202 | 1202 | var index = this.get_selected_index(); |
|
1203 | 1203 | var cell = this.get_cell(index); |
|
1204 | 1204 | var render = cell.rendered; |
@@ -1234,8 +1234,8 b' define([' | |||
|
1234 | 1234 | * @method merge_cell_below |
|
1235 | 1235 | */ |
|
1236 | 1236 | Notebook.prototype.merge_cell_below = function () { |
|
1237 | var mdc = Cells.MarkdownCell; | |
|
1238 | var rc = Cells.RawCell; | |
|
1237 | var mdc = cells.Cells.MarkdownCell; | |
|
1238 | var rc = cells.Cells.RawCell; | |
|
1239 | 1239 | var index = this.get_selected_index(); |
|
1240 | 1240 | var cell = this.get_cell(index); |
|
1241 | 1241 | var render = cell.rendered; |
@@ -1465,7 +1465,7 b' define([' | |||
|
1465 | 1465 | * @method start_session |
|
1466 | 1466 | */ |
|
1467 | 1467 | Notebook.prototype.start_session = function () { |
|
1468 | this.session = new Session(this, this.options); | |
|
1468 | this.session = new session.Session(this, this.options); | |
|
1469 | 1469 | this.session.start($.proxy(this._session_started, this)); |
|
1470 | 1470 | }; |
|
1471 | 1471 | |
@@ -1493,7 +1493,7 b' define([' | |||
|
1493 | 1493 | */ |
|
1494 | 1494 | Notebook.prototype.restart_kernel = function () { |
|
1495 | 1495 | var that = this; |
|
1496 |
|
|
|
1496 | dialog.modal({ | |
|
1497 | 1497 | title : "Restart kernel or continue running?", |
|
1498 | 1498 | body : $("<p/>").text( |
|
1499 | 1499 | 'Do you want to restart the current kernel? You will lose all variables defined in it.' |
@@ -1716,7 +1716,7 b' define([' | |||
|
1716 | 1716 | this.events.trigger("trust_changed.Notebook", trusted); |
|
1717 | 1717 | } |
|
1718 | 1718 | if (content.worksheets.length > 1) { |
|
1719 |
|
|
|
1719 | dialog.modal({ | |
|
1720 | 1720 | title : "Multiple worksheets", |
|
1721 | 1721 | body : "This notebook has " + data.worksheets.length + " worksheets, " + |
|
1722 | 1722 | "but this version of IPython can only handle the first. " + |
@@ -1904,7 +1904,7 b' define([' | |||
|
1904 | 1904 | ); |
|
1905 | 1905 | |
|
1906 | 1906 | var nb = this; |
|
1907 |
|
|
|
1907 | dialog.modal({ | |
|
1908 | 1908 | title: "Trust this notebook?", |
|
1909 | 1909 | body: body, |
|
1910 | 1910 | |
@@ -2049,7 +2049,7 b' define([' | |||
|
2049 | 2049 | .text('This notebook name already exists.') |
|
2050 | 2050 | ); |
|
2051 | 2051 | this.events.trigger('notebook_rename_failed.Notebook', [xhr, status, error]); |
|
2052 |
|
|
|
2052 | dialog.modal({ | |
|
2053 | 2053 | title: "Notebook Rename Error!", |
|
2054 | 2054 | body: dialog, |
|
2055 | 2055 | buttons : { |
@@ -2130,7 +2130,7 b' define([' | |||
|
2130 | 2130 | "newer notebook format will be used and older versions of IPython " + |
|
2131 | 2131 | "may not be able to read it. To keep the older version, close the " + |
|
2132 | 2132 | "notebook without saving it."; |
|
2133 |
|
|
|
2133 | dialog.modal({ | |
|
2134 | 2134 | title : "Notebook converted", |
|
2135 | 2135 | body : msg, |
|
2136 | 2136 | buttons : { |
@@ -2147,7 +2147,7 b' define([' | |||
|
2147 | 2147 | this_vs + ". You can still work with this notebook, but some features " + |
|
2148 | 2148 | "introduced in later notebook versions may not be available."; |
|
2149 | 2149 | |
|
2150 |
|
|
|
2150 | dialog.modal({ | |
|
2151 | 2151 | title : "Newer Notebook", |
|
2152 | 2152 | body : msg, |
|
2153 | 2153 | buttons : { |
@@ -2169,10 +2169,10 b' define([' | |||
|
2169 | 2169 | |
|
2170 | 2170 | // load toolbar state |
|
2171 | 2171 | if (this.metadata.celltoolbar) { |
|
2172 | CellToolbar.global_show(); | |
|
2173 | CellToolbar.activate_preset(this.metadata.celltoolbar); | |
|
2172 | celltoolbar.CellToolbar.global_show(); | |
|
2173 | celltoolbar.CellToolbar.activate_preset(this.metadata.celltoolbar); | |
|
2174 | 2174 | } else { |
|
2175 | CellToolbar.global_hide(); | |
|
2175 | celltoolbar.CellToolbar.global_hide(); | |
|
2176 | 2176 | } |
|
2177 | 2177 | |
|
2178 | 2178 | // now that we're fully loaded, it is safe to restore save functionality |
@@ -2198,7 +2198,7 b' define([' | |||
|
2198 | 2198 | "This version can load notebook formats " + |
|
2199 | 2199 | "v" + this.nbformat + " or earlier."; |
|
2200 | 2200 | } |
|
2201 |
|
|
|
2201 | dialog.modal({ | |
|
2202 | 2202 | title: "Error loading notebook", |
|
2203 | 2203 | body : msg, |
|
2204 | 2204 | buttons : { |
@@ -2362,7 +2362,7 b' define([' | |||
|
2362 | 2362 | ).css("text-align", "center") |
|
2363 | 2363 | ); |
|
2364 | 2364 | |
|
2365 |
|
|
|
2365 | dialog.modal({ | |
|
2366 | 2366 | title : "Revert notebook to checkpoint", |
|
2367 | 2367 | body : body, |
|
2368 | 2368 | buttons : { |
@@ -7,7 +7,7 b' define([' | |||
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'base/js/dialog', |
|
9 | 9 | 'notebook/js/notificationwidget', |
|
10 |
], function(IPython, $, utils, |
|
|
10 | ], function(IPython, $, utils, dialog, notificationwidget) { | |
|
11 | 11 | "use strict"; |
|
12 | 12 | |
|
13 | 13 | var NotificationArea = function (selector, events, save_widget, notebook) { |
@@ -62,7 +62,7 b' define([' | |||
|
62 | 62 | } |
|
63 | 63 | var div = $('<div/>').attr('id','notification_'+name); |
|
64 | 64 | $(this.selector).append(div); |
|
65 | this.widget_dict[name] = new NotificationWidget('#notification_'+name); | |
|
65 | this.widget_dict[name] = new notificationwidget.NotificationWidget('#notification_'+name); | |
|
66 | 66 | return this.widget_dict[name]; |
|
67 | 67 | }; |
|
68 | 68 | |
@@ -123,7 +123,7 b' define([' | |||
|
123 | 123 | ' the notebook, but running code will no longer work until the notebook' + |
|
124 | 124 | ' is reopened.'; |
|
125 | 125 | |
|
126 |
|
|
|
126 | dialog.modal({ | |
|
127 | 127 | title: "Dead kernel", |
|
128 | 128 | body : msg, |
|
129 | 129 | buttons : { |
@@ -155,7 +155,7 b' define([' | |||
|
155 | 155 | msg = "A WebSocket connection could not be established." + |
|
156 | 156 | " You will NOT be able to run code. Check your" + |
|
157 | 157 | " network connection or notebook server configuration."; |
|
158 |
|
|
|
158 | dialog.modal({ | |
|
159 | 159 | title: "WebSocket connection failed", |
|
160 | 160 | body: msg, |
|
161 | 161 | buttons : { |
@@ -6,7 +6,7 b' define([' | |||
|
6 | 6 | 'jquery', |
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'base/js/dialog', |
|
9 |
], function(IPython, $, utils, |
|
|
9 | ], function(IPython, $, utils, dialog) { | |
|
10 | 10 | "use strict"; |
|
11 | 11 | var platform = utils.platform; |
|
12 | 12 | |
@@ -99,7 +99,7 b' define([' | |||
|
99 | 99 | var edit_div = this.build_edit_help(cm_shortcuts); |
|
100 | 100 | element.append(edit_div); |
|
101 | 101 | |
|
102 |
this.shortcut_dialog = |
|
|
102 | this.shortcut_dialog = dialog.modal({ | |
|
103 | 103 | title : "Keyboard shortcuts", |
|
104 | 104 | body : element, |
|
105 | 105 | destroy : false, |
@@ -8,7 +8,7 b' define([' | |||
|
8 | 8 | 'base/js/dialog', |
|
9 | 9 | 'base/js/keyboard', |
|
10 | 10 | 'dateformat/date.format', |
|
11 |
], function(IPython, $, utils, |
|
|
11 | ], function(IPython, $, utils, dialog, keyboard) { | |
|
12 | 12 | "use strict"; |
|
13 | 13 | |
|
14 | 14 | var SaveWidget = function (selector, events) { |
@@ -76,7 +76,7 b' define([' | |||
|
76 | 76 | $('<input/>').attr('type','text').attr('size','25').addClass('form-control') |
|
77 | 77 | .val(that.notebook.get_notebook_name()) |
|
78 | 78 | ); |
|
79 |
|
|
|
79 | dialog.modal({ | |
|
80 | 80 | title: "Rename Notebook", |
|
81 | 81 | body: dialog, |
|
82 | 82 | buttons : { |
@@ -8,7 +8,7 b' define([' | |||
|
8 | 8 | 'base/js/security', |
|
9 | 9 | 'notebook/js/mathjaxutils', |
|
10 | 10 | 'notebook/js/celltoolbar', |
|
11 |
], function(IPython, $, |
|
|
11 | ], function(IPython, $, cell, security, mathjaxutils, celltoolbar) { | |
|
12 | 12 | "use strict"; |
|
13 | 13 | |
|
14 | 14 | /** |
@@ -41,12 +41,12 b' define([' | |||
|
41 | 41 | this.cell_type = this.cell_type || 'text'; |
|
42 | 42 | mathjaxutils = mathjaxutils; |
|
43 | 43 | |
|
44 | Cell.apply(this, [options, keyboard_manager, events]); | |
|
44 | cell.Cell.apply(this, [options, keyboard_manager, events]); | |
|
45 | 45 | |
|
46 | 46 | this.rendered = false; |
|
47 | 47 | }; |
|
48 | 48 | |
|
49 | TextCell.prototype = new Cell(); | |
|
49 | TextCell.prototype = new cell.Cell(); | |
|
50 | 50 | |
|
51 | 51 | TextCell.options_default = { |
|
52 | 52 | cm_config : { |
@@ -63,7 +63,7 b' define([' | |||
|
63 | 63 | * @private |
|
64 | 64 | */ |
|
65 | 65 | TextCell.prototype.create_element = function () { |
|
66 | Cell.prototype.create_element.apply(this, arguments); | |
|
66 | cell.Cell.prototype.create_element.apply(this, arguments); | |
|
67 | 67 | |
|
68 | 68 | var cell = $("<div>").addClass('cell text_cell border-box-sizing'); |
|
69 | 69 | cell.attr('tabindex','2'); |
@@ -71,7 +71,7 b' define([' | |||
|
71 | 71 | var prompt = $('<div/>').addClass('prompt input_prompt'); |
|
72 | 72 | cell.append(prompt); |
|
73 | 73 | var inner_cell = $('<div/>').addClass('inner_cell'); |
|
74 | this.celltoolbar = new CellToolbar(this, this.events, this.notebook); | |
|
74 | this.celltoolbar = new celltoolbar.CellToolbar(this, this.events, this.notebook); | |
|
75 | 75 | inner_cell.append(this.celltoolbar.element); |
|
76 | 76 | var input_area = $('<div/>').addClass('input_area'); |
|
77 | 77 | this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); |
@@ -91,7 +91,7 b' define([' | |||
|
91 | 91 | * @method bind_event |
|
92 | 92 | */ |
|
93 | 93 | TextCell.prototype.bind_events = function () { |
|
94 | Cell.prototype.bind_events.apply(this); | |
|
94 | cell.Cell.prototype.bind_events.apply(this); | |
|
95 | 95 | var that = this; |
|
96 | 96 | |
|
97 | 97 | this.element.dblclick(function () { |
@@ -108,7 +108,7 b' define([' | |||
|
108 | 108 | // Cell level actions |
|
109 | 109 | |
|
110 | 110 | TextCell.prototype.select = function () { |
|
111 | var cont = Cell.prototype.select.apply(this); | |
|
111 | var cont = cell.Cell.prototype.select.apply(this); | |
|
112 | 112 | if (cont) { |
|
113 | 113 | if (this.mode === 'edit') { |
|
114 | 114 | this.code_mirror.refresh(); |
@@ -119,7 +119,7 b' define([' | |||
|
119 | 119 | |
|
120 | 120 | TextCell.prototype.unrender = function () { |
|
121 | 121 | if (this.read_only) return; |
|
122 | var cont = Cell.prototype.unrender.apply(this); | |
|
122 | var cont = cell.Cell.prototype.unrender.apply(this); | |
|
123 | 123 | if (cont) { |
|
124 | 124 | var text_cell = this.element; |
|
125 | 125 | var output = text_cell.find("div.text_cell_render"); |
@@ -182,7 +182,7 b' define([' | |||
|
182 | 182 | * @method fromJSON |
|
183 | 183 | */ |
|
184 | 184 | TextCell.prototype.fromJSON = function (data) { |
|
185 | Cell.prototype.fromJSON.apply(this, arguments); | |
|
185 | cell.Cell.prototype.fromJSON.apply(this, arguments); | |
|
186 | 186 | if (data.cell_type === this.cell_type) { |
|
187 | 187 | if (data.source !== undefined) { |
|
188 | 188 | this.set_text(data.source); |
@@ -202,7 +202,7 b' define([' | |||
|
202 | 202 | * @return {object} cell data serialised to json |
|
203 | 203 | */ |
|
204 | 204 | TextCell.prototype.toJSON = function () { |
|
205 | var data = Cell.prototype.toJSON.apply(this); | |
|
205 | var data = cell.Cell.prototype.toJSON.apply(this); | |
|
206 | 206 | data.source = this.get_text(); |
|
207 | 207 | if (data.source == this.placeholder) { |
|
208 | 208 | data.source = ""; |
@@ -246,7 +246,7 b' define([' | |||
|
246 | 246 | math = text_and_math[1]; |
|
247 | 247 | var html = marked.parser(marked.lexer(text)); |
|
248 | 248 | html = mathjaxutils.replace_math(html, math); |
|
249 | html = Security.sanitize_html(html); | |
|
249 | html = security.Security.sanitize_html(html); | |
|
250 | 250 | html = $($.parseHTML(html)); |
|
251 | 251 | // links in markdown cells should open in new tabs |
|
252 | 252 | html.find("a[href]").not('[href^="#"]').attr("target", "_blank"); |
@@ -417,7 +417,7 b' define([' | |||
|
417 | 417 | math = text_and_math[1]; |
|
418 | 418 | var html = marked.parser(marked.lexer(text)); |
|
419 | 419 | html = mathjaxutils.replace_math(html, math); |
|
420 | html = Security.sanitize_html(html); | |
|
420 | html = security.Security.sanitize_html(html); | |
|
421 | 421 | var h = $($.parseHTML(html)); |
|
422 | 422 | // add id and linkback anchor |
|
423 | 423 | var hash = h.text().replace(/ /g, '-'); |
@@ -112,7 +112,7 b' define([' | |||
|
112 | 112 | title: "Fin.", |
|
113 | 113 | placement: 'bottom', |
|
114 | 114 | orphan: true, |
|
115 | content: "This concludes the IPython Notebook User Interface Tour. Happy hacking!", | |
|
115 | content: "This concludes the IPython Notebook User Interface tour.Tour. Happy hacking!", | |
|
116 | 116 | } |
|
117 | 117 | ]; |
|
118 | 118 | |
@@ -164,7 +164,7 b' define([' | |||
|
164 | 164 | // For backwards compatability. |
|
165 | 165 | IPython.NotebookTour = NotebookTour; |
|
166 | 166 | |
|
167 |
return {' |
|
|
167 | return {'Tour': NotebookTour}; | |
|
168 | 168 | |
|
169 | 169 | }); |
|
170 | 170 |
@@ -7,7 +7,7 b' define([' | |||
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'services/kernels/js/comm', |
|
9 | 9 | 'widgets/js/init', |
|
10 |
], function(IPython, $, utils, comm, |
|
|
10 | ], function(IPython, $, utils, comm, widgetmanager) { | |
|
11 | 11 | "use strict"; |
|
12 | 12 | |
|
13 | 13 | // Initialization and connection. |
@@ -39,7 +39,7 b' define([' | |||
|
39 | 39 | this.bind_events(); |
|
40 | 40 | this.init_iopub_handlers(); |
|
41 | 41 | this.comm_manager = new comm.CommManager(this); |
|
42 | this.widget_manager = new WidgetManager(this.comm_manager, notebook); | |
|
42 | this.widget_manager = new widgetmanager.WidgetManager(this.comm_manager, notebook); | |
|
43 | 43 | |
|
44 | 44 | this.last_msg_id = null; |
|
45 | 45 | this.last_msg_callbacks = {}; |
@@ -6,7 +6,7 b' define([' | |||
|
6 | 6 | 'jquery', |
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'services/kernels/js/kernel', |
|
9 |
], function(IPython, $, utils, |
|
|
9 | ], function(IPython, $, utils, kernel) { | |
|
10 | 10 | "use strict"; |
|
11 | 11 | |
|
12 | 12 | var Session = function(notebook, options){ |
@@ -87,7 +87,7 b' define([' | |||
|
87 | 87 | Session.prototype._handle_start_success = function (data, status, xhr) { |
|
88 | 88 | this.id = data.id; |
|
89 | 89 | var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels"); |
|
90 | this.kernel = new Kernel(kernel_service_url, this.notebook); | |
|
90 | this.kernel = new kernel.Kernel(kernel_service_url, this.notebook); | |
|
91 | 91 | this.kernel._kernel_started(data.kernel); |
|
92 | 92 | }; |
|
93 | 93 |
@@ -5,11 +5,11 b' define([' | |||
|
5 | 5 | 'base/js/namespace', |
|
6 | 6 | 'jquery', |
|
7 | 7 | 'tree/js/notebooklist', |
|
8 |
], function(IPython, $, |
|
|
8 | ], function(IPython, $, notebooklist) { | |
|
9 | 9 | "use strict"; |
|
10 | 10 | |
|
11 | 11 | var KernelList = function (selector, options, session_list) { |
|
12 | NotebookList.call(this, selector, options, 'running', session_list); | |
|
12 | notebooklist.NotebookList.call(this, selector, options, 'running', session_list); | |
|
13 | 13 | }; |
|
14 | 14 | |
|
15 | 15 | KernelList.prototype = Object.create(NotebookList.prototype); |
@@ -18,32 +18,32 b' require([' | |||
|
18 | 18 | ], function( |
|
19 | 19 | IPython, |
|
20 | 20 | $, |
|
21 |
|
|
|
22 |
|
|
|
21 | events, | |
|
22 | page, | |
|
23 | 23 | utils, |
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 | ||
|
30 | page = new Page(); | |
|
24 | notebooklist, | |
|
25 | clusterlist, | |
|
26 | sesssionlist, | |
|
27 | kernellist, | |
|
28 | loginwidget){ | |
|
31 | 29 | |
|
30 | page = new page.Page(); | |
|
31 | ||
|
32 | 32 | var opts = { |
|
33 | 33 | base_url: utils.get_body_data("baseUrl"), |
|
34 | 34 | notebook_path: utils.get_body_data("notebookPath"), |
|
35 | 35 | }; |
|
36 | events = $([new Events()]); | |
|
37 | session_list = new SesssionList(opts, events); | |
|
38 | notebook_list = new NotebookList('#notebook_list', opts, undefined, session_list); | |
|
39 | cluster_list = new ClusterList('#cluster_list', opts); | |
|
40 | kernel_list = new KernelList('#running_list', opts, session_list); | |
|
41 | login_widget = new LoginWidget('#login_widget', opts); | |
|
36 | events = $([new events.Events()]); | |
|
37 | session_list = new sesssionlist.SesssionList(opts, events); | |
|
38 | notebook_list = new notebooklist.NotebookList('#notebook_list', opts, undefined, session_list); | |
|
39 | cluster_list = new clusterlist.ClusterList('#cluster_list', opts); | |
|
40 | kernel_list = new kernellist.KernelList('#running_list', opts, session_list); | |
|
41 | login_widget = new loginwidget.LoginWidget('#login_widget', opts); | |
|
42 | 42 | |
|
43 | 43 | $('#new_notebook').button().click(function (e) { |
|
44 | 44 | notebook_list.new_notebook(); |
|
45 | 45 | }); |
|
46 | ||
|
46 | ||
|
47 | 47 | var interval_id=0; |
|
48 | 48 | // auto refresh every xx secondes, no need to be fast, |
|
49 | 49 | // update is done at least when page get focus |
@@ -6,7 +6,7 b' define([' | |||
|
6 | 6 | 'jquery', |
|
7 | 7 | 'base/js/utils', |
|
8 | 8 | 'base/js/dialog', |
|
9 |
], function(IPython, $, utils, |
|
|
9 | ], function(IPython, $, utils, dialog) { | |
|
10 | 10 | "use strict"; |
|
11 | 11 | |
|
12 | 12 | var NotebookList = function (selector, options, element_name, session_list) { |
@@ -83,7 +83,7 b' define([' | |||
|
83 | 83 | }; |
|
84 | 84 | } else { |
|
85 | 85 | var dialog = 'Uploaded notebooks must be .ipynb files'; |
|
86 |
|
|
|
86 | dialog.modal({ | |
|
87 | 87 | title : 'Invalid file type', |
|
88 | 88 | body : dialog, |
|
89 | 89 | buttons : {'OK' : {'class' : 'btn-primary'}} |
@@ -299,7 +299,7 b' define([' | |||
|
299 | 299 | var parent_item = that.parents('div.list_item'); |
|
300 | 300 | var nbname = parent_item.data('nbname'); |
|
301 | 301 | var message = 'Are you sure you want to permanently delete the notebook: ' + nbname + '?'; |
|
302 |
|
|
|
302 | dialog.modal({ | |
|
303 | 303 | title : "Delete notebook", |
|
304 | 304 | body : message, |
|
305 | 305 | buttons : { |
@@ -424,7 +424,7 b' define([' | |||
|
424 | 424 | } else { |
|
425 | 425 | msg = xhr.statusText; |
|
426 | 426 | } |
|
427 |
|
|
|
427 | dialog.modal({ | |
|
428 | 428 | title : 'Creating Notebook Failed', |
|
429 | 429 | body : "The error was: " + msg, |
|
430 | 430 | buttons : {'OK' : {'class' : 'btn-primary'}} |
@@ -23,5 +23,5 b' define([' | |||
|
23 | 23 | } |
|
24 | 24 | } |
|
25 | 25 | |
|
26 | return WidgetManager; | |
|
26 | return {'WidgetManager': WidgetManager}; | |
|
27 | 27 | }); |
@@ -4,7 +4,7 b'' | |||
|
4 | 4 | define(["widgets/js/manager", |
|
5 | 5 | "underscore", |
|
6 | 6 | "backbone"], |
|
7 |
function( |
|
|
7 | function(widgetmanager, _, Backbone){ | |
|
8 | 8 | |
|
9 | 9 | var WidgetModel = Backbone.Model.extend({ |
|
10 | 10 | constructor: function (widget_manager, model_id, comm) { |
@@ -261,7 +261,7 b' function(WidgetManager, _, Backbone){' | |||
|
261 | 261 | }, |
|
262 | 262 | |
|
263 | 263 | }); |
|
264 | WidgetManager.register_widget_model('WidgetModel', WidgetModel); | |
|
264 | widgetmanager.WidgetManager.register_widget_model('WidgetModel', WidgetModel); | |
|
265 | 265 | |
|
266 | 266 | |
|
267 | 267 | var WidgetView = Backbone.View.extend({ |
General Comments 0
You need to be logged in to leave comments.
Login now