##// END OF EJS Templates
Use default OS shell to run system commands...
Use default OS shell to run system commands Instead of using os.system which uses /bin/sh, this uses subprocess.call (the replacement of os.system) to run the command using the default shell of the OS. With this, one can use more advanced commands for bash, zsh, ksh, ... I do not have a win32 system to test this modification, so maybe line 2236 can also be changed like 2239.

File last commit:

r11033:fa36e98f
r12217:56bf2f98
Show More
notificationwidget.js
82 lines | 2.6 KiB | application/javascript | JavascriptLexer
/ IPython / html / static / notebook / js / notificationwidget.js
Brian Granger
Major refactoring of saving, notification....
r6047 //----------------------------------------------------------------------------
// 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) {
Matthias BUSSONNIER
use strict in notificationwidget.js
r8206 "use strict";
Brian Granger
Major refactoring of saving, notification....
r6047 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();
}
Matthias BUSSONNIER
prototype sticky notification
r8025 this.element.button();
this.element.hide();
var that = this;
Matthias BUSSONNIER
tweek notebook notification behavior
r8074
Brian Granger
Major refactoring of saving, notification....
r6047 };
NotificationWidget.prototype.style = function () {
MinRK
bootstrapify notification widget
r10932 this.element.addClass('notification_widget pull-right');
Brian Granger
Major refactoring of saving, notification....
r6047 this.element.addClass('border-box-sizing');
};
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 // msg : message to display
// timeout : time in ms before diseapearing
//
// if timeout <= 0
// click_callback : function called if user click on notification
// could return false to prevent the notification to be dismissed
NotificationWidget.prototype.set_message = function (msg, timeout, click_callback) {
Matthias BUSSONNIER
jslint 2
r8205 var callback = click_callback || function() {return false;};
Brian Granger
Major refactoring of saving, notification....
r6047 var that = this;
this.element.html(msg);
this.element.fadeIn(100);
if (this.timeout !== null) {
clearTimeout(this.timeout);
this.timeout = null;
Matthias BUSSONNIER
jslint 2
r8205 }
Matthias BUSSONNIER
prototype sticky notification
r8025 if (timeout !== undefined && timeout >=0) {
Brian Granger
Major refactoring of saving, notification....
r6047 this.timeout = setTimeout(function () {
that.element.fadeOut(100, function () {that.element.html('');});
that.timeout = null;
Matthias BUSSONNIER
prototype sticky notification
r8025 }, timeout);
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 } else {
Matthias BUSSONNIER
jslint 2
r8205 this.element.click(function() {
if( callback() != false ) {
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 that.element.fadeOut(100, function () {that.element.html('');});
Matthias BUSSONNIER
jslint 2
r8205 that.element.unbind('click');
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 }
if (that.timeout !== undefined) {
Matthias BUSSONNIER
jslint 2
r8205 that.timeout = undefined;
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 clearTimeout(that.timeout);
}
});
}
Brian Granger
Major refactoring of saving, notification....
r6047 };
NotificationWidget.prototype.get_message = function () {
return this.element.html();
};
IPython.NotificationWidget = NotificationWidget;
return IPython;
}(IPython));