From ca6806241344db624d41fd453073439804261f8f Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 15 Mar 2012 21:17:34 +0100 Subject: [PATCH] call tooltip after time --- IPython/frontend/html/notebook/static/js/codecell.js | 4 +--- IPython/frontend/html/notebook/static/js/tooltip.js | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js index 50241d917..147c16ca1 100644 --- a/IPython/frontend/html/notebook/static/js/codecell.js +++ b/IPython/frontend/html/notebook/static/js/codecell.js @@ -60,9 +60,7 @@ var IPython = (function (IPython) { // don't do anything if line beggin with '(' or is empty } else { // Will set a timer to request tooltip in `time` - that.tooltip_timeout = setTimeout(function(){ - IPython.tooltip.request(that, pre_cursor) - },time); + IPython.tooltip.pending(that, pre_cursor) } }; diff --git a/IPython/frontend/html/notebook/static/js/tooltip.js b/IPython/frontend/html/notebook/static/js/tooltip.js index de8853153..7b90b92ec 100644 --- a/IPython/frontend/html/notebook/static/js/tooltip.js +++ b/IPython/frontend/html/notebook/static/js/tooltip.js @@ -118,13 +118,18 @@ var IPython = (function (IPython) { // note that we don't handle closing directly inside the calltip // as in the completer, because it is not focusable, so won't // get the event. - this.hide(); + this.hide(); if (this.tooltip_timeout != null){ clearTimeout(this.tooltip_timeout); this.tooltip_timeout = null; } } - + + Tooltip.prototype.pending = function(cell,text) + { + var that = this; + this.timeout = setTimeout(function(){that.request(cell, text)} , IPython.notebook.time_before_tooltip); + } Tooltip.prototype.request = function(cell,text) { IPython.notebook.request_tool_tip(cell, text);