From c0fadb245d0d6426bcb2ab111265d4db639cb3dc Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Fri, 10 Jan 2014 09:32:16 -0800 Subject: [PATCH] Fixing design of quickhelp. --- .../static/notebook/js/keyboardmanager.js | 1 - IPython/html/static/notebook/js/quickhelp.js | 44 ++++++++++++++----- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index ef33e6697..5ac27dfb3 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -510,7 +510,6 @@ var IPython = (function (IPython) { return -1; return 0; }); - console.log(help); return help; } diff --git a/IPython/html/static/notebook/js/quickhelp.js b/IPython/html/static/notebook/js/quickhelp.js index 823fb1914..923b24076 100644 --- a/IPython/html/static/notebook/js/quickhelp.js +++ b/IPython/html/static/notebook/js/quickhelp.js @@ -41,6 +41,29 @@ var IPython = (function (IPython) { ) element.append(doc); + // Command mode + var cmd_div = this.build_command_help(); + element.append(cmd_div); + + // Edit mode + var edit_div = this.build_edit_help(); + element.append(edit_div); + + this.shortcut_dialog = IPython.dialog.modal({ + title : "Keyboard shortcuts", + body : element, + destroy : false, + buttons : { + Close : {} + } + }); + }; + + QuickHelp.prototype.build_command_help = function () { + var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help(); + var help, shortcut; + var i, half, n; + // Command mode var cmd_div = $('
').append($('

Command Mode (press ESC to enable)

')); var cmd_sub_div = $('
').addClass('hbox'); @@ -66,7 +89,13 @@ var IPython = (function (IPython) { }; cmd_sub_div.append(cmd_col1).append(cmd_col2); cmd_div.append(cmd_sub_div); - element.append(cmd_div); + return cmd_div; + } + + QuickHelp.prototype.build_edit_help = function () { + var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); + var help, shortcut; + var i, half, n; // Edit mode var edit_div = $('
').append($('

Edit Mode (press ENTER to enable)

')); @@ -93,17 +122,8 @@ var IPython = (function (IPython) { }; edit_sub_div.append(edit_col1).append(edit_col2); edit_div.append(edit_sub_div); - element.append(edit_div); - - this.shortcut_dialog = IPython.dialog.modal({ - title : "Keyboard shortcuts", - body : element, - destroy : false, - buttons : { - Close : {} - } - }); - }; + return edit_div; + } // Set module variables IPython.QuickHelp = QuickHelp;