call tooltip after time

This commit is contained in:
Matthias BUSSONNIER 2012-03-15 21:17:34 +01:00 committed by Brian Granger
parent 0bfa18dd46
commit ca68062413
2 changed files with 8 additions and 5 deletions

View File

@ -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)
}
};

View File

@ -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);