diff --git a/IPython/frontend/html/notebook/static/css/notebook.css b/IPython/frontend/html/notebook/static/css/notebook.css index 832d36b..1217782 100644 --- a/IPython/frontend/html/notebook/static/css/notebook.css +++ b/IPython/frontend/html/notebook/static/css/notebook.css @@ -61,7 +61,7 @@ span#notebook_name { z-index: 10; } -.notification{ +.notification_widget{ float : right; right: 0px; top: 1px; diff --git a/IPython/frontend/html/notebook/static/js/initnotificationwidgets.js b/IPython/frontend/html/notebook/static/js/initnotificationwidgets.js deleted file mode 100644 index 355eee8..0000000 --- a/IPython/frontend/html/notebook/static/js/initnotificationwidgets.js +++ /dev/null @@ -1,90 +0,0 @@ -//---------------------------------------------------------------------------- -// 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 initNotificationWidgets = function(IPython) { - var na = IPython.notification_area - IPython.kernelnotificationwidget = na.new_notification_widget('kernel'); - - - var knw = IPython.kernelnotificationwidget; - // Kernel events - $([IPython.events]).on('status_idle.Kernel',function () { - IPython.save_widget.update_document_title(); - knw.set_message('Kernel Idle',200); - } - ); - - $([IPython.events]).on('status_busy.Kernel',function () { - window.document.title='(Busy) '+window.document.title; - knw.set_message("Kernel busy"); - }); - - $([IPython.events]).on('status_restarting.Kernel',function () { - IPython.save_widget.update_document_title(); - knw.set_message("Restarting kernel",1000); - }); - - $([IPython.events]).on('status_interrupting.Kernel',function () { - knw.set_message("Interrupting kernel"); - }); - - $([IPython.events]).on('status_dead.Kernel',function () { - var dialog = $('
'); - dialog.html('The kernel has died, would you like to restart it? If you do not restart the kernel, you will be able to save the notebook, but running code will not work until the notebook is reopened.'); - $(document).append(dialog); - dialog.dialog({ - resizable: false, - modal: true, - title: "Dead kernel", - buttons : { - "Restart": function () { - $([IPython.events]).trigger('status_restarting.Kernel'); - IPython.notebook.start_kernel(); - $(this).dialog('close'); - }, - "Continue running": function () { - $(this).dialog('close'); - } - } - }); - }); - - IPython.notebooknotificationwidget = na.new_notification_widget('notebook'); - var nnw = IPython.notebooknotificationwidget; - - - // Notebook events - $([IPython.events]).on('notebook_loading.Notebook', function () { - nnw.set_message("Loading notebook",500); - }); - $([IPython.events]).on('notebook_loaded.Notebook', function () { - nnw.set_message("Notebook loaded",500); - }); - $([IPython.events]).on('notebook_saving.Notebook', function () { - nnw.set_message("Saving notebook",500); - }); - $([IPython.events]).on('notebook_saved.Notebook', function () { - nnw.set_message("Notebook saved",2000); - }); - $([IPython.events]).on('notebook_save_failed.Notebook', function () { - nnw.set_message("Notebook save failed"); - }); - - } - - IPython.initNotificationWidgets = initNotificationWidgets; - - return IPython; - -}(IPython)); - diff --git a/IPython/frontend/html/notebook/static/js/kernel.js b/IPython/frontend/html/notebook/static/js/kernel.js index 77292ba..6006986 100644 --- a/IPython/frontend/html/notebook/static/js/kernel.js +++ b/IPython/frontend/html/notebook/static/js/kernel.js @@ -99,7 +99,7 @@ var IPython = (function (IPython) { " or if the url does not look right, there could be an error in the" + " server's configuration."; } else { - IPython.notification_widget.set_message('Reconnecting Websockets', 1000); + IPython.notification_area.widget('kernel').set_message('Reconnecting Websockets', 1000); this.start_channels(); return; } diff --git a/IPython/frontend/html/notebook/static/js/notebookmain.js b/IPython/frontend/html/notebook/static/js/notebookmain.js index 2416b4b..95eb0f8 100644 --- a/IPython/frontend/html/notebook/static/js/notebookmain.js +++ b/IPython/frontend/html/notebook/static/js/notebookmain.js @@ -32,7 +32,7 @@ $(document).ready(function () { IPython.toolbar = new IPython.ToolBar('#toolbar') IPython.tooltip = new IPython.Tooltip() IPython.notification_area = new IPython.NotificationArea('#notification_area') - IPython.initNotificationWidgets(IPython); + IPython.notification_area.init_notification_widgets(); IPython.layout_manager.do_resize(); diff --git a/IPython/frontend/html/notebook/static/js/notificationarea.js b/IPython/frontend/html/notebook/static/js/notificationarea.js index 5148de4..c23532e 100644 --- a/IPython/frontend/html/notebook/static/js/notificationarea.js +++ b/IPython/frontend/html/notebook/static/js/notificationarea.js @@ -19,6 +19,7 @@ var IPython = (function (IPython) { if (this.selector !== undefined) { this.element = $(selector); } + this.widget_dict = {}; }; NotificationArea.prototype.temp_message = function (msg, timeout, css_class) { @@ -27,7 +28,7 @@ var IPython = (function (IPython) { if( css_class == 'warning'){css_class = 'ui-state-highlight'} var tdiv = $('