Use ipython namepsace for instances.

This commit is contained in:
Jonathan Frederic 2014-06-12 15:40:00 -07:00
parent fb32b6561f
commit 9bfe5fc06c
7 changed files with 34 additions and 38 deletions

View File

@ -1,9 +1,10 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
require(['base/js/namespace', 'base/js/page'], function(IPython, Page) {
IPython.page = new Page();
var ipython = ipython || {};
require(['base/js/page'], function(Page) {
ipython.page = new Page();
$('button#login_submit').addClass("btn btn-default");
IPython.page.show();
ipython.page.show();
$('input#password_input').focus();
});

View File

@ -1,8 +1,9 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
var ipython = ipython || {};
require(['base/js/namespace', 'base/js/page'], function(IPython, Page) {
IPython.page = new Page();
require(['base/js/page'], function(Page) {
ipython.page = new Page();
$('#ipython-main-app').addClass('border-box-sizing');
IPython.page.show();
ipython.page.show();
});

View File

@ -11,15 +11,10 @@ define(['base/js/namespace'], function(IPython) {
"use strict";
var Events = function () {};
events = new Events();
// Backwards compatability.
IPython.Events = Events;
IPython.events = events;
// This behavior is an akward exception to the normal design pattern of
// returning the namespace. Events are used eveywhere in IPython,
// and only one instance is ever used. For convenience, create and
// return that instance here instead of the namespace.
return events;
// TODO: Fix events.
return Events;
});

View File

@ -1,7 +1,8 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
require(['base/js/namespace', 'base/js/page'], function(IPython, Page) {
IPython.page = new Page();
IPython.page.show();
var ipython = ipython || {};
require(['base/js/page'], function(Page) {
ipython.page = new Page();
ipython.page.show();
});

View File

@ -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',
'notebook/js/notebook',
@ -83,15 +84,13 @@ require([
$([Events]).trigger('app_initialized.NotebookApp');
notebook.load_notebook(opts.notebook_name, opts.notebook_path);
// Backwards compatability.
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.notification_area = notification_area;
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;
});

View File

@ -1,7 +1,8 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
define([
var ipython = ipython || {};
require([
'base/js/namespace',
'components/jquery/jquery.min',
'base/js/page',
@ -100,12 +101,10 @@ define([
}
// 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;
return page;
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;
});

View File

@ -110,5 +110,5 @@ data-notebook-path="{{notebook_path}}"
{% endblock %}
{% block script %}
<script src="{{ static_url("tree/js/tree_app.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ static_url("tree/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
{% endblock %}