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