Show More
@@ -38,23 +38,24 b' define([' | |||
|
38 | 38 | * @param {object|undefined} [options] |
|
39 | 39 | * @param [options.cm_config] {object} config to pass to CodeMirror, will extend default parameters |
|
40 | 40 | */ |
|
41 |
var Cell = function (options |
|
|
42 | this.keyboard_manager = keyboard_manager; | |
|
43 | this.events = events; | |
|
44 | options = this.mergeopt(Cell, options); | |
|
41 | var Cell = function (options) { | |
|
42 | options = options || {}; | |
|
43 | this.keyboard_manager = options.keyboard_manager; | |
|
44 | this.events = options.events; | |
|
45 | var config = this.mergeopt(Cell, options.config); | |
|
45 | 46 | // superclass default overwrite our default |
|
46 | 47 | |
|
47 |
this.placeholder = |
|
|
48 |
this.read_only = |
|
|
48 | this.placeholder = config.placeholder || ''; | |
|
49 | this.read_only = config.cm_config.readOnly; | |
|
49 | 50 | this.selected = false; |
|
50 | 51 | this.rendered = false; |
|
51 | 52 | this.mode = 'command'; |
|
52 | 53 | this.metadata = {}; |
|
53 | 54 | // load this from metadata later ? |
|
54 | 55 | this.user_highlight = 'auto'; |
|
55 |
this.cm_config = |
|
|
56 | this.cm_config = config.cm_config; | |
|
56 | 57 | this.cell_id = utils.uuid(); |
|
57 |
this._options = |
|
|
58 | this._options = config; | |
|
58 | 59 | |
|
59 | 60 | // For JS VM engines optimization, attributes should be all set (even |
|
60 | 61 | // to null) in the constructor, and if possible, if different subclass |
@@ -54,13 +54,14 b' define([' | |||
|
54 | 54 | * @param {object|undefined} [options] |
|
55 | 55 | * @param [options.cm_config] {object} config to pass to CodeMirror |
|
56 | 56 | */ |
|
57 |
var CodeCell = function (kernel, options |
|
|
57 | var CodeCell = function (kernel, options) { | |
|
58 | options = options || {}; | |
|
58 | 59 | this.kernel = kernel || null; |
|
59 | this.notebook = notebook; | |
|
60 | this.notebook = options.notebook; | |
|
60 | 61 | this.collapsed = false; |
|
61 | this.tooltip = new tooltip.Tooltip(events); | |
|
62 | this.events = events; | |
|
63 | this.config = config; | |
|
62 | this.events = options.events; | |
|
63 | this.tooltip = new tooltip.Tooltip(this.events); | |
|
64 | this.config = options.config; | |
|
64 | 65 | |
|
65 | 66 | // create all attributed in constructor function |
|
66 | 67 | // even if null for V8 VM optimisation |
@@ -75,9 +76,11 b' define([' | |||
|
75 | 76 | onKeyEvent: $.proxy(this.handle_keyevent,this) |
|
76 | 77 | }; |
|
77 | 78 | |
|
78 |
|
|
|
79 | ||
|
80 | Cell.apply(this,[options, keyboard_manager, events]); | |
|
79 | var config = this.mergeopt(CodeCell, this.config, {cm_config: cm_overwrite_options}); | |
|
80 | Cell.apply(this,[{ | |
|
81 | config: config, | |
|
82 | keyboard_manager: options.keyboard_manager, | |
|
83 | events: this.events}]); | |
|
81 | 84 | |
|
82 | 85 | // Attributes we want to override in this subclass. |
|
83 | 86 | this.cell_type = "code"; |
@@ -15,17 +15,17 b' define([' | |||
|
15 | 15 | // Main keyboard manager for the notebook |
|
16 | 16 | var keycodes = keyboard.keycodes; |
|
17 | 17 | |
|
18 |
var KeyboardManager = function ( |
|
|
18 | var KeyboardManager = function (options) { | |
|
19 | 19 | this.mode = 'command'; |
|
20 | 20 | this.enabled = true; |
|
21 | this.pager = pager; | |
|
21 | this.pager = options.pager; | |
|
22 | 22 | this.quick_help = undefined; |
|
23 | 23 | this.notebook = undefined; |
|
24 | 24 | this.bind_events(); |
|
25 | this.command_shortcuts = new keyboard.ShortcutManager(undefined, events); | |
|
25 | this.command_shortcuts = new keyboard.ShortcutManager(undefined, options.events); | |
|
26 | 26 | this.command_shortcuts.add_shortcuts(this.get_default_common_shortcuts()); |
|
27 | 27 | this.command_shortcuts.add_shortcuts(this.get_default_command_shortcuts()); |
|
28 | this.edit_shortcuts = new keyboard.ShortcutManager(undefined, events); | |
|
28 | this.edit_shortcuts = new keyboard.ShortcutManager(undefined, options.events); | |
|
29 | 29 | this.edit_shortcuts.add_shortcuts(this.get_default_common_shortcuts()); |
|
30 | 30 | this.edit_shortcuts.add_shortcuts(this.get_default_edit_shortcuts()); |
|
31 | 31 | }; |
@@ -42,7 +42,7 b' require([' | |||
|
42 | 42 | $('#ipython-main-app').addClass('border-box-sizing'); |
|
43 | 43 | $('div#notebook_panel').addClass('border-box-sizing'); |
|
44 | 44 | |
|
45 | var options = { | |
|
45 | var common_options = { | |
|
46 | 46 | base_url : utils.get_body_data("baseUrl"), |
|
47 | 47 | notebook_path : utils.get_body_data("notebookPath"), |
|
48 | 48 | notebook_name : utils.get_body_data('notebookName') |
@@ -52,15 +52,38 b' require([' | |||
|
52 | 52 | var page = new page.Page(); |
|
53 | 53 | var layout_manager = new layoutmanager.LayoutManager(); |
|
54 | 54 | var events = $([new events.Events()]); |
|
55 |
var pager = new pager.Pager('div#pager', 'div#pager_splitter', |
|
|
56 | var keyboard_manager = new keyboardmanager.KeyboardManager(pager, events); | |
|
55 | var pager = new pager.Pager('div#pager', 'div#pager_splitter', { | |
|
56 | layout_manager: layout_manager, | |
|
57 | events: events}); | |
|
58 | var keyboard_manager = new keyboardmanager.KeyboardManager({ | |
|
59 | pager: pager, | |
|
60 | events: events}); | |
|
57 | 61 | var save_widget = new savewidget.SaveWidget('span#save_widget', events); |
|
58 |
var notebook = new notebook.Notebook('div#notebook', |
|
|
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); | |
|
62 | var notebook = new notebook.Notebook('div#notebook', $.extend({ | |
|
63 | events: events, | |
|
64 | keyboard_manager: keyboard_manager, | |
|
65 | save_widget: save_widget, | |
|
66 | config: user_config}, | |
|
67 | common_options)); | |
|
68 | var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options); | |
|
69 | var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', { | |
|
70 | notebook: notebook, | |
|
71 | events: events}); | |
|
72 | var quick_help = new quickhelp.QuickHelp({ | |
|
73 | keyboard_manager: keyboard_manager, | |
|
74 | events: events}); | |
|
75 | var menubar = new menubar.MenuBar('#menubar', $.extend({ | |
|
76 | notebook: notebook, | |
|
77 | layout_manager: layout_manager, | |
|
78 | events: events, | |
|
79 | save_widget: save_widget, | |
|
80 | quick_help: quick_help}, | |
|
81 | common_options)); | |
|
82 | var notification_area = new notificationarea.NotificationArea( | |
|
83 | '#notification_area', { | |
|
84 | events: events, | |
|
85 | save_widget: save_widget, | |
|
86 | notebook: notebook}); | |
|
64 | 87 | notification_area.init_notification_widgets(); |
|
65 | 88 | |
|
66 | 89 | $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+ |
@@ -91,7 +114,7 b' require([' | |||
|
91 | 114 | |
|
92 | 115 | events.on('notebook_loaded.Notebook', first_load); |
|
93 | 116 | events.trigger('app_initialized.NotebookApp'); |
|
94 | notebook.load_notebook(options.notebook_name, options.notebook_path); | |
|
117 | notebook.load_notebook(common_options.notebook_name, common_options.notebook_path); | |
|
95 | 118 | |
|
96 | 119 | ipython.page = page; |
|
97 | 120 | ipython.layout_manager = layout_manager; |
@@ -9,10 +9,10 b' define([' | |||
|
9 | 9 | ], function(IPython, $, toolbar, celltoolbar) { |
|
10 | 10 | "use strict"; |
|
11 | 11 | |
|
12 |
var MainToolBar = function (selector, |
|
|
12 | var MainToolBar = function (selector, options) { | |
|
13 | 13 | toolbar.ToolBar.apply(this, arguments); |
|
14 | this.events = events; | |
|
15 | this.notebook = notebook; | |
|
14 | this.events = options.events; | |
|
15 | this.notebook = options.notebook; | |
|
16 | 16 | this.construct(); |
|
17 | 17 | this.add_celltype_list(); |
|
18 | 18 | this.add_celltoolbar_list(); |
@@ -24,18 +24,18 b' define([' | |||
|
24 | 24 | * $('body').data('baseUrl'); |
|
25 | 25 | * does not support change for now is set through this option |
|
26 | 26 | */ |
|
27 |
var MenuBar = function (selector, options |
|
|
27 | var MenuBar = function (selector, options) { | |
|
28 | 28 | options = options || {}; |
|
29 | 29 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); |
|
30 | 30 | this.selector = selector; |
|
31 | this.notebook = notebook; | |
|
32 | this.layout_manager = layout_manager; | |
|
33 | this.events = events; | |
|
34 | this.save_widget = save_widget; | |
|
35 | this.quick_help = quick_help; | |
|
31 | this.notebook = options.notebook; | |
|
32 | this.layout_manager = options.layout_manager; | |
|
33 | this.events = options.events; | |
|
34 | this.save_widget = options.save_widget; | |
|
35 | this.quick_help = options.quick_help; | |
|
36 | 36 | |
|
37 | 37 | try { |
|
38 | this.tour = new tour.Tour(notebook, events); | |
|
38 | this.tour = new tour.Tour(this.notebook, this.events); | |
|
39 | 39 | } catch (e) { |
|
40 | 40 | this.tour = undefined; |
|
41 | 41 | console.log("Failed to instantiate Notebook Tour", e); |
@@ -38,15 +38,18 b' define([' | |||
|
38 | 38 | * @param {Object} [options] A config object |
|
39 | 39 | * @param {Object} [events] An events object |
|
40 | 40 | */ |
|
41 |
var Notebook = function (selector, options |
|
|
42 | this.config = config; | |
|
43 | this.events = events; | |
|
44 | this.keyboard_manager = keyboard_manager; | |
|
41 | var Notebook = function (selector, options) { | |
|
42 | this.config = options.config || {}; | |
|
43 | this.base_url = options.base_url; | |
|
44 | this.notebook_path = options.notebook_path; | |
|
45 | this.notebook_name = options.notebook_name; | |
|
46 | this.events = options.events; | |
|
47 | this.keyboard_manager = options.keyboard_manager; | |
|
48 | this.save_widget = options.save_widget; | |
|
45 | 49 | // TODO: This code smells (and the other `= this` line a couple lines down) |
|
46 | 50 | // We need a better way to deal with circular instance references. |
|
47 | keyboard_manager.notebook = this; | |
|
48 |
this.save_widget = s |
|
|
49 | save_widget.notebook = this; | |
|
51 | this.keyboard_manager.notebook = this; | |
|
52 | this.save_widget.notebook = this; | |
|
50 | 53 | |
|
51 | 54 | mathjaxutils.init(); |
|
52 | 55 | |
@@ -76,10 +79,6 b' define([' | |||
|
76 | 79 | IPython.save_widget = this.save_widget; |
|
77 | 80 | IPython.keyboard = this.keyboard; |
|
78 | 81 | |
|
79 | this.options = options = options || {}; | |
|
80 | this.base_url = options.base_url; | |
|
81 | this.notebook_path = options.notebook_path; | |
|
82 | this.notebook_name = options.notebook_name; | |
|
83 | 82 | this.element = $(selector); |
|
84 | 83 | this.element.scroll(); |
|
85 | 84 | this.element.data("notebook", this); |
@@ -806,15 +805,24 b' define([' | |||
|
806 | 805 | type = type || this.get_selected_cell().cell_type; |
|
807 | 806 | |
|
808 | 807 | if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { |
|
808 | var cell_options = { | |
|
809 | base_url: base_url, | |
|
810 | notebook_path: notebook_path, | |
|
811 | notebook_name: notebook_name, | |
|
812 | events: this.events, | |
|
813 | config: this.config, | |
|
814 | keyboard_manager: this.keyboard_manager, | |
|
815 | notebook: this | |
|
816 | }; | |
|
809 | 817 | if (type === 'code') { |
|
810 |
cell = new codecell.CodeCell(this.kernel, |
|
|
818 | cell = new codecell.CodeCell(this.kernel, cell_options); | |
|
811 | 819 | cell.set_input_prompt(); |
|
812 | 820 | } else if (type === 'markdown') { |
|
813 |
cell = new cells.MarkdownCell( |
|
|
821 | cell = new cells.MarkdownCell(cell_options); | |
|
814 | 822 | } else if (type === 'raw') { |
|
815 |
cell = new cells.RawCell( |
|
|
823 | cell = new cells.RawCell(cell_options); | |
|
816 | 824 | } else if (type === 'heading') { |
|
817 |
cell = new cells.HeadingCell( |
|
|
825 | cell = new cells.HeadingCell(cell_options); | |
|
818 | 826 | } |
|
819 | 827 | |
|
820 | 828 | if(this._insert_element_at_index(cell.element,index)) { |
@@ -1465,7 +1473,11 b' define([' | |||
|
1465 | 1473 | * @method start_session |
|
1466 | 1474 | */ |
|
1467 | 1475 | Notebook.prototype.start_session = function () { |
|
1468 |
this.session = new session.Session(this, |
|
|
1476 | this.session = new session.Session(this, { | |
|
1477 | base_url: base_url, | |
|
1478 | notebook_path: notebook_path, | |
|
1479 | notebook_name: notebook_name, | |
|
1480 | notebook: this}); | |
|
1469 | 1481 | this.session.start($.proxy(this._session_started, this)); |
|
1470 | 1482 | }; |
|
1471 | 1483 |
@@ -10,11 +10,11 b' define([' | |||
|
10 | 10 | ], function(IPython, $, utils, dialog, notificationwidget) { |
|
11 | 11 | "use strict"; |
|
12 | 12 | |
|
13 |
var NotificationArea = function (selector, |
|
|
13 | var NotificationArea = function (selector, options) { | |
|
14 | 14 | this.selector = selector; |
|
15 | this.events = events; | |
|
16 | this.save_widget = save_widget; | |
|
17 | this.notebook = notebook; | |
|
15 | this.events = options.events; | |
|
16 | this.save_widget = options.save_widget; | |
|
17 | this.notebook = options.notebook; | |
|
18 | 18 | if (this.selector !== undefined) { |
|
19 | 19 | this.element = $(selector); |
|
20 | 20 | } |
@@ -8,13 +8,13 b' define([' | |||
|
8 | 8 | ], function(IPython, $, utils) { |
|
9 | 9 | "use strict"; |
|
10 | 10 | |
|
11 |
var Pager = function (pager_selector, pager_splitter_selector, |
|
|
12 | this.events = events; | |
|
11 | var Pager = function (pager_selector, pager_splitter_selector, options) { | |
|
12 | this.events = options.events; | |
|
13 | 13 | this.pager_element = $(pager_selector); |
|
14 | 14 | this.pager_button_area = $('#pager_button_area'); |
|
15 | 15 | var that = this; |
|
16 | 16 | this.percentage_height = 0.40; |
|
17 | layout_manager.pager = this; | |
|
17 | options.layout_manager.pager = this; | |
|
18 | 18 | this.pager_splitter_element = $(pager_splitter_selector) |
|
19 | 19 | .draggable({ |
|
20 | 20 | containment: 'window', |
@@ -23,7 +23,7 b' define([' | |||
|
23 | 23 | drag: function(event, ui) { |
|
24 | 24 | // recalculate the amount of space the pager should take |
|
25 | 25 | var pheight = ($(document.body).height()-event.clientY-4); |
|
26 | var downprct = pheight/layout_manager.app_height(); | |
|
26 | var downprct = pheight/options.layout_manager.app_height(); | |
|
27 | 27 | downprct = Math.min(0.9, downprct); |
|
28 | 28 | if (downprct < 0.1) { |
|
29 | 29 | that.percentage_height = 0.1; |
@@ -32,7 +32,7 b' define([' | |||
|
32 | 32 | that.percentage_height = downprct; |
|
33 | 33 | that.expand({'duration':0}); |
|
34 | 34 | } |
|
35 | layout_manager.do_resize(); | |
|
35 | options.layout_manager.do_resize(); | |
|
36 | 36 | } |
|
37 | 37 | }); |
|
38 | 38 | this.expanded = false; |
@@ -10,10 +10,10 b' define([' | |||
|
10 | 10 | "use strict"; |
|
11 | 11 | var platform = utils.platform; |
|
12 | 12 | |
|
13 |
var QuickHelp = function ( |
|
|
14 | this.keyboard_manager = keyboard_manager; | |
|
15 | keyboard_manager.quick_help = this; | |
|
16 | this.events = events; | |
|
13 | var QuickHelp = function (options) { | |
|
14 | this.keyboard_manager = options.keyboard_manager; | |
|
15 | this.keyboard_manager.quick_help = this; | |
|
16 | this.events = options.events; | |
|
17 | 17 | }; |
|
18 | 18 | |
|
19 | 19 | var cmd_ctrl = 'Ctrl-'; |
@@ -24,27 +24,28 b' define([' | |||
|
24 | 24 | * @param [options.cm_config] {object} config to pass to CodeMirror, will extend/overwrite default config |
|
25 | 25 | * @param [options.placeholder] {string} default string to use when souce in empty for rendering (only use in some TextCell subclass) |
|
26 | 26 | */ |
|
27 |
var TextCell = function (options |
|
|
27 | var TextCell = function (options) { | |
|
28 | options = options || {}; | |
|
28 | 29 | // in all TextCell/Cell subclasses |
|
29 | 30 | // do not assign most of members here, just pass it down |
|
30 | 31 | // in the options dict potentially overwriting what you wish. |
|
31 | 32 | // they will be assigned in the base class. |
|
32 | this.notebook = notebook; | |
|
33 | this.events = events; | |
|
34 | this.config = config; | |
|
33 | this.notebook = options.notebook; | |
|
34 | this.events = options.events; | |
|
35 | this.config = options.config; | |
|
35 | 36 | |
|
36 | 37 | // we cannot put this as a class key as it has handle to "this". |
|
37 | 38 | var cm_overwrite_options = { |
|
38 | 39 | onKeyEvent: $.proxy(this.handle_keyevent,this) |
|
39 | 40 | }; |
|
40 | ||
|
41 | options = this.mergeopt(TextCell,options,{cm_config:cm_overwrite_options}); | |
|
41 | var config = this.mergeopt(TextCell, this.config, {cm_config:cm_overwrite_options}); | |
|
42 | Cell.apply(this, [{ | |
|
43 | config: config, | |
|
44 | keyboard_manager: options.keyboard_manager, | |
|
45 | events: events}]); | |
|
42 | 46 | |
|
43 | 47 | this.cell_type = this.cell_type || 'text'; |
|
44 | 48 | mathjaxutils = mathjaxutils; |
|
45 | ||
|
46 | Cell.apply(this, [options, keyboard_manager, events]); | |
|
47 | ||
|
48 | 49 | this.rendered = false; |
|
49 | 50 | }; |
|
50 | 51 | |
@@ -218,11 +219,12 b' define([' | |||
|
218 | 219 | * @constructor MarkdownCell |
|
219 | 220 | * @extends IPython.HTMLCell |
|
220 | 221 | */ |
|
221 |
var MarkdownCell = function (options |
|
|
222 | options = this.mergeopt(MarkdownCell, options); | |
|
222 | var MarkdownCell = function (options) { | |
|
223 | options = options || {}; | |
|
224 | var config = this.mergeopt(MarkdownCell, options.config); | |
|
225 | TextCell.apply(this, [$.extend({}, options, {config: config})]); | |
|
223 | 226 | |
|
224 | 227 | this.cell_type = 'markdown'; |
|
225 | TextCell.apply(this, [options, events, config, keyboard_manager]); | |
|
226 | 228 | }; |
|
227 | 229 | |
|
228 | 230 | MarkdownCell.options_default = { |
@@ -268,13 +270,14 b' define([' | |||
|
268 | 270 | * @constructor RawCell |
|
269 | 271 | * @extends TextCell |
|
270 | 272 | */ |
|
271 |
var RawCell = function (options |
|
|
273 | var RawCell = function (options) { | |
|
274 | options = options || {}; | |
|
275 | var config = this.mergeopt(RawCell, options.config); | |
|
276 | TextCell.apply(this, [$.extend({}, options, {config: config})]); | |
|
272 | 277 | |
|
273 | options = this.mergeopt(RawCell,options); | |
|
274 | TextCell.apply(this, [options, events, config, keyboard_manager]); | |
|
275 | this.cell_type = 'raw'; | |
|
276 | 278 | // RawCell should always hide its rendered div |
|
277 | 279 | this.element.find('div.text_cell_render').hide(); |
|
280 | this.cell_type = 'raw'; | |
|
278 | 281 | }; |
|
279 | 282 | |
|
280 | 283 | RawCell.options_default = { |
@@ -327,17 +330,13 b' define([' | |||
|
327 | 330 | * @constructor HeadingCell |
|
328 | 331 | * @extends TextCell |
|
329 | 332 | */ |
|
330 |
var HeadingCell = function (options |
|
|
331 |
options = |
|
|
333 | var HeadingCell = function (options) { | |
|
334 | options = options || {}; | |
|
335 | var config = this.mergeopt(HeadingCell, options.config); | |
|
336 | TextCell.apply(this, [$.extend({}, options, {config: config})]); | |
|
332 | 337 | |
|
333 | 338 | this.level = 1; |
|
334 | 339 | this.cell_type = 'heading'; |
|
335 | TextCell.apply(this, [options, events, config, keyboard_manager]); | |
|
336 | ||
|
337 | /** | |
|
338 | * heading level of the cell, use getter and setter to access | |
|
339 | * @property level | |
|
340 | */ | |
|
341 | 340 | }; |
|
342 | 341 | |
|
343 | 342 | HeadingCell.options_default = { |
@@ -9,10 +9,10 b' define([' | |||
|
9 | 9 | ], function(IPython, $, utils, kernel) { |
|
10 | 10 | "use strict"; |
|
11 | 11 | |
|
12 |
var Session = function( |
|
|
12 | var Session = function(options){ | |
|
13 | 13 | this.kernel = null; |
|
14 | 14 | this.id = null; |
|
15 | this.notebook = notebook; | |
|
15 | this.notebook = options.notebook; | |
|
16 | 16 | this.name = notebook.notebook_name; |
|
17 | 17 | this.path = notebook.notebook_path; |
|
18 | 18 | this.base_url = notebook.base_url; |
@@ -8,8 +8,10 b' define([' | |||
|
8 | 8 | ], function(IPython, $, notebooklist) { |
|
9 | 9 | "use strict"; |
|
10 | 10 | |
|
11 |
var KernelList = function (selector, options |
|
|
12 |
notebooklist.NotebookList.call(this, selector, |
|
|
11 | var KernelList = function (selector, options) { | |
|
12 | notebooklist.NotebookList.call(this, selector, $.extend({ | |
|
13 | element_name: 'running'}, | |
|
14 | options)); | |
|
13 | 15 | }; |
|
14 | 16 | |
|
15 | 17 | KernelList.prototype = Object.create(notebooklist.NotebookList.prototype); |
@@ -1,7 +1,6 b'' | |||
|
1 | 1 | // Copyright (c) IPython Development Team. |
|
2 | 2 | // Distributed under the terms of the Modified BSD License. |
|
3 | 3 | |
|
4 | var ipython = ipython || {}; | |
|
5 | 4 | require([ |
|
6 | 5 | 'base/js/namespace', |
|
7 | 6 | 'jquery', |
@@ -29,16 +28,22 b' require([' | |||
|
29 | 28 | |
|
30 | 29 | page = new page.Page(); |
|
31 | 30 | |
|
32 | var opts = { | |
|
31 | var common_options = { | |
|
33 | 32 | base_url: utils.get_body_data("baseUrl"), |
|
34 | 33 | notebook_path: utils.get_body_data("notebookPath"), |
|
35 | 34 | }; |
|
36 | 35 | events = $([new events.Events()]); |
|
37 |
session_list = new sesssionlist.SesssionList( |
|
|
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); | |
|
36 | session_list = new sesssionlist.SesssionList($.extend({ | |
|
37 | events: events}, | |
|
38 | common_options)); | |
|
39 | notebook_list = new notebooklist.NotebookList('#notebook_list', $.extend({ | |
|
40 | session_list: session_list}, | |
|
41 | common_options)); | |
|
42 | cluster_list = new clusterlist.ClusterList('#cluster_list', common_options); | |
|
43 | kernel_list = new kernellist.KernelList('#running_list', $.extend({ | |
|
44 | session_list: session_list}, | |
|
45 | common_options)); | |
|
46 | login_widget = new loginwidget.LoginWidget('#login_widget', common_options); | |
|
42 | 47 | |
|
43 | 48 | $('#new_notebook').button().click(function (e) { |
|
44 | 49 | notebook_list.new_notebook(); |
@@ -104,11 +109,11 b' require([' | |||
|
104 | 109 | } |
|
105 | 110 | |
|
106 | 111 | // For backwards compatability. |
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
112 | IPython.page = page; | |
|
113 | IPython.notebook_list = notebook_list; | |
|
114 | IPython.cluster_list = cluster_list; | |
|
115 | IPython.session_list = session_list; | |
|
116 | IPython.kernel_list = kernel_list; | |
|
117 | IPython.login_widget = login_widget; | |
|
118 | IPython.events = events; | |
|
114 | 119 | }); |
@@ -9,11 +9,11 b' define([' | |||
|
9 | 9 | ], function(IPython, $, utils, dialog) { |
|
10 | 10 | "use strict"; |
|
11 | 11 | |
|
12 |
var NotebookList = function (selector, options |
|
|
12 | var NotebookList = function (selector, options) { | |
|
13 | 13 | var that = this; |
|
14 | this.session_list = session_list; | |
|
14 | this.session_list = options.session_list; | |
|
15 | 15 | // allow code re-use by just changing element_name in kernellist.js |
|
16 | this.element_name = element_name || 'notebook'; | |
|
16 | this.element_name = options.element_name || 'notebook'; | |
|
17 | 17 | this.selector = selector; |
|
18 | 18 | if (this.selector !== undefined) { |
|
19 | 19 | this.element = $(selector); |
General Comments 0
You need to be logged in to leave comments.
Login now