From a3cc0b0b897cf47713f14e134c0278a01fe5a03b 2014-07-10 20:47:22 From: Jonathan Frederic Date: 2014-07-10 20:47:22 Subject: [PATCH] Fix imports of "modules", required after converting everything into dictionary returns. --- diff --git a/IPython/html/static/base/js/dialog.js b/IPython/html/static/base/js/dialog.js index 0cb4e4e..4a66302 100644 --- a/IPython/html/static/base/js/dialog.js +++ b/IPython/html/static/base/js/dialog.js @@ -154,5 +154,5 @@ define([ // Backwards compatability. IPython.Dialog = Dialog; - return {'Dialog': Dialog}; + return Dialog; }); diff --git a/IPython/html/static/notebook/js/celltoolbar.js b/IPython/html/static/notebook/js/celltoolbar.js index 72270d5..a5f4c83 100644 --- a/IPython/html/static/notebook/js/celltoolbar.js +++ b/IPython/html/static/notebook/js/celltoolbar.js @@ -5,7 +5,7 @@ define([ 'base/js/namespace', 'jquery', 'notebook/js/textcell', -], function(IPython, $, TextCell) { +], function(IPython, $, textcell) { "use strict"; /** @@ -276,7 +276,7 @@ define([ } // If there are no controls or the cell is a rendered TextCell hide the toolbar. - if (!this.ui_controls_list.length || (this.cell instanceof TextCell && this.cell.rendered)) { + if (!this.ui_controls_list.length || (this.cell instanceof textcell.TextCell && this.cell.rendered)) { this.hide(); } else { this.show(); diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index dc1ab08..d7cef5d 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -57,7 +57,7 @@ define([ this.kernel = kernel || null; this.notebook = notebook; this.collapsed = false; - this.tooltip = new Tooltip(events); + this.tooltip = new tooltip.Tooltip(events); this.events = events; this.config = config; @@ -76,7 +76,7 @@ define([ options = this.mergeopt(CodeCell, options, {cm_config:cm_overwrite_options}); - Cell.apply(this,[options, keyboard_manager, events]); + cell.Cell.apply(this,[options, keyboard_manager, events]); // Attributes we want to override in this subclass. this.cell_type = "code"; @@ -106,7 +106,7 @@ define([ CodeCell.msg_cells = {}; - CodeCell.prototype = new Cell(); + CodeCell.prototype = new cell.Cell(); /** * @method auto_highlight @@ -117,7 +117,7 @@ define([ /** @method create_element */ CodeCell.prototype.create_element = function () { - Cell.prototype.create_element.apply(this, arguments); + cell.Cell.prototype.create_element.apply(this, arguments); var cell = $('
').addClass('cell border-box-sizing code_cell'); cell.attr('tabindex','2'); @@ -125,7 +125,7 @@ define([ var input = $('
').addClass('input'); var prompt = $('
').addClass('prompt input_prompt'); var inner_cell = $('
').addClass('inner_cell'); - this.celltoolbar = new CellToolbar(this, this.events, this.notebook); + this.celltoolbar = new celltoolbar.CellToolbar(this, this.events, this.notebook); inner_cell.append(this.celltoolbar.element); var input_area = $('
').addClass('input_area'); this.code_mirror = CodeMirror(input_area.get(0), this.cm_config); @@ -155,13 +155,13 @@ define([ var output = $('
'); cell.append(input).append(widget_area).append(output); this.element = cell; - this.output_area = new OutputArea(output, true, this.events, this.keyboard_manager); - this.completer = new Completer(this, this.events); + this.output_area = new outputarea.OutputArea(output, true, this.events, this.keyboard_manager); + this.completer = new completer.Completer(this, this.events); }; /** @method bind_events */ CodeCell.prototype.bind_events = function () { - Cell.prototype.bind_events.apply(this); + cell.Cell.prototype.bind_events.apply(this); var that = this; this.element.focusout( @@ -243,7 +243,7 @@ define([ // keyboard event wasn't one of those unique to code cells, let's see // if it's one of the generic ones (i.e. check edit mode shortcuts) - return Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]); + return cell.Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]); }; // Kernel related calls. @@ -336,7 +336,7 @@ define([ // Basic cell manipulation. CodeCell.prototype.select = function () { - var cont = Cell.prototype.select.apply(this); + var cont = cell.Cell.prototype.select.apply(this); if (cont) { this.code_mirror.refresh(); this.auto_highlight(); @@ -345,7 +345,7 @@ define([ }; CodeCell.prototype.render = function () { - var cont = Cell.prototype.render.apply(this); + var cont = cell.Cell.prototype.render.apply(this); // Always execute, even if we are already in the rendered state return cont; }; @@ -448,7 +448,7 @@ define([ // JSON serialization CodeCell.prototype.fromJSON = function (data) { - Cell.prototype.fromJSON.apply(this, arguments); + cell.Cell.prototype.fromJSON.apply(this, arguments); if (data.cell_type === 'code') { if (data.input !== undefined) { this.set_text(data.input); @@ -476,7 +476,7 @@ define([ CodeCell.prototype.toJSON = function () { - var data = Cell.prototype.toJSON.apply(this); + var data = cell.Cell.prototype.toJSON.apply(this); data.input = this.get_text(); // is finite protect against undefined and '*' value if (isFinite(this.input_prompt_number)) { @@ -496,7 +496,7 @@ define([ * @return is the action being taken */ CodeCell.prototype.unselect = function () { - var cont = Cell.prototype.unselect.apply(this); + var cont = cell.Cell.prototype.unselect.apply(this); if (cont) { // When a code cell is usnelected, make sure that the corresponding // tooltip and completer to that cell is closed. diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index 215279e..41b8b9f 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -49,18 +49,18 @@ require([ }; var user_config = $.extend({}, config.default_config); - var page = new Page(); - var layout_manager = new LayoutManager(); - var events = $([new Events()]); - var pager = new Pager('div#pager', 'div#pager_splitter', layout_manager, events); - var keyboard_manager = new KeyboardManager(pager, events); - var save_widget = new SaveWidget('span#save_widget', events); - var notebook = new Notebook('div#notebook', options, events, keyboard_manager, save_widget, user_config); - var login_widget = new LoginWidget('span#login_widget', options); - var toolbar = new MainToolBar('#maintoolbar-container', layout_manager, notebook, events); - var quick_help = new QuickHelp(undefined, keyboard_manager, events); - var menubar = new MenuBar('#menubar', options, notebook, layout_manager, events, save_widget, quick_help); - var notification_area = new NotificationArea('#notification_area', events, save_widget, notebook); + var page = new page.Page(); + var layout_manager = new layoutmanager.LayoutManager(); + var events = $([new events.Events()]); + var pager = new pager.Pager('div#pager', 'div#pager_splitter', layout_manager, events); + var keyboard_manager = new keyboardmanager.KeyboardManager(pager, events); + var save_widget = new savewidget.SaveWidget('span#save_widget', events); + var notebook = new notebook.Notebook('div#notebook', options, events, keyboard_manager, save_widget, user_config); + var login_widget = new loginwidget.LoginWidget('span#login_widget', options); + var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', layout_manager, notebook, events); + var quick_help = new quickhelp.QuickHelp(undefined, keyboard_manager, events); + var menubar = new menubar.MenuBar('#menubar', options, notebook, layout_manager, events, save_widget, quick_help); + var notification_area = new notificationarea.NotificationArea('#notification_area', events, save_widget, notebook); notification_area.init_notification_widgets(); layout_manager.do_resize(); diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index eb1bfea..8b84065 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -10,7 +10,7 @@ define([ "use strict"; var MainToolBar = function (selector, layout_manager, notebook, events) { - Toolbar.apply(this, arguments); + toolbar.Toolbar.apply(this, arguments); this.events = events; this.notebook = notebook; this.construct(); @@ -19,7 +19,7 @@ define([ this.bind_events(); }; - MainToolBar.prototype = new Toolbar(); + MainToolBar.prototype = new toolbar.Toolbar(); MainToolBar.prototype.construct = function () { this.add_buttons_group([ @@ -152,16 +152,16 @@ define([ select.change(function() { var val = $(this).val(); if (val ==='') { - CellToolbar.global_hide(); + celltoolbar.CellToolbar.global_hide(); delete this.notebook.metadata.celltoolbar; } else { - CellToolbar.global_show(); - CellToolbar.activate_preset(val); + celltoolbar.CellToolbar.global_show(); + celltoolbar.CellToolbar.activate_preset(val); this.notebook.metadata.celltoolbar = val; } }); // Setup the currently registered presets. - var presets = CellToolbar.list_presets(); + var presets = celltoolbar.CellToolbar.list_presets(); for (var i=0; i').attr('value', name).text(name)); diff --git a/IPython/html/static/notebook/js/mathjaxutils.js b/IPython/html/static/notebook/js/mathjaxutils.js index d64b7ae..fcd9867 100644 --- a/IPython/html/static/notebook/js/mathjaxutils.js +++ b/IPython/html/static/notebook/js/mathjaxutils.js @@ -5,7 +5,7 @@ define([ 'jquery', 'base/js/utils', 'base/js/dialog', -], function($, utils, Dialog) { +], function($, utils, dialog) { "use strict"; var init = function () { @@ -68,7 +68,7 @@ define([ "which will prevent this dialog from appearing." ) ); - Dialog.modal({ + dialog.modal({ title : "Failed to retrieve MathJax from '" + window.mathjax_url + "'", body : message, buttons : { diff --git a/IPython/html/static/notebook/js/menubar.js b/IPython/html/static/notebook/js/menubar.js index cc7d6fe..c0d79dd 100644 --- a/IPython/html/static/notebook/js/menubar.js +++ b/IPython/html/static/notebook/js/menubar.js @@ -7,7 +7,7 @@ define([ 'base/js/utils', 'notebook/js/tour', 'components/bootstrap-tour/build/js/bootstrap-tour.min', -], function(IPython, $, utils, Tour) { +], function(IPython, $, utils, tour) { "use strict"; /** @@ -35,7 +35,7 @@ define([ this.quick_help = quick_help; try { - this.tour = new Tour(notebook, events); + this.tour = new tour.Tour(notebook, events); } catch (e) { this.tour = undefined; console.log("Failed to instantiate Notebook Tour", e); diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index e2bc66e..abf10e6 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -19,11 +19,11 @@ define([ IPython, $, utils, - Dialog, - Cells, - CodeCell, - Session, - CellToolbar, + dialog, + cells, + codecell, + session, + celltoolbar, marked, mathjaxutils, keyboard @@ -184,7 +184,7 @@ define([ }); this.events.on('status_autorestarting.Kernel', function () { - Dialog.modal({ + dialog.modal({ title: "Kernel Restarting", body: "The kernel appears to have died. It will restart automatically.", buttons: { @@ -307,7 +307,7 @@ define([ Notebook.prototype.edit_metadata = function () { var that = this; - Dialog.edit_metadata(this.metadata, function (md) { + dialog.edit_metadata(this.metadata, function (md) { that.metadata = md; }, 'Notebook'); }; @@ -348,7 +348,7 @@ define([ * @return {Cell} Cell or null if no cell was found. */ Notebook.prototype.get_msg_cell = function (msg_id) { - return CodeCell.msg_cells[msg_id] || null; + return codecell.CodeCell.msg_cells[msg_id] || null; }; /** @@ -807,14 +807,14 @@ define([ if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { if (type === 'code') { - cell = new CodeCell(this.kernel, this.options, this.events, this.config, this.keyboard_manager, this); + cell = new codecell.CodeCell(this.kernel, this.options, this.events, this.config, this.keyboard_manager, this); cell.set_input_prompt(); } else if (type === 'markdown') { - cell = new Cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this); + cell = new cells.Cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this); } else if (type === 'raw') { - cell = new Cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this); + cell = new cells.Cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this); } else if (type === 'heading') { - cell = new Cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this); + cell = new cells.Cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this); } if(this._insert_element_at_index(cell.element,index)) { @@ -959,7 +959,7 @@ define([ if (this.is_valid_cell_index(i)) { var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); - if (!(source_cell instanceof Cells.MarkdownCell)) { + if (!(source_cell instanceof cells.Cells.MarkdownCell)) { var target_cell = this.insert_cell_below('markdown',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { @@ -973,7 +973,7 @@ define([ target_cell.code_mirror.clearHistory(); source_element.remove(); this.select(i); - if ((source_cell instanceof Cells.TextCell) && source_cell.rendered) { + if ((source_cell instanceof cells.Cells.TextCell) && source_cell.rendered) { target_cell.render(); } var cursor = source_cell.code_mirror.getCursor(); @@ -995,7 +995,7 @@ define([ var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); var target_cell = null; - if (!(source_cell instanceof Cells.RawCell)) { + if (!(source_cell instanceof cells.Cells.RawCell)) { target_cell = this.insert_cell_below('raw',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { @@ -1030,7 +1030,7 @@ define([ var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); var target_cell = null; - if (source_cell instanceof Cells.HeadingCell) { + if (source_cell instanceof cells.Cells.HeadingCell) { source_cell.set_level(level); } else { target_cell = this.insert_cell_below('heading',i); @@ -1049,7 +1049,7 @@ define([ this.select(i); var cursor = source_cell.code_mirror.getCursor(); target_cell.code_mirror.setCursor(cursor); - if ((source_cell instanceof Cells.TextCell) && source_cell.rendered) { + if ((source_cell instanceof cells.Cells.TextCell) && source_cell.rendered) { target_cell.render(); } } @@ -1168,8 +1168,8 @@ define([ * @method split_cell */ Notebook.prototype.split_cell = function () { - var mdc = Cells.MarkdownCell; - var rc = Cells.RawCell; + var mdc = cells.Cells.MarkdownCell; + var rc = cells.Cells.RawCell; var cell = this.get_selected_cell(); if (cell.is_splittable()) { var texta = cell.get_pre_cursor(); @@ -1197,8 +1197,8 @@ define([ * @method merge_cell_above */ Notebook.prototype.merge_cell_above = function () { - var mdc = Cells.MarkdownCell; - var rc = Cells.RawCell; + var mdc = cells.Cells.MarkdownCell; + var rc = cells.Cells.RawCell; var index = this.get_selected_index(); var cell = this.get_cell(index); var render = cell.rendered; @@ -1234,8 +1234,8 @@ define([ * @method merge_cell_below */ Notebook.prototype.merge_cell_below = function () { - var mdc = Cells.MarkdownCell; - var rc = Cells.RawCell; + var mdc = cells.Cells.MarkdownCell; + var rc = cells.Cells.RawCell; var index = this.get_selected_index(); var cell = this.get_cell(index); var render = cell.rendered; @@ -1465,7 +1465,7 @@ define([ * @method start_session */ Notebook.prototype.start_session = function () { - this.session = new Session(this, this.options); + this.session = new session.Session(this, this.options); this.session.start($.proxy(this._session_started, this)); }; @@ -1493,7 +1493,7 @@ define([ */ Notebook.prototype.restart_kernel = function () { var that = this; - Dialog.modal({ + dialog.modal({ title : "Restart kernel or continue running?", body : $("

").text( 'Do you want to restart the current kernel? You will lose all variables defined in it.' @@ -1716,7 +1716,7 @@ define([ this.events.trigger("trust_changed.Notebook", trusted); } if (content.worksheets.length > 1) { - Dialog.modal({ + dialog.modal({ title : "Multiple worksheets", body : "This notebook has " + data.worksheets.length + " worksheets, " + "but this version of IPython can only handle the first. " + @@ -1904,7 +1904,7 @@ define([ ); var nb = this; - Dialog.modal({ + dialog.modal({ title: "Trust this notebook?", body: body, @@ -2049,7 +2049,7 @@ define([ .text('This notebook name already exists.') ); this.events.trigger('notebook_rename_failed.Notebook', [xhr, status, error]); - Dialog.modal({ + dialog.modal({ title: "Notebook Rename Error!", body: dialog, buttons : { @@ -2130,7 +2130,7 @@ define([ "newer notebook format will be used and older versions of IPython " + "may not be able to read it. To keep the older version, close the " + "notebook without saving it."; - Dialog.modal({ + dialog.modal({ title : "Notebook converted", body : msg, buttons : { @@ -2147,7 +2147,7 @@ define([ this_vs + ". You can still work with this notebook, but some features " + "introduced in later notebook versions may not be available."; - Dialog.modal({ + dialog.modal({ title : "Newer Notebook", body : msg, buttons : { @@ -2169,10 +2169,10 @@ define([ // load toolbar state if (this.metadata.celltoolbar) { - CellToolbar.global_show(); - CellToolbar.activate_preset(this.metadata.celltoolbar); + celltoolbar.CellToolbar.global_show(); + celltoolbar.CellToolbar.activate_preset(this.metadata.celltoolbar); } else { - CellToolbar.global_hide(); + celltoolbar.CellToolbar.global_hide(); } // now that we're fully loaded, it is safe to restore save functionality @@ -2198,7 +2198,7 @@ define([ "This version can load notebook formats " + "v" + this.nbformat + " or earlier."; } - Dialog.modal({ + dialog.modal({ title: "Error loading notebook", body : msg, buttons : { @@ -2362,7 +2362,7 @@ define([ ).css("text-align", "center") ); - Dialog.modal({ + dialog.modal({ title : "Revert notebook to checkpoint", body : body, buttons : { diff --git a/IPython/html/static/notebook/js/notificationarea.js b/IPython/html/static/notebook/js/notificationarea.js index 8077aab..563615f 100644 --- a/IPython/html/static/notebook/js/notificationarea.js +++ b/IPython/html/static/notebook/js/notificationarea.js @@ -7,7 +7,7 @@ define([ 'base/js/utils', 'base/js/dialog', 'notebook/js/notificationwidget', -], function(IPython, $, utils, Dialog, NotificationWidget) { +], function(IPython, $, utils, dialog, notificationwidget) { "use strict"; var NotificationArea = function (selector, events, save_widget, notebook) { @@ -62,7 +62,7 @@ define([ } var div = $('

').attr('id','notification_'+name); $(this.selector).append(div); - this.widget_dict[name] = new NotificationWidget('#notification_'+name); + this.widget_dict[name] = new notificationwidget.NotificationWidget('#notification_'+name); return this.widget_dict[name]; }; @@ -123,7 +123,7 @@ define([ ' the notebook, but running code will no longer work until the notebook' + ' is reopened.'; - Dialog.modal({ + dialog.modal({ title: "Dead kernel", body : msg, buttons : { @@ -155,7 +155,7 @@ define([ msg = "A WebSocket connection could not be established." + " You will NOT be able to run code. Check your" + " network connection or notebook server configuration."; - Dialog.modal({ + dialog.modal({ title: "WebSocket connection failed", body: msg, buttons : { diff --git a/IPython/html/static/notebook/js/quickhelp.js b/IPython/html/static/notebook/js/quickhelp.js index f98c536..88ea8ab 100644 --- a/IPython/html/static/notebook/js/quickhelp.js +++ b/IPython/html/static/notebook/js/quickhelp.js @@ -6,7 +6,7 @@ define([ 'jquery', 'base/js/utils', 'base/js/dialog', -], function(IPython, $, utils, Dialog) { +], function(IPython, $, utils, dialog) { "use strict"; var platform = utils.platform; @@ -99,7 +99,7 @@ define([ var edit_div = this.build_edit_help(cm_shortcuts); element.append(edit_div); - this.shortcut_dialog = Dialog.modal({ + this.shortcut_dialog = dialog.modal({ title : "Keyboard shortcuts", body : element, destroy : false, diff --git a/IPython/html/static/notebook/js/savewidget.js b/IPython/html/static/notebook/js/savewidget.js index 5829dd6..5957af0 100644 --- a/IPython/html/static/notebook/js/savewidget.js +++ b/IPython/html/static/notebook/js/savewidget.js @@ -8,7 +8,7 @@ define([ 'base/js/dialog', 'base/js/keyboard', 'dateformat/date.format', -], function(IPython, $, utils, Dialog, keyboard) { +], function(IPython, $, utils, dialog, keyboard) { "use strict"; var SaveWidget = function (selector, events) { @@ -76,7 +76,7 @@ define([ $('').attr('type','text').attr('size','25').addClass('form-control') .val(that.notebook.get_notebook_name()) ); - Dialog.modal({ + dialog.modal({ title: "Rename Notebook", body: dialog, buttons : { diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 44565e7..f2e0ede 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -8,7 +8,7 @@ define([ 'base/js/security', 'notebook/js/mathjaxutils', 'notebook/js/celltoolbar', -], function(IPython, $, Cell, Security, mathjaxutils, CellToolbar) { +], function(IPython, $, cell, security, mathjaxutils, celltoolbar) { "use strict"; /** @@ -41,12 +41,12 @@ define([ this.cell_type = this.cell_type || 'text'; mathjaxutils = mathjaxutils; - Cell.apply(this, [options, keyboard_manager, events]); + cell.Cell.apply(this, [options, keyboard_manager, events]); this.rendered = false; }; - TextCell.prototype = new Cell(); + TextCell.prototype = new cell.Cell(); TextCell.options_default = { cm_config : { @@ -63,7 +63,7 @@ define([ * @private */ TextCell.prototype.create_element = function () { - Cell.prototype.create_element.apply(this, arguments); + cell.Cell.prototype.create_element.apply(this, arguments); var cell = $("
").addClass('cell text_cell border-box-sizing'); cell.attr('tabindex','2'); @@ -71,7 +71,7 @@ define([ var prompt = $('
').addClass('prompt input_prompt'); cell.append(prompt); var inner_cell = $('
').addClass('inner_cell'); - this.celltoolbar = new CellToolbar(this, this.events, this.notebook); + this.celltoolbar = new celltoolbar.CellToolbar(this, this.events, this.notebook); inner_cell.append(this.celltoolbar.element); var input_area = $('
').addClass('input_area'); this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config); @@ -91,7 +91,7 @@ define([ * @method bind_event */ TextCell.prototype.bind_events = function () { - Cell.prototype.bind_events.apply(this); + cell.Cell.prototype.bind_events.apply(this); var that = this; this.element.dblclick(function () { @@ -108,7 +108,7 @@ define([ // Cell level actions TextCell.prototype.select = function () { - var cont = Cell.prototype.select.apply(this); + var cont = cell.Cell.prototype.select.apply(this); if (cont) { if (this.mode === 'edit') { this.code_mirror.refresh(); @@ -119,7 +119,7 @@ define([ TextCell.prototype.unrender = function () { if (this.read_only) return; - var cont = Cell.prototype.unrender.apply(this); + var cont = cell.Cell.prototype.unrender.apply(this); if (cont) { var text_cell = this.element; var output = text_cell.find("div.text_cell_render"); @@ -182,7 +182,7 @@ define([ * @method fromJSON */ TextCell.prototype.fromJSON = function (data) { - Cell.prototype.fromJSON.apply(this, arguments); + cell.Cell.prototype.fromJSON.apply(this, arguments); if (data.cell_type === this.cell_type) { if (data.source !== undefined) { this.set_text(data.source); @@ -202,7 +202,7 @@ define([ * @return {object} cell data serialised to json */ TextCell.prototype.toJSON = function () { - var data = Cell.prototype.toJSON.apply(this); + var data = cell.Cell.prototype.toJSON.apply(this); data.source = this.get_text(); if (data.source == this.placeholder) { data.source = ""; @@ -246,7 +246,7 @@ define([ math = text_and_math[1]; var html = marked.parser(marked.lexer(text)); html = mathjaxutils.replace_math(html, math); - html = Security.sanitize_html(html); + html = security.Security.sanitize_html(html); html = $($.parseHTML(html)); // links in markdown cells should open in new tabs html.find("a[href]").not('[href^="#"]').attr("target", "_blank"); @@ -417,7 +417,7 @@ define([ math = text_and_math[1]; var html = marked.parser(marked.lexer(text)); html = mathjaxutils.replace_math(html, math); - html = Security.sanitize_html(html); + html = security.Security.sanitize_html(html); var h = $($.parseHTML(html)); // add id and linkback anchor var hash = h.text().replace(/ /g, '-'); diff --git a/IPython/html/static/notebook/js/tour.js b/IPython/html/static/notebook/js/tour.js index b7a806d..5228709 100644 --- a/IPython/html/static/notebook/js/tour.js +++ b/IPython/html/static/notebook/js/tour.js @@ -112,7 +112,7 @@ define([ title: "Fin.", placement: 'bottom', orphan: true, - content: "This concludes the IPython Notebook User Interface Tour. Happy hacking!", + content: "This concludes the IPython Notebook User Interface tour.Tour. Happy hacking!", } ]; @@ -164,7 +164,7 @@ define([ // For backwards compatability. IPython.NotebookTour = NotebookTour; - return {'NotebookTour': NotebookTour}; + return {'Tour': NotebookTour}; }); diff --git a/IPython/html/static/services/kernels/js/kernel.js b/IPython/html/static/services/kernels/js/kernel.js index 7ee7afb..8004c15 100644 --- a/IPython/html/static/services/kernels/js/kernel.js +++ b/IPython/html/static/services/kernels/js/kernel.js @@ -7,7 +7,7 @@ define([ 'base/js/utils', 'services/kernels/js/comm', 'widgets/js/init', -], function(IPython, $, utils, comm, WidgetManager) { +], function(IPython, $, utils, comm, widgetmanager) { "use strict"; // Initialization and connection. @@ -39,7 +39,7 @@ define([ this.bind_events(); this.init_iopub_handlers(); this.comm_manager = new comm.CommManager(this); - this.widget_manager = new WidgetManager(this.comm_manager, notebook); + this.widget_manager = new widgetmanager.WidgetManager(this.comm_manager, notebook); this.last_msg_id = null; this.last_msg_callbacks = {}; diff --git a/IPython/html/static/services/sessions/js/session.js b/IPython/html/static/services/sessions/js/session.js index ef17e5d..6e791e0 100644 --- a/IPython/html/static/services/sessions/js/session.js +++ b/IPython/html/static/services/sessions/js/session.js @@ -6,7 +6,7 @@ define([ 'jquery', 'base/js/utils', 'services/kernels/js/kernel', -], function(IPython, $, utils, Kernel) { +], function(IPython, $, utils, kernel) { "use strict"; var Session = function(notebook, options){ @@ -87,7 +87,7 @@ define([ Session.prototype._handle_start_success = function (data, status, xhr) { this.id = data.id; var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels"); - this.kernel = new Kernel(kernel_service_url, this.notebook); + this.kernel = new kernel.Kernel(kernel_service_url, this.notebook); this.kernel._kernel_started(data.kernel); }; diff --git a/IPython/html/static/tree/js/kernellist.js b/IPython/html/static/tree/js/kernellist.js index 44e8fbe..520e598 100644 --- a/IPython/html/static/tree/js/kernellist.js +++ b/IPython/html/static/tree/js/kernellist.js @@ -5,11 +5,11 @@ define([ 'base/js/namespace', 'jquery', 'tree/js/notebooklist', -], function(IPython, $, NotebookList) { +], function(IPython, $, notebooklist) { "use strict"; var KernelList = function (selector, options, session_list) { - NotebookList.call(this, selector, options, 'running', session_list); + notebooklist.NotebookList.call(this, selector, options, 'running', session_list); }; KernelList.prototype = Object.create(NotebookList.prototype); diff --git a/IPython/html/static/tree/js/main.js b/IPython/html/static/tree/js/main.js index 0fbee36..c93bb1d 100644 --- a/IPython/html/static/tree/js/main.js +++ b/IPython/html/static/tree/js/main.js @@ -18,32 +18,32 @@ require([ ], function( IPython, $, - Events, - Page, + events, + page, utils, - NotebookList, - ClusterList, - SesssionList, - KernelList, - LoginWidget){ - - page = new Page(); + notebooklist, + clusterlist, + sesssionlist, + kernellist, + loginwidget){ + page = new page.Page(); + var opts = { base_url: utils.get_body_data("baseUrl"), notebook_path: utils.get_body_data("notebookPath"), }; - events = $([new Events()]); - session_list = new SesssionList(opts, events); - notebook_list = new NotebookList('#notebook_list', opts, undefined, session_list); - cluster_list = new ClusterList('#cluster_list', opts); - kernel_list = new KernelList('#running_list', opts, session_list); - login_widget = new LoginWidget('#login_widget', opts); + events = $([new events.Events()]); + session_list = new sesssionlist.SesssionList(opts, events); + notebook_list = new notebooklist.NotebookList('#notebook_list', opts, undefined, session_list); + cluster_list = new clusterlist.ClusterList('#cluster_list', opts); + kernel_list = new kernellist.KernelList('#running_list', opts, session_list); + login_widget = new loginwidget.LoginWidget('#login_widget', opts); $('#new_notebook').button().click(function (e) { notebook_list.new_notebook(); }); - + var interval_id=0; // auto refresh every xx secondes, no need to be fast, // update is done at least when page get focus diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js index 025a745..c132f89 100644 --- a/IPython/html/static/tree/js/notebooklist.js +++ b/IPython/html/static/tree/js/notebooklist.js @@ -6,7 +6,7 @@ define([ 'jquery', 'base/js/utils', 'base/js/dialog', -], function(IPython, $, utils, Dialog) { +], function(IPython, $, utils, dialog) { "use strict"; var NotebookList = function (selector, options, element_name, session_list) { @@ -83,7 +83,7 @@ define([ }; } else { var dialog = 'Uploaded notebooks must be .ipynb files'; - Dialog.modal({ + dialog.modal({ title : 'Invalid file type', body : dialog, buttons : {'OK' : {'class' : 'btn-primary'}} @@ -299,7 +299,7 @@ define([ var parent_item = that.parents('div.list_item'); var nbname = parent_item.data('nbname'); var message = 'Are you sure you want to permanently delete the notebook: ' + nbname + '?'; - Dialog.modal({ + dialog.modal({ title : "Delete notebook", body : message, buttons : { @@ -424,7 +424,7 @@ define([ } else { msg = xhr.statusText; } - Dialog.modal({ + dialog.modal({ title : 'Creating Notebook Failed', body : "The error was: " + msg, buttons : {'OK' : {'class' : 'btn-primary'}} diff --git a/IPython/html/static/widgets/js/init.js b/IPython/html/static/widgets/js/init.js index 496ec0e..36f0a8f 100644 --- a/IPython/html/static/widgets/js/init.js +++ b/IPython/html/static/widgets/js/init.js @@ -23,5 +23,5 @@ define([ } } - return WidgetManager; + return {'WidgetManager': WidgetManager}; }); diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 6725873..7e08402 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -4,7 +4,7 @@ define(["widgets/js/manager", "underscore", "backbone"], -function(WidgetManager, _, Backbone){ +function(widgetmanager, _, Backbone){ var WidgetModel = Backbone.Model.extend({ constructor: function (widget_manager, model_id, comm) { @@ -261,7 +261,7 @@ function(WidgetManager, _, Backbone){ }, }); - WidgetManager.register_widget_model('WidgetModel', WidgetModel); + widgetmanager.WidgetManager.register_widget_model('WidgetModel', WidgetModel); var WidgetView = Backbone.View.extend({