mirror of
https://github.com/jupyter/notebook.git
synced 2025-04-24 14:20:54 +08:00
Revert "Google hangout review comments."
This reverts commit 4e120e76014b2630f957c01d17ba3926d4848872.
This commit is contained in:
parent
eb2b1ab4a4
commit
1e098560b8
@ -38,9 +38,9 @@ define([
|
||||
* @param {object|undefined} [options]
|
||||
* @param [options.cm_config] {object} config to pass to CodeMirror, will extend default parameters
|
||||
*/
|
||||
var Cell = function (options) {
|
||||
this.keyboard_manager = options.keyboard_manager;
|
||||
this.events = options.events;
|
||||
var Cell = function (options, keyboard_manager, events) {
|
||||
this.keyboard_manager = keyboard_manager;
|
||||
this.events = events;
|
||||
options = this.mergeopt(Cell, options);
|
||||
// superclass default overwrite our default
|
||||
|
||||
|
@ -54,13 +54,13 @@ define([
|
||||
* @param {object|undefined} [options]
|
||||
* @param [options.cm_config] {object} config to pass to CodeMirror
|
||||
*/
|
||||
var CodeCell = function (kernel, options) {
|
||||
var CodeCell = function (kernel, options, events, config, keyboard_manager, notebook) {
|
||||
this.kernel = kernel || null;
|
||||
this.notebook = options.notebook;
|
||||
this.notebook = notebook;
|
||||
this.collapsed = false;
|
||||
this.tooltip = new tooltip.Tooltip(options.events);
|
||||
this.events = options.events;
|
||||
this.config = options.config;
|
||||
this.tooltip = new tooltip.Tooltip(events);
|
||||
this.events = events;
|
||||
this.config = config;
|
||||
|
||||
// create all attributed in constructor function
|
||||
// even if null for V8 VM optimisation
|
||||
@ -77,7 +77,7 @@ define([
|
||||
|
||||
options = this.mergeopt(CodeCell, options, {cm_config:cm_overwrite_options});
|
||||
|
||||
Cell.apply(this,[options]);
|
||||
Cell.apply(this,[options, keyboard_manager, events]);
|
||||
|
||||
// Attributes we want to override in this subclass.
|
||||
this.cell_type = "code";
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) IPython Development Team.
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
var ipython = ipython || {};
|
||||
require([
|
||||
'base/js/namespace',
|
||||
'jquery',
|
||||
@ -48,25 +49,18 @@ require([
|
||||
};
|
||||
|
||||
var user_config = $.extend({}, config.default_config);
|
||||
options.user_config = user_config;
|
||||
var page = new page.Page();
|
||||
var layout_manager = new layoutmanager.LayoutManager();
|
||||
options.layout_manager = layout_manager;
|
||||
var events = $([new events.Events()]);
|
||||
options.events = events;
|
||||
var pager = new pager.Pager('div#pager', 'div#pager_splitter', layout_manager, events);
|
||||
var keyboard_manager = new keyboardmanager.KeyboardManager(pager, events);
|
||||
options.keyboard_manager = keyboard_manager;
|
||||
var save_widget = new savewidget.SaveWidget('span#save_widget', events);
|
||||
options.save_widget = save_widget;
|
||||
var notebook = new notebook.Notebook('div#notebook', options);
|
||||
options.notebook = notebook;
|
||||
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', options);
|
||||
var quick_help = new quickhelp.QuickHelp(undefined, options);
|
||||
options.quick_help = quick_help;
|
||||
var menubar = new menubar.MenuBar('#menubar', options);
|
||||
var notification_area = new notificationarea.NotificationArea('#notification_area', 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();
|
||||
|
||||
$('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
|
||||
@ -99,17 +93,17 @@ require([
|
||||
events.trigger('app_initialized.NotebookApp');
|
||||
notebook.load_notebook(options.notebook_name, options.notebook_path);
|
||||
|
||||
IPython.page = page;
|
||||
IPython.layout_manager = layout_manager;
|
||||
IPython.notebook = notebook;
|
||||
IPython.pager = pager;
|
||||
IPython.quick_help = quick_help;
|
||||
IPython.login_widget = login_widget;
|
||||
IPython.menubar = menubar;
|
||||
IPython.toolbar = toolbar;
|
||||
IPython.notification_area = notification_area;
|
||||
IPython.events = events;
|
||||
IPython.keyboard_manager = keyboard_manager;
|
||||
IPython.save_widget = save_widget;
|
||||
IPython.config = user_config;
|
||||
ipython.page = page;
|
||||
ipython.layout_manager = layout_manager;
|
||||
ipython.notebook = notebook;
|
||||
ipython.pager = pager;
|
||||
ipython.quick_help = quick_help;
|
||||
ipython.login_widget = login_widget;
|
||||
ipython.menubar = menubar;
|
||||
ipython.toolbar = toolbar;
|
||||
ipython.notification_area = notification_area;
|
||||
ipython.events = events;
|
||||
ipython.keyboard_manager = keyboard_manager;
|
||||
ipython.save_widget = save_widget;
|
||||
ipython.config = user_config;
|
||||
});
|
||||
|
@ -9,10 +9,10 @@ define([
|
||||
], function(IPython, $, toolbar, celltoolbar) {
|
||||
"use strict";
|
||||
|
||||
var MainToolBar = function (selector, options) {
|
||||
var MainToolBar = function (selector, layout_manager, notebook, events) {
|
||||
toolbar.ToolBar.apply(this, arguments);
|
||||
this.events = options.events;
|
||||
this.notebook = options.notebook;
|
||||
this.events = events;
|
||||
this.notebook = notebook;
|
||||
this.construct();
|
||||
this.add_celltype_list();
|
||||
this.add_celltoolbar_list();
|
||||
|
@ -24,18 +24,18 @@ define([
|
||||
* $('body').data('baseUrl');
|
||||
* does not support change for now is set through this option
|
||||
*/
|
||||
var MenuBar = function (selector, options) {
|
||||
var MenuBar = function (selector, options, notebook, layout_manager, events, save_widget, quick_help) {
|
||||
options = options || {};
|
||||
this.base_url = options.base_url || utils.get_body_data("baseUrl");
|
||||
this.selector = selector;
|
||||
this.notebook = options.notebook;
|
||||
this.layout_manager = options.layout_manager;
|
||||
this.events = options.events;
|
||||
this.save_widget = options.save_widget;
|
||||
this.quick_help = options.quick_help;
|
||||
this.notebook = notebook;
|
||||
this.layout_manager = layout_manager;
|
||||
this.events = events;
|
||||
this.save_widget = save_widget;
|
||||
this.quick_help = quick_help;
|
||||
|
||||
try {
|
||||
this.tour = new tour.Tour(options.notebook, options.events);
|
||||
this.tour = new tour.Tour(notebook, events);
|
||||
} catch (e) {
|
||||
this.tour = undefined;
|
||||
console.log("Failed to instantiate Notebook Tour", e);
|
||||
|
@ -38,15 +38,15 @@ define([
|
||||
* @param {Object} [options] A config object
|
||||
* @param {Object} [events] An events object
|
||||
*/
|
||||
var Notebook = function (selector, options) {
|
||||
this.config = options.config;
|
||||
this.events = options.events;
|
||||
this.keyboard_manager = options.keyboard_manager;
|
||||
var Notebook = function (selector, options, events, keyboard_manager, save_widget, config) {
|
||||
this.config = config;
|
||||
this.events = events;
|
||||
this.keyboard_manager = keyboard_manager;
|
||||
// TODO: This code smells (and the other `= this` line a couple lines down)
|
||||
// We need a better way to deal with circular instance references.
|
||||
this.keyboard_manager.notebook = this;
|
||||
this.save_widget = options.save_widget;
|
||||
options.save_widget.notebook = this;
|
||||
keyboard_manager.notebook = this;
|
||||
this.save_widget = save_widget;
|
||||
save_widget.notebook = this;
|
||||
|
||||
mathjaxutils.init();
|
||||
|
||||
@ -807,14 +807,14 @@ define([
|
||||
|
||||
if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) {
|
||||
if (type === 'code') {
|
||||
cell = new codecell.CodeCell(this.kernel, this.options);
|
||||
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);
|
||||
cell = new cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this);
|
||||
} else if (type === 'raw') {
|
||||
cell = new cells.RawCell(this.options);
|
||||
cell = new cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this);
|
||||
} else if (type === 'heading') {
|
||||
cell = new cells.HeadingCell(this.options);
|
||||
cell = new cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this);
|
||||
}
|
||||
|
||||
if(this._insert_element_at_index(cell.element,index)) {
|
||||
|
@ -10,11 +10,11 @@ define([
|
||||
], function(IPython, $, utils, dialog, notificationwidget) {
|
||||
"use strict";
|
||||
|
||||
var NotificationArea = function (selector, options) {
|
||||
var NotificationArea = function (selector, events, save_widget, notebook) {
|
||||
this.selector = selector;
|
||||
this.events = options.events;
|
||||
this.save_widget = options.save_widget;
|
||||
this.notebook = options.notebook;
|
||||
this.events = events;
|
||||
this.save_widget = save_widget;
|
||||
this.notebook = notebook;
|
||||
if (this.selector !== undefined) {
|
||||
this.element = $(selector);
|
||||
}
|
||||
|
@ -10,11 +10,10 @@ define([
|
||||
"use strict";
|
||||
var platform = utils.platform;
|
||||
|
||||
var QuickHelp = function (selector, options) {
|
||||
this.keyboard_manager = options.keyboard_manager;
|
||||
// TODO: Remove circular reference.
|
||||
options.keyboard_manager.quick_help = this;
|
||||
this.events = options.events;
|
||||
var QuickHelp = function (selector, keyboard_manager, events) {
|
||||
this.keyboard_manager = keyboard_manager;
|
||||
keyboard_manager.quick_help = this;
|
||||
this.events = events;
|
||||
};
|
||||
|
||||
var cmd_ctrl = 'Ctrl-';
|
||||
|
@ -24,14 +24,14 @@ define([
|
||||
* @param [options.cm_config] {object} config to pass to CodeMirror, will extend/overwrite default config
|
||||
* @param [options.placeholder] {string} default string to use when souce in empty for rendering (only use in some TextCell subclass)
|
||||
*/
|
||||
var TextCell = function (options) {
|
||||
var TextCell = function (options, events, config, keyboard_manager, notebook) {
|
||||
// in all TextCell/Cell subclasses
|
||||
// do not assign most of members here, just pass it down
|
||||
// in the options dict potentially overwriting what you wish.
|
||||
// they will be assigned in the base class.
|
||||
this.notebook = options.notebook;
|
||||
this.events = options.events;
|
||||
this.config = options.config;
|
||||
this.notebook = notebook;
|
||||
this.events = events;
|
||||
this.config = config;
|
||||
|
||||
// we cannot put this as a class key as it has handle to "this".
|
||||
var cm_overwrite_options = {
|
||||
@ -43,7 +43,7 @@ define([
|
||||
this.cell_type = this.cell_type || 'text';
|
||||
mathjaxutils = mathjaxutils;
|
||||
|
||||
Cell.apply(this, [options]);
|
||||
Cell.apply(this, [options, keyboard_manager, events]);
|
||||
|
||||
this.rendered = false;
|
||||
};
|
||||
@ -218,11 +218,11 @@ define([
|
||||
* @constructor MarkdownCell
|
||||
* @extends IPython.HTMLCell
|
||||
*/
|
||||
var MarkdownCell = function (options) {
|
||||
var MarkdownCell = function (options, events, config, keyboard_manager) {
|
||||
options = this.mergeopt(MarkdownCell, options);
|
||||
|
||||
this.cell_type = 'markdown';
|
||||
TextCell.apply(this, [options]);
|
||||
TextCell.apply(this, [options, events, config, keyboard_manager]);
|
||||
};
|
||||
|
||||
MarkdownCell.options_default = {
|
||||
@ -268,10 +268,10 @@ define([
|
||||
* @constructor RawCell
|
||||
* @extends TextCell
|
||||
*/
|
||||
var RawCell = function (options) {
|
||||
var RawCell = function (options, events, config, keyboard_manager) {
|
||||
|
||||
options = this.mergeopt(RawCell,options);
|
||||
TextCell.apply(this, [options]);
|
||||
TextCell.apply(this, [options, events, config, keyboard_manager]);
|
||||
this.cell_type = 'raw';
|
||||
// RawCell should always hide its rendered div
|
||||
this.element.find('div.text_cell_render').hide();
|
||||
@ -327,12 +327,12 @@ define([
|
||||
* @constructor HeadingCell
|
||||
* @extends TextCell
|
||||
*/
|
||||
var HeadingCell = function (options) {
|
||||
var HeadingCell = function (options, events, config, keyboard_manager) {
|
||||
options = this.mergeopt(HeadingCell, options);
|
||||
|
||||
this.level = 1;
|
||||
this.cell_type = 'heading';
|
||||
TextCell.apply(this, [options]);
|
||||
TextCell.apply(this, [options, events, config, keyboard_manager]);
|
||||
|
||||
/**
|
||||
* heading level of the cell, use getter and setter to access
|
||||
|
@ -8,8 +8,8 @@ define([
|
||||
], function(IPython, $, notebooklist) {
|
||||
"use strict";
|
||||
|
||||
var KernelList = function (selector, options) {
|
||||
notebooklist.NotebookList.call(this, selector, options, 'running', options.session_list);
|
||||
var KernelList = function (selector, options, session_list) {
|
||||
notebooklist.NotebookList.call(this, selector, options, 'running', session_list);
|
||||
};
|
||||
|
||||
KernelList.prototype = Object.create(notebooklist.NotebookList.prototype);
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) IPython Development Team.
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
var ipython = ipython || {};
|
||||
require([
|
||||
'base/js/namespace',
|
||||
'jquery',
|
||||
@ -28,19 +29,16 @@ require([
|
||||
|
||||
page = new page.Page();
|
||||
|
||||
var options = {
|
||||
var opts = {
|
||||
base_url: utils.get_body_data("baseUrl"),
|
||||
notebook_path: utils.get_body_data("notebookPath"),
|
||||
};
|
||||
|
||||
events = $([new events.Events()]);
|
||||
options.events = events;
|
||||
session_list = new sesssionlist.SesssionList(options);
|
||||
options.session_list = session_list;
|
||||
notebook_list = new notebooklist.NotebookList('#notebook_list', options, undefined);
|
||||
cluster_list = new clusterlist.ClusterList('#cluster_list', options);
|
||||
kernel_list = new kernellist.KernelList('#running_list', options);
|
||||
login_widget = new loginwidget.LoginWidget('#login_widget', options);
|
||||
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();
|
||||
@ -106,11 +104,11 @@ require([
|
||||
}
|
||||
|
||||
// For backwards compatability.
|
||||
IPython.page = page;
|
||||
IPython.notebook_list = notebook_list;
|
||||
IPython.cluster_list = cluster_list;
|
||||
IPython.session_list = session_list;
|
||||
IPython.kernel_list = kernel_list;
|
||||
IPython.login_widget = login_widget;
|
||||
IPython.events = events;
|
||||
ipython.page = page;
|
||||
ipython.notebook_list = notebook_list;
|
||||
ipython.cluster_list = cluster_list;
|
||||
ipython.session_list = session_list;
|
||||
ipython.kernel_list = kernel_list;
|
||||
ipython.login_widget = login_widget;
|
||||
ipython.events = events;
|
||||
});
|
||||
|
@ -9,9 +9,9 @@ define([
|
||||
], function(IPython, $, utils, dialog) {
|
||||
"use strict";
|
||||
|
||||
var NotebookList = function (selector, options, element_name) {
|
||||
var NotebookList = function (selector, options, element_name, session_list) {
|
||||
var that = this;
|
||||
this.session_list = options.session_list;
|
||||
this.session_list = session_list;
|
||||
// allow code re-use by just changing element_name in kernellist.js
|
||||
this.element_name = element_name || 'notebook';
|
||||
this.selector = selector;
|
||||
|
@ -8,8 +8,8 @@ define([
|
||||
], function(IPython, $, utils) {
|
||||
"use strict";
|
||||
|
||||
var SesssionList = function (options) {
|
||||
this.events = options.events;
|
||||
var SesssionList = function (options, events) {
|
||||
this.events = events;
|
||||
this.sessions = {};
|
||||
this.base_url = options.base_url || utils.get_body_data("baseUrl");
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user