From 8bf4ffa2ca095ae4ddbd8cd1e05f48170374bde7 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Sun, 9 Mar 2014 14:15:47 -0700 Subject: [PATCH] rebuild.QuickHelp event sets the dirty bit QuickHelp is rebuilt on show if the dirty bit was set. --- IPython/html/static/base/js/keyboard.js | 4 ++-- IPython/html/static/notebook/js/quickhelp.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/base/js/keyboard.js b/IPython/html/static/base/js/keyboard.js index 952c384c1..7a8a80f26 100644 --- a/IPython/html/static/base/js/keyboard.js +++ b/IPython/html/static/base/js/keyboard.js @@ -189,7 +189,7 @@ IPython.keyboard = (function (IPython) { this._shortcuts[shortcut] = data; if (!suppress_help_update) { // update the keyboard shortcuts notebook help - IPython.quick_help = new IPython.QuickHelp(); + $([IPython.events]).trigger('rebuild.QuickHelp') } } @@ -209,7 +209,7 @@ IPython.keyboard = (function (IPython) { IPython.quick_help = new IPython.QuickHelp(); if (!suppress_help_update) { // update the keyboard shortcuts notebook help - IPython.quick_help = new IPython.QuickHelp(); + $([IPython.events]).trigger('rebuild.QuickHelp'); } } diff --git a/IPython/html/static/notebook/js/quickhelp.js b/IPython/html/static/notebook/js/quickhelp.js index 29cb3def6..907e2d0d0 100644 --- a/IPython/html/static/notebook/js/quickhelp.js +++ b/IPython/html/static/notebook/js/quickhelp.js @@ -18,6 +18,10 @@ var IPython = (function (IPython) { QuickHelp.prototype.show_keyboard_shortcuts = function () { // toggles display of keyboard shortcut dialog var that = this; + if ( this.force_rebuild ) { + delete(this.shortcut_dialog); + this.force_rebuild = false; + } if ( this.shortcut_dialog ){ // if dialog is already shown, close it $(this.shortcut_dialog).modal("toggle"); @@ -57,6 +61,8 @@ var IPython = (function (IPython) { Close : {} } }); + + $([IPython.events]).on('rebuild.QuickHelp', function() { that.force_rebuild = true;}); }; QuickHelp.prototype.build_command_help = function () {