diff --git a/IPython/frontend/html/notebook/static/css/notebook.css b/IPython/frontend/html/notebook/static/css/notebook.css index 31ce62b9d..ec058d645 100644 --- a/IPython/frontend/html/notebook/static/css/notebook.css +++ b/IPython/frontend/html/notebook/static/css/notebook.css @@ -60,6 +60,10 @@ span#kernel_status { padding: 0px; } +.wijmo-wijmenu .wijmo-wijmenu-parent .wijmo-wijmenu-child { + width: 225px; +} + #kernel_persist { float: right; } @@ -347,7 +351,7 @@ p.dialog { .shortcut_key { display: inline-block; - width: 13ex; + width: 15ex; text-align: right; font-family: monospace; } diff --git a/IPython/frontend/html/notebook/static/js/menubar.js b/IPython/frontend/html/notebook/static/js/menubar.js index fffe310ec..037227678 100644 --- a/IPython/frontend/html/notebook/static/js/menubar.js +++ b/IPython/frontend/html/notebook/static/js/menubar.js @@ -26,6 +26,21 @@ var IPython = (function (IPython) { $('ul#menus').wijmenu("option", "showDelay", 200); $('ul#menus').wijmenu("option", "hideDelay", 200); $(".selector").wijmenu("option", "animation", {animated:"fade", duration: 200, easing: null}) + // Close all menus when a menu item is clicked. This is needed when + // menu shortcuts are used as they have a slightly different structure + // in the DOM. + $(".wijmo-wijmenu-text").parent().bind("click", function () { + $('ul#menus').wijmenu("hideAllMenus"); + console.log('I am closing you!'); + }); + // Make sure we hover over menu items correctly. This is needed when + // menu shortcuts are used as they have a slightly different structure + // in the DOM. + $(".wijmo-wijmenu-link").hover(function () { + $(this).addClass("ui-state-hover"); + }, function () { + $(this).removeClass("ui-state-hover"); + }); }; @@ -65,6 +80,12 @@ var IPython = (function (IPython) { this.element.find('#move_cell_down').click(function () { IPython.notebook.move_cell_down(); }); + this.element.find('#select_previous').click(function () { + IPython.notebook.select_prev(); + }); + this.element.find('#select_next').click(function () { + IPython.notebook.select_next(); + }); // Insert this.element.find('#insert_cell_above').click(function () { IPython.notebook.insert_code_cell_above(); @@ -101,6 +122,10 @@ var IPython = (function (IPython) { this.element.find('#restart_kernel').click(function () { IPython.notebook.restart_kernel(); }); + // Help + this.element.find('#keyboard_shortcuts').click(function () { + IPython.quick_help.show_keyboard_shortcuts(); + }); }; diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 67607e551..515091bd7 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -213,50 +213,6 @@ var IPython = (function (IPython) { }; - Notebook.prototype.toggle_keyboard_shortcuts = function () { - // toggles display of keyboard shortcut dialog - var that = this; - if ( this.shortcut_dialog ){ - // if dialog is already shown, close it - this.shortcut_dialog.dialog("close"); - this.shortcut_dialog = null; - return; - } - var dialog = $('
'); - this.shortcut_dialog = dialog; - var shortcuts = [ - {key: 'Shift-Enter', help: 'run cell'}, - {key: 'Ctrl-Enter', help: 'run cell in-place'}, - {key: 'Ctrl-m d', help: 'delete cell'}, - {key: 'Ctrl-m a', help: 'insert cell above'}, - {key: 'Ctrl-m b', help: 'insert cell below'}, - {key: 'Ctrl-m t', help: 'toggle output'}, - {key: 'Ctrl-m l', help: 'toggle line numbers'}, - {key: 'Ctrl-m s', help: 'save notebook'}, - {key: 'Ctrl-m j', help: 'move cell down'}, - {key: 'Ctrl-m k', help: 'move cell up'}, - {key: 'Ctrl-m c', help: 'code cell'}, - {key: 'Ctrl-m m', help: 'markdown cell'}, - {key: 'Ctrl-m p', help: 'select previous'}, - {key: 'Ctrl-m n', help: 'select next'}, - {key: 'Ctrl-m i', help: 'interrupt kernel'}, - {key: 'Ctrl-m .', help: 'restart kernel'}, - {key: 'Ctrl-m h', help: 'show keyboard shortcuts'} - ]; - for (var i=0; i