Merge pull request #1361 from ellisonbg/nbissues
A number of bug fixes for notebook issues that had crept up recently with all the major improvements done on multiple fronts. In closing #1359, we've changed slightly how Math() works: it now unconditionally surrounds its input with $$...$$, so that it always appears in displayed math mode. We have also introduced a new display object, Latex(), which does *not* add any latex markup, for other constructs beyond simple math expressions. This change makes Math() friendlier to use in simple cases and means that Math(sympy.latex(foo)) will produce the expected displayed math results without the user having to add any $ markup. Summary of fixes: Fixes #1344: Ctrl + M + L does not toggle line numbering in htmlnotebook. Fixes #1337: Tab in the notebook after `(` should not indent, only give a tooltip. Fixes #1339: Notebook printing broken. Fixes #1348: `Ctrl-m-Ctrl-m` does not switch to markdown cell Fixes #1359: [sympyprinting] MathJax can't render \root{m}{n}
commit
8c6572347a
@ -0,0 +1,31 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2011 The IPython Development Team
|
||||
//
|
||||
// Distributed under the terms of the BSD License. The full license is in
|
||||
// the file COPYING, distributed as part of this software.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
// Events
|
||||
//============================================================================
|
||||
|
||||
// Give us an object to bind all events to. This object should be created
|
||||
// before all other objects so it exists when others register event handlers.
|
||||
// To trigger an event handler:
|
||||
// $([IPython.events]).trigger('event.Namespace);
|
||||
// To handle it:
|
||||
// $([IPython.events]).on('event.Namespace',function () {});
|
||||
|
||||
var IPython = (function (IPython) {
|
||||
|
||||
var utils = IPython.utils;
|
||||
|
||||
var Events = function () {};
|
||||
|
||||
IPython.Events = Events;
|
||||
IPython.events = new Events();
|
||||
|
||||
return IPython;
|
||||
|
||||
}(IPython));
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2011 The IPython Development Team
|
||||
//
|
||||
// Distributed under the terms of the BSD License. The full license is in
|
||||
// the file COPYING, distributed as part of this software.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
// Notification widget
|
||||
//============================================================================
|
||||
|
||||
var IPython = (function (IPython) {
|
||||
|
||||
var utils = IPython.utils;
|
||||
|
||||
|
||||
var NotificationWidget = function (selector) {
|
||||
this.selector = selector;
|
||||
this.timeout = null;
|
||||
this.busy = false;
|
||||
if (this.selector !== undefined) {
|
||||
this.element = $(selector);
|
||||
this.style();
|
||||
this.bind_events();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
NotificationWidget.prototype.style = function () {
|
||||
this.element.addClass('ui-widget ui-widget-content ui-corner-all');
|
||||
this.element.addClass('border-box-sizing');
|
||||
};
|
||||
|
||||
|
||||
NotificationWidget.prototype.bind_events = function () {
|
||||
var that = this;
|
||||
// Kernel events
|
||||
$([IPython.events]).on('status_idle.Kernel',function () {
|
||||
IPython.save_widget.update_document_title();
|
||||
if (that.get_message() === 'Kernel busy') {
|
||||
that.element.fadeOut(100, function () {
|
||||
that.element.html('');
|
||||
});
|
||||
};
|
||||
});
|
||||
$([IPython.events]).on('status_busy.Kernel',function () {
|
||||
window.document.title='(Busy) '+window.document.title;
|
||||
that.set_message("Kernel busy");
|
||||
});
|
||||
$([IPython.events]).on('status_restarting.Kernel',function () {
|
||||
that.set_message("Restarting kernel",500);
|
||||
});
|
||||
$([IPython.events]).on('status_interrupting.Kernel',function () {
|
||||
that.set_message("Interrupting kernel",500);
|
||||
});
|
||||
// Notebook events
|
||||
$([IPython.events]).on('notebook_loading.Notebook', function () {
|
||||
that.set_message("Loading notebook",500);
|
||||
});
|
||||
$([IPython.events]).on('notebook_loaded.Notebook', function () {
|
||||
that.set_message("Notebook loaded",500);
|
||||
});
|
||||
$([IPython.events]).on('notebook_saving.Notebook', function () {
|
||||
that.set_message("Saving notebook",500);
|
||||
});
|
||||
$([IPython.events]).on('notebook_saved.Notebook', function () {
|
||||
that.set_message("Notebook saved",500);
|
||||
});
|
||||
$([IPython.events]).on('notebook_save_failed.Notebook', function () {
|
||||
that.set_message("Notebook save failed",500);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
NotificationWidget.prototype.set_message = function (msg, timeout) {
|
||||
var that = this;
|
||||
this.element.html(msg);
|
||||
this.element.fadeIn(100);
|
||||
if (this.timeout !== null) {
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = null;
|
||||
};
|
||||
if (timeout !== undefined) {
|
||||
this.timeout = setTimeout(function () {
|
||||
that.element.fadeOut(100, function () {that.element.html('');});
|
||||
that.timeout = null;
|
||||
}, timeout)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
NotificationWidget.prototype.get_message = function () {
|
||||
return this.element.html();
|
||||
};
|
||||
|
||||
|
||||
IPython.NotificationWidget = NotificationWidget;
|
||||
|
||||
return IPython;
|
||||
|
||||
}(IPython));
|
||||
|
||||
Loading…
Reference in new issue