From 045973b6bbbd1fd408797e58d8924bf512c0f47e Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Sun, 23 Sep 2012 13:01:44 +0200 Subject: [PATCH 1/4] add insert_cell_at_bottom prototype --- IPython/frontend/html/notebook/static/js/notebook.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 346b6d3de..db7cae52f 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -550,6 +550,11 @@ var IPython = (function (IPython) { }; + Notebook.prototype.insert_cell_at_bottom = function (type){ + var len = this.ncells(); + return this.insert_cell_below(type,len-1); + } + Notebook.prototype.insert_cell_below = function (type, index) { // type = ('code','html','markdown') // index = cell index or undefined to insert below selected From a03764ed6757d0635ced35e26cc98b305f0e21e5 Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Sun, 23 Sep 2012 14:15:13 +0200 Subject: [PATCH 2/4] add ability to create continuation prompt --- .../html/notebook/static/js/codecell.js | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js index d2ed5a417..c542221d7 100644 --- a/IPython/frontend/html/notebook/static/js/codecell.js +++ b/IPython/frontend/html/notebook/static/js/codecell.js @@ -41,6 +41,7 @@ var IPython = (function (IPython) { mode: 'python', theme: 'ipython', readOnly: this.read_only, + onUpdate: $.proxy(function(){this.set_input_prompt()},this), extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess",'Backspace':"delSpaceToPrevTabStop"}, onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) }); @@ -210,10 +211,33 @@ var IPython = (function (IPython) { }; + + + + CodeCell.input_prompt_classical = function (prompt_value, lines_number) { + var ns = prompt_value || " "; + return 'In [' + ns + ']:' + }; + + CodeCell.input_prompt_continuation = function (prompt_value, lines_number) { + var html = [CodeCell.input_prompt_classical(prompt_value, lines_number)]; + for(var i=1; i < lines_number; i++){html.push(['...:'])}; + return html.join('
') + }; + + CodeCell.input_prompt_function = CodeCell.input_prompt_classical; + + CodeCell.prototype.set_input_prompt = function (number) { - this.input_prompt_number = number; - var ns = number || " "; - this.element.find('div.input_prompt').html('In [' + ns + ']:'); + var nline = 1 + if( this.code_mirror != undefined) { + nline = this.code_mirror.lineCount(); + } + if (number){ + this.input_prompt_number = number; + } + var prompt_html = CodeCell.input_prompt_function(this.input_prompt_number, nline); + this.element.find('div.input_prompt').html(prompt_html); }; From 01cdf460cc64ecfb3e2592dd99b082363f43277c Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Sun, 23 Sep 2012 14:21:06 +0200 Subject: [PATCH 3/4] align output with input --- IPython/frontend/html/notebook/static/css/notebook.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/css/notebook.css b/IPython/frontend/html/notebook/static/css/notebook.css index 27f72ce83..fc8cccb7d 100644 --- a/IPython/frontend/html/notebook/static/css/notebook.css +++ b/IPython/frontend/html/notebook/static/css/notebook.css @@ -238,7 +238,7 @@ div.output_area { /* This class is for the output subarea inside the output_area and after the prompt div. */ div.output_subarea { - padding: 0.4em 0.4em 0.4em 0.4em; + padding: 0.44em 0.4em 0.4em 1px; } /* The rest of the output_* classes are for special styling of the different From 20fec7b2d053eab1fdaa61bd290ac3dfc6fcec0e Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Wed, 3 Oct 2012 17:20:19 +0200 Subject: [PATCH 4/4] remove rogue codemirror onUpdate --- IPython/frontend/html/notebook/static/js/codecell.js | 1 - 1 file changed, 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js index c542221d7..ffbfb1a5e 100644 --- a/IPython/frontend/html/notebook/static/js/codecell.js +++ b/IPython/frontend/html/notebook/static/js/codecell.js @@ -41,7 +41,6 @@ var IPython = (function (IPython) { mode: 'python', theme: 'ipython', readOnly: this.read_only, - onUpdate: $.proxy(function(){this.set_input_prompt()},this), extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess",'Backspace':"delSpaceToPrevTabStop"}, onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this) });