From ca089cc7cf3a3f52d8502c9ab8b4b989b5d25c84 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Wed, 25 Apr 2012 18:13:20 +0200 Subject: [PATCH 01/21] alternate notebook upload methods fixes #1562 --- .../static/css/alternate_uploadform.css | 23 ++++++++ .../html/notebook/static/js/notebooklist.js | 58 +++++++++++-------- .../static/js/projectdashboardmain.js | 7 ++- .../notebook/templates/projectdashboard.html | 11 +++- 4 files changed, 72 insertions(+), 27 deletions(-) create mode 100644 IPython/frontend/html/notebook/static/css/alternate_uploadform.css diff --git a/IPython/frontend/html/notebook/static/css/alternate_uploadform.css b/IPython/frontend/html/notebook/static/css/alternate_uploadform.css new file mode 100644 index 000000000..1e5f8a47a --- /dev/null +++ b/IPython/frontend/html/notebook/static/css/alternate_uploadform.css @@ -0,0 +1,23 @@ +/* We need an invisible input field on top of the sentense*/ +/* "Drag file onto the list ..." */ + +.alternate_upload +{ + background-color:none; + display: inline; +} + +.alternate_upload.form +{ + padding: 0; + margin:0; +} + +.alternate_upload input.fileinput +{ + background-color:red; + position:relative; + opacity: 0; + z-index: 2; + width: 356px; +} diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index a7e98ee64..e8f8b2c0e 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -43,33 +43,45 @@ var IPython = (function (IPython) { this.element.bind('dragover', function () { return false; }); - this.element.bind('drop', function (event) { - var files = event.originalEvent.dataTransfer.files; - for (var i = 0, f; f = files[i]; i++) { - var reader = new FileReader(); - reader.readAsText(f); - var fname = f.name.split('.'); - var nbname = fname.slice(0,-1).join('.'); - var nbformat = fname.slice(-1)[0]; - if (nbformat === 'ipynb') {nbformat = 'json';}; - if (nbformat === 'py' || nbformat === 'json') { - var item = that.new_notebook_item(0); - that.add_name_input(nbname, item); - item.data('nbformat', nbformat); - // Store the notebook item in the reader so we can use it later - // to know which item it belongs to. - $(reader).data('item', item); - reader.onload = function (event) { - var nbitem = $(event.target).data('item'); - that.add_notebook_data(event.target.result, nbitem); - that.add_upload_button(nbitem); - }; - }; - } + this.element.bind('drop', function(event){ + console.log('bound to drop'); + that.handelFilesUpload(event,'drop'); return false; }); }; + NotebookList.prototype.handelFilesUpload = function(event, dropOrForm) { + var that = this; + var files; + if(dropOrForm =='drop'){ + files = event.originalEvent.dataTransfer.files; + } else + { + files = event.originalEvent.target.files + } + for (var i = 0, f; f = files[i]; i++) { + var reader = new FileReader(); + reader.readAsText(f); + var fname = f.name.split('.'); + var nbname = fname.slice(0,-1).join('.'); + var nbformat = fname.slice(-1)[0]; + if (nbformat === 'ipynb') {nbformat = 'json';}; + if (nbformat === 'py' || nbformat === 'json') { + var item = that.new_notebook_item(0); + that.add_name_input(nbname, item); + item.data('nbformat', nbformat); + // Store the notebook item in the reader so we can use it later + // to know which item it belongs to. + $(reader).data('item', item); + reader.onload = function (event) { + var nbitem = $(event.target).data('item'); + that.add_notebook_data(event.target.result, nbitem); + that.add_upload_button(nbitem); + }; + }; + } + return false; + }; NotebookList.prototype.clear_list = function () { this.element.children('.list_item').remove(); diff --git a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js index 1f6a69f26..5957210a6 100644 --- a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js +++ b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js @@ -32,8 +32,11 @@ $(document).ready(function () { IPython.notebook_list.load_list(); IPython.cluster_list.load_list(); - IPython.page.show(); - + + // bound the upload method to the on change of the file select list + $("#alternate_upload").change(function (event){ + IPython.notebook_list.handelFilesUpload(event,'form'); + }); }); diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 42aefb478..59d9a0ab7 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -4,6 +4,7 @@ {% block stylesheet %} + {% end %} @@ -30,8 +31,14 @@ data-read-only={{read_only}}
{% if logged_in or not read_only %}
- Drag files onto the list to import - notebooks. + +
+ Drag files + onto the list, or click here, to import + notebooks. + +
+ From 275b1040b189f4f2913d82851625cbb656da3458 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Fri, 27 Apr 2012 12:55:58 +0200 Subject: [PATCH 02/21] multifile selection --- .../html/notebook/templates/projectdashboard.html | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 59d9a0ab7..8cb0d7b62 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -31,15 +31,12 @@ data-read-only={{read_only}}
{% if logged_in or not read_only %}
- -
- Drag files - onto the list, or click here, to import - notebooks. - + + Drag files + onto the list, or click here, to import + notebooks. +
- - From 8d673ea086ef85e6187870fac54c9bf709fec6d5 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Fri, 27 Apr 2012 18:56:26 +0200 Subject: [PATCH 03/21] clean html, style logon form --- IPython/frontend/html/notebook/templates/login.html | 2 +- IPython/frontend/html/notebook/templates/projectdashboard.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/templates/login.html b/IPython/frontend/html/notebook/templates/login.html index b99dc0866..34f2a0e1d 100644 --- a/IPython/frontend/html/notebook/templates/login.html +++ b/IPython/frontend/html/notebook/templates/login.html @@ -17,7 +17,7 @@ {% if login_available %}
- Password: + Password:
{% end %} diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 8cb0d7b62..3a3f42fed 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -31,7 +31,7 @@ data-read-only={{read_only}}
{% if logged_in or not read_only %}
-
+ Drag files onto the list, or click here, to import notebooks. From 473a3947b09fd4fdf2a30d15fd2166b4edff2eed Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Sat, 28 Apr 2012 23:37:37 +0200 Subject: [PATCH 04/21] kernel status --- IPython/frontend/html/notebook/handlers.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 62b3b8275..133cd31e2 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -590,8 +590,19 @@ class NotebookRootHandler(AuthenticatedHandler): @authenticate_unless_readonly def get(self): nbm = self.application.notebook_manager + km = self.application.kernel_manager files = nbm.list_notebooks() - self.finish(jsonapi.dumps(files)) + #kernel_for_notebook + nlist=[] + for f in files : + nid = f['notebook_id'] + if km.kernel_for_notebook(nid) is not None: + f['kernel_status']='on' + else: + f['kernel_status']='off' + nlist.append(f) + print(files) + self.finish(jsonapi.dumps(nlist)) @web.authenticated def post(self): From 4af8cb6c9a32eb9d5b28aeb2c194ae351bd97cbe Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Sun, 29 Apr 2012 00:26:39 +0200 Subject: [PATCH 05/21] proof of concept --- IPython/frontend/html/notebook/handlers.py | 8 ++--- .../html/notebook/static/js/notebooklist.js | 36 +++++++++++++++++-- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 133cd31e2..cbec25e6a 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -338,7 +338,7 @@ class MainKernelHandler(AuthenticatedHandler): class KernelHandler(AuthenticatedHandler): - SUPPORTED_METHODS = ('DELETE') + SUPPORTED_METHODS = ('POST','DELETE') @web.authenticated def delete(self, kernel_id): @@ -347,7 +347,6 @@ class KernelHandler(AuthenticatedHandler): self.set_status(204) self.finish() - class KernelActionHandler(AuthenticatedHandler): @web.authenticated @@ -596,8 +595,9 @@ class NotebookRootHandler(AuthenticatedHandler): nlist=[] for f in files : nid = f['notebook_id'] - if km.kernel_for_notebook(nid) is not None: - f['kernel_status']='on' + kid = km.kernel_for_notebook(nid) + if kid is not None: + f['kernel_status']=kid else: f['kernel_status']='off' nlist.append(f) diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index e8f8b2c0e..a3ec6e72d 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -89,7 +89,6 @@ var IPython = (function (IPython) { NotebookList.prototype.load_list = function () { - this.clear_list(); var settings = { processData : false, cache : false, @@ -104,15 +103,21 @@ var IPython = (function (IPython) { NotebookList.prototype.list_loaded = function (data, status, xhr) { var len = data.length; + this.clear_list(); // Todo: remove old children for (var i=0; i').addClass('item_buttons'); + var that = this; + var shutdown_button = $('').button(). + click(function (e) { + var settings = { + processData : false, + cache : false, + type : "DELETE", + dataType : "json", + success : function (data, status, xhr) { + console.log('kernel killed'); + that.load_list(); + } + }; + var url = $('body').data('baseProjectUrl') + 'kernels/'+kernel; + $.ajax(url, settings); + }); + new_buttons.append(shutdown_button); + var e = item.find('.item_buttons'); + if (e.length === 0) { + item.append(new_buttons); + } else { + e.replaceWith(new_buttons); + }; + }; + NotebookList.prototype.add_delete_button = function (item) { var new_buttons = $('').addClass('item_buttons'); var delete_button = $('').button(). From a07088dde12d5bca0dd188868881860dc65414aa Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Sun, 29 Apr 2012 19:02:28 +0200 Subject: [PATCH 06/21] clean unused command --- IPython/frontend/html/notebook/handlers.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index cbec25e6a..9928b06bc 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -338,7 +338,7 @@ class MainKernelHandler(AuthenticatedHandler): class KernelHandler(AuthenticatedHandler): - SUPPORTED_METHODS = ('POST','DELETE') + SUPPORTED_METHODS = ('DELETE') @web.authenticated def delete(self, kernel_id): @@ -347,6 +347,7 @@ class KernelHandler(AuthenticatedHandler): self.set_status(204) self.finish() + class KernelActionHandler(AuthenticatedHandler): @web.authenticated @@ -591,8 +592,6 @@ class NotebookRootHandler(AuthenticatedHandler): nbm = self.application.notebook_manager km = self.application.kernel_manager files = nbm.list_notebooks() - #kernel_for_notebook - nlist=[] for f in files : nid = f['notebook_id'] kid = km.kernel_for_notebook(nid) @@ -600,9 +599,7 @@ class NotebookRootHandler(AuthenticatedHandler): f['kernel_status']=kid else: f['kernel_status']='off' - nlist.append(f) - print(files) - self.finish(jsonapi.dumps(nlist)) + self.finish(jsonapi.dumps(files)) @web.authenticated def post(self): From fc59441ddae3474cadffec1cd01df88d78efc2b6 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Sun, 29 Apr 2012 19:41:06 +0200 Subject: [PATCH 07/21] dashboard autorefresh refresh notebook list and cluster list when : - page get focus - every 60 sec when page is on focus stop refreshing every 60 sec when page loose focus --- .../static/js/projectdashboardmain.js | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js index 5957210a6..dbf9917d6 100644 --- a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js +++ b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js @@ -30,8 +30,41 @@ $(document).ready(function () { IPython.cluster_list = new IPython.ClusterList('div#cluster_list'); IPython.login_widget = new IPython.LoginWidget('span#login_widget'); - IPython.notebook_list.load_list(); - IPython.cluster_list.load_list(); + var interval_id=0; + // auto refresh every xx secondes, no need to be fast, + // update is done at least when page get focus + var time_refresh = 60; // in sec + + var enable_autorefresh = function(){ + //refresh immediately , then start interval + IPython.notebook_list.load_list(); + IPython.cluster_list.load_list(); + if (!interval_id){ + interval_id = setInterval(function(){ + IPython.notebook_list.load_list(); + IPython.cluster_list.load_list(); + }, time_refresh*1000); + } + } + + var disable_autorefresh = function(){ + clearInterval(interval_id); + interval_id = 0; + } + + // stop autorefresh when page lose focus + $(window).blur(function() { + disable_autorefresh(); + }) + + //re-enable when page get focus back + $(window).focus(function() { + enable_autorefresh(); + }); + + // finally start it, it will refresh immediately + enable_autorefresh(); + IPython.page.show(); // bound the upload method to the on change of the file select list From 34deb138c8f48bffe54adddd5f99febb9e8c1afe Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 3 May 2012 07:37:52 +0200 Subject: [PATCH 08/21] test kernel for undefined rather than off --- IPython/frontend/html/notebook/handlers.py | 2 -- IPython/frontend/html/notebook/static/js/notebooklist.js | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 9928b06bc..120ec2879 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -597,8 +597,6 @@ class NotebookRootHandler(AuthenticatedHandler): kid = km.kernel_for_notebook(nid) if kid is not None: f['kernel_status']=kid - else: - f['kernel_status']='off' self.finish(jsonapi.dumps(files)) @web.authenticated diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index a3ec6e72d..75c72df7f 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -113,7 +113,7 @@ var IPython = (function (IPython) { this.add_link(notebook_id, nbname, item); if (!IPython.read_only){ // hide delete buttons when readonly - if(kernel == 'off'){ + if(kernel == undefined){ this.add_delete_button(item); } else { this.add_shutdown_button(item,kernel); @@ -192,7 +192,6 @@ var IPython = (function (IPython) { type : "DELETE", dataType : "json", success : function (data, status, xhr) { - console.log('kernel killed'); that.load_list(); } }; From 2faee858afcb7b6e6e99b7fbff05684575749536 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 3 May 2012 07:40:35 +0200 Subject: [PATCH 09/21] rename kernel_status -> kernel_id --- IPython/frontend/html/notebook/handlers.py | 2 +- IPython/frontend/html/notebook/static/js/notebooklist.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 120ec2879..ed0fe6afc 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -596,7 +596,7 @@ class NotebookRootHandler(AuthenticatedHandler): nid = f['notebook_id'] kid = km.kernel_for_notebook(nid) if kid is not None: - f['kernel_status']=kid + f['kernel_id']=kid self.finish(jsonapi.dumps(files)) @web.authenticated diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index 75c72df7f..b7472abb3 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -108,7 +108,7 @@ var IPython = (function (IPython) { for (var i=0; i Date: Thu, 3 May 2012 07:43:00 +0200 Subject: [PATCH 10/21] space around assignement --- IPython/frontend/html/notebook/handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index ed0fe6afc..ba0bfd2ab 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -596,7 +596,7 @@ class NotebookRootHandler(AuthenticatedHandler): nid = f['notebook_id'] kid = km.kernel_for_notebook(nid) if kid is not None: - f['kernel_id']=kid + f['kernel_id'] = kid self.finish(jsonapi.dumps(files)) @web.authenticated From a6f78c90b3a5a5a9e52b0ee75e0ddf9a6bf2d62f Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 3 May 2012 19:01:59 +0200 Subject: [PATCH 11/21] Check for null rather than undefined set kernel id to None/null if not started --- IPython/frontend/html/notebook/handlers.py | 5 +---- IPython/frontend/html/notebook/static/js/notebooklist.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index ba0bfd2ab..2f23540cf 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -593,10 +593,7 @@ class NotebookRootHandler(AuthenticatedHandler): km = self.application.kernel_manager files = nbm.list_notebooks() for f in files : - nid = f['notebook_id'] - kid = km.kernel_for_notebook(nid) - if kid is not None: - f['kernel_id'] = kid + f['kernel_id'] = km.kernel_for_notebook(f['notebook_id']) self.finish(jsonapi.dumps(files)) @web.authenticated diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index b7472abb3..8e861b3f6 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -113,7 +113,7 @@ var IPython = (function (IPython) { this.add_link(notebook_id, nbname, item); if (!IPython.read_only){ // hide delete buttons when readonly - if(kernel == undefined){ + if(kernel == null){ this.add_delete_button(item); } else { this.add_shutdown_button(item,kernel); From 13cf61912ba6a54d05fbef1f15ef876a7aa58302 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Sun, 6 May 2012 13:42:35 +0200 Subject: [PATCH 12/21] prevent autorefresh when pending upload don't clear list if 'upload' button are present to avoid clearing the list and the upload form --- .../html/notebook/static/js/notebooklist.js | 1 + .../notebook/static/js/projectdashboardmain.js | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index 8e861b3f6..9c8e475f7 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -260,6 +260,7 @@ var IPython = (function (IPython) { var that = this; var new_buttons = $('').addClass('item_buttons'); var upload_button = $('').button(). + addClass('upload-button'). click(function (e) { var nbname = item.find('.item_name > input').attr('value'); var nbformat = item.data('nbformat'); diff --git a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js index dbf9917d6..50c4f9d61 100644 --- a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js +++ b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js @@ -37,12 +37,18 @@ $(document).ready(function () { var enable_autorefresh = function(){ //refresh immediately , then start interval - IPython.notebook_list.load_list(); - IPython.cluster_list.load_list(); + if($('upload_button').length == 0) + { + IPython.notebook_list.load_list(); + IPython.cluster_list.load_list(); + } if (!interval_id){ interval_id = setInterval(function(){ - IPython.notebook_list.load_list(); - IPython.cluster_list.load_list(); + if($('upload_button').length == 0) + { + IPython.notebook_list.load_list(); + IPython.cluster_list.load_list(); + } }, time_refresh*1000); } } @@ -65,6 +71,9 @@ $(document).ready(function () { // finally start it, it will refresh immediately enable_autorefresh(); + IPython.enable_autorefresh = enable_autorefresh; + IPython.disable_autorefresh = disable_autorefresh; + IPython.page.show(); // bound the upload method to the on change of the file select list From d549731d32a24890ef3f16170b05677b09268f59 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Sun, 6 May 2012 14:41:29 +0200 Subject: [PATCH 13/21] add 'Close and halt' in notebook filemenu --- IPython/frontend/html/notebook/static/js/menubar.js | 4 ++++ IPython/frontend/html/notebook/templates/notebook.html | 2 ++ 2 files changed, 6 insertions(+) diff --git a/IPython/frontend/html/notebook/static/js/menubar.js b/IPython/frontend/html/notebook/static/js/menubar.js index e7da9208f..a809cfd15 100644 --- a/IPython/frontend/html/notebook/static/js/menubar.js +++ b/IPython/frontend/html/notebook/static/js/menubar.js @@ -68,6 +68,10 @@ var IPython = (function (IPython) { this.element.find('button#print_notebook').click(function () { IPython.print_widget.print_notebook(); }); + this.element.find('#kill_and_exit').click(function () { + IPython.notebook.kernel.kill(); + setTimeout(function(){window.close();}, 200); + }); // Edit this.element.find('#cut_cell').click(function () { IPython.notebook.cut_cell(); diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index 7a6e3e9ed..89d2ab704 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -65,6 +65,8 @@ data-notebook-id={{notebook_id}}
+
+
  • Close and halt
  • Edit From ee857f1bd92e3f29cc6983b0394cae82e97368df Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 10 May 2012 20:20:05 +0200 Subject: [PATCH 14/21] remove extra console.log --- IPython/frontend/html/notebook/static/js/notebooklist.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index 9c8e475f7..69a8c66f2 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -44,8 +44,7 @@ var IPython = (function (IPython) { return false; }); this.element.bind('drop', function(event){ - console.log('bound to drop'); - that.handelFilesUpload(event,'drop'); + that.handelFilesUpload(event,'drop'); return false; }); }; From 0ada7dd84779cad8ce717e6be0a2b1cb72b4ceee Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 10 May 2012 20:22:09 +0200 Subject: [PATCH 15/21] bold click here in dashboard --- IPython/frontend/html/notebook/templates/projectdashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 3a3f42fed..130a9f756 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -33,7 +33,7 @@ data-read-only={{read_only}}
    Drag files - onto the list, or click here, to import + onto the list, or click here, to import notebooks. From 231e8f93f2c1b5939e57b48da580694936fcc982 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 10 May 2012 20:23:40 +0200 Subject: [PATCH 16/21] remove underscore in filename --- .../css/{alternate_uploadform.css => alternateuploadform.css} | 0 IPython/frontend/html/notebook/templates/projectdashboard.html | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename IPython/frontend/html/notebook/static/css/{alternate_uploadform.css => alternateuploadform.css} (100%) diff --git a/IPython/frontend/html/notebook/static/css/alternate_uploadform.css b/IPython/frontend/html/notebook/static/css/alternateuploadform.css similarity index 100% rename from IPython/frontend/html/notebook/static/css/alternate_uploadform.css rename to IPython/frontend/html/notebook/static/css/alternateuploadform.css diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 130a9f756..9b74d5c52 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -4,7 +4,7 @@ {% block stylesheet %} - + {% end %} From 40bdd81f5c3e0c39b27e052042f5b084222a28cf Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Fri, 11 May 2012 08:53:03 +0200 Subject: [PATCH 17/21] replace b by strong for semantic, more change in boilerplate --- IPython/frontend/html/notebook/templates/projectdashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index 9b74d5c52..da9def425 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -33,7 +33,7 @@ data-read-only={{read_only}}
    Drag files - onto the list, or click here, to import + onto the list, or click here, to import notebooks.
    From 1eae6f060a6db4558bc28bc76b1bbad6782d4828 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Fri, 11 May 2012 15:39:29 +0200 Subject: [PATCH 18/21] do not expose enable/disable autorefresh --- .../frontend/html/notebook/static/js/projectdashboardmain.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js index 50c4f9d61..da2bf6ff7 100644 --- a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js +++ b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js @@ -71,14 +71,12 @@ $(document).ready(function () { // finally start it, it will refresh immediately enable_autorefresh(); - IPython.enable_autorefresh = enable_autorefresh; - IPython.disable_autorefresh = disable_autorefresh; - IPython.page.show(); // bound the upload method to the on change of the file select list $("#alternate_upload").change(function (event){ IPython.notebook_list.handelFilesUpload(event,'form'); }); + }); From b2291b14dca3ee4def434c39116afbfd2781b03f Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Tue, 15 May 2012 21:37:08 +0200 Subject: [PATCH 19/21] Drag target bigger for empty notebook dashboard When no notebooks, show "Notebook list empty", which increase the size of the drag target. fixes #1492 --- .../frontend/html/notebook/static/js/notebooklist.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index 69a8c66f2..436325c7b 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -103,7 +103,16 @@ var IPython = (function (IPython) { NotebookList.prototype.list_loaded = function (data, status, xhr) { var len = data.length; this.clear_list(); - // Todo: remove old children + + if(len == 0) + { + $(this.new_notebook_item(0)) + .append( + $('
    ') + .text('Notebook list empty.') + ) + } + for (var i=0; i Date: Tue, 15 May 2012 21:56:17 +0200 Subject: [PATCH 20/21] fix upload button selection by class superseed #1676 #1658 (and correct bug in 1676 where one con't upload notebook because of refresh) --- .../frontend/html/notebook/static/js/projectdashboardmain.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js index da2bf6ff7..b593302ed 100644 --- a/IPython/frontend/html/notebook/static/js/projectdashboardmain.js +++ b/IPython/frontend/html/notebook/static/js/projectdashboardmain.js @@ -37,14 +37,14 @@ $(document).ready(function () { var enable_autorefresh = function(){ //refresh immediately , then start interval - if($('upload_button').length == 0) + if($('.upload_button').length == 0) { IPython.notebook_list.load_list(); IPython.cluster_list.load_list(); } if (!interval_id){ interval_id = setInterval(function(){ - if($('upload_button').length == 0) + if($('.upload_button').length == 0) { IPython.notebook_list.load_list(); IPython.cluster_list.load_list(); From 981738f9e3b5b13d21aaa92a0037cca07c05c9c7 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 31 May 2012 08:33:52 +0200 Subject: [PATCH 21/21] change upload sentense --- .../html/notebook/static/css/alternateuploadform.css | 2 +- .../frontend/html/notebook/templates/projectdashboard.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IPython/frontend/html/notebook/static/css/alternateuploadform.css b/IPython/frontend/html/notebook/static/css/alternateuploadform.css index 1e5f8a47a..72dbb870a 100644 --- a/IPython/frontend/html/notebook/static/css/alternateuploadform.css +++ b/IPython/frontend/html/notebook/static/css/alternateuploadform.css @@ -19,5 +19,5 @@ position:relative; opacity: 0; z-index: 2; - width: 356px; + width: 447px; } diff --git a/IPython/frontend/html/notebook/templates/projectdashboard.html b/IPython/frontend/html/notebook/templates/projectdashboard.html index da9def425..9d91be3ea 100644 --- a/IPython/frontend/html/notebook/templates/projectdashboard.html +++ b/IPython/frontend/html/notebook/templates/projectdashboard.html @@ -32,9 +32,9 @@ data-read-only={{read_only}} {% if logged_in or not read_only %}
    - Drag files - onto the list, or click here, to import - notebooks. + + To import a notebook, drag the file onto the listing below or click here. +