From a5bcda20c9a01ae83797624501d8ac70c824efd7 2012-05-31 20:08:26 From: Matthias BUSSONNIER Date: 2012-05-31 20:08:26 Subject: [PATCH] Notification + tooltip demo Use notification to quicky remind use of the tooltip Use javascript in notebook to make a live demo in 01_notebook_introduction tooltip docstring is remplaceid for the first use by a live tutorial --- diff --git a/IPython/frontend/html/notebook/static/js/tooltip.js b/IPython/frontend/html/notebook/static/js/tooltip.js index bb28532..20f49dc 100644 --- a/IPython/frontend/html/notebook/static/js/tooltip.js +++ b/IPython/frontend/html/notebook/static/js/tooltip.js @@ -123,9 +123,18 @@ var IPython = (function (IPython) { this.tooltip.append(this.text); // function that will be called if you press tab 1, 2, 3... times in a row - this.tabs_functions = [ function(cell,text){that._request_tooltip(cell,text)}, - function(){that.expand()}, - function(){that.stick()}, + this.tabs_functions = [ function(cell,text){ + that._request_tooltip(cell,text); + IPython.notification_widget.set_message('tab again to expand pager',2500); + }, + function(){ + that.expand(); + IPython.notification_widget.set_message('tab again to make pager sticky for 10s',2500); + }, + function(){ + that.stick(); + IPython.notification_widget.set_message('tab again to open help in pager',2500); + }, function(cell){ that.cancel_stick(); that.showInPager(cell); diff --git a/docs/examples/notebooks/01_notebook_introduction.ipynb b/docs/examples/notebooks/01_notebook_introduction.ipynb index d0d4d3d..4d6425a 100644 --- a/docs/examples/notebooks/01_notebook_introduction.ipynb +++ b/docs/examples/notebooks/01_notebook_introduction.ipynb @@ -35,7 +35,6 @@ }, { "cell_type": "code", - "collapsed": false, "input": [ "\"This is the new IPython notebook\"" ], @@ -66,7 +65,6 @@ }, { "cell_type": "code", - "collapsed": false, "input": [ "ls" ], @@ -93,7 +91,6 @@ }, { "cell_type": "code", - "collapsed": false, "input": [ "def f(x):", " \"\"\"My function", @@ -180,10 +177,7 @@ "closely related to IPython as well as the minimal keybindings you need to", "know. But you should use `Ctrl-m h` (or click the `QuickHelp` button at", "the top) and learn some of the other keybindings, as it will make your ", - "workflow much more fluid and efficient.", - "", - "The *Configuration* section at the bottom lets you change some values", - "related to the display of tooltips and the behavior of the tab completer." + "workflow much more fluid and efficient." ] }, { @@ -231,10 +225,9 @@ }, { "cell_type": "code", - "collapsed": true, "input": [ "# Position your cursor after the ( and hit the Tab key:", - "list(" + "range(" ], "language": "python", "outputs": [] @@ -242,6 +235,77 @@ { "cell_type": "markdown", "source": [ + "More over pressing tab several time in a row allows you change the behaviour of the tooltip.", + "", + "* firt `tab` press, you get a classical tooltip", + "* second time, the tooltip grow vertically, and allow you to scroll the docstring", + "* third tab press, tooltip, will be made sticky for 10 seconds, allowing you to carry on typing while it stays open.", + "* forth time press, the tooltip help is sent to the pager at the bottom of the screen , and is dismiss.", + "" + ] + }, + { + "cell_type": "markdown", + "source": [ "## The frontend/kernel model", "", "The IPython notebook works on a client/server model where an *IPython kernel*", @@ -265,7 +329,6 @@ }, { "cell_type": "code", - "collapsed": false, "input": [ "%connect_info" ], @@ -347,7 +410,6 @@ }, { "cell_type": "code", - "collapsed": false, "input": [ "%pylab inline", "plot(rand(100))" @@ -408,8 +470,9 @@ }, { "cell_type": "code", - "collapsed": true, - "input": [], + "input": [ + "" + ], "language": "python", "outputs": [] }