From accaced7072f47c205e95a3c9421928d349be39c 2011-10-19 00:43:29 From: MinRK Date: 2011-10-19 00:43:29 Subject: [PATCH] Add tooltips to the notebook via 'title' attr. All buttons, show/hide clickable areas, etc. should have some tooltip describing what they do. There are jQuery plugins for enhanced tooltips, but this gets the lightest version working. closes #436 --- diff --git a/IPython/frontend/html/notebook/static/js/kernelstatus.js b/IPython/frontend/html/notebook/static/js/kernelstatus.js index 73ae943..def9db2 100644 --- a/IPython/frontend/html/notebook/static/js/kernelstatus.js +++ b/IPython/frontend/html/notebook/static/js/kernelstatus.js @@ -24,6 +24,9 @@ var IPython = (function (IPython) { KernelStatusWidget.prototype.style = function () { this.element.addClass('ui-widget'); + this.element.attr('title', "The kernel execution status." + + " If 'Busy', the kernel is currently running code." + + " If 'Idle', it is available for execution.") }; diff --git a/IPython/frontend/html/notebook/static/js/leftpanel.js b/IPython/frontend/html/notebook/static/js/leftpanel.js index cc18831..4a41294 100644 --- a/IPython/frontend/html/notebook/static/js/leftpanel.js +++ b/IPython/frontend/html/notebook/static/js/leftpanel.js @@ -30,6 +30,7 @@ var IPython = (function (IPython) { this.left_panel_element.addClass('border-box-sizing ui-widget'); this.left_panel_element.width(this.width); this.left_panel_splitter_element.css({left : this.width}); + this.left_panel_splitter_element.attr('title', 'Click to Show/Hide left panel'); }; diff --git a/IPython/frontend/html/notebook/static/js/pager.js b/IPython/frontend/html/notebook/static/js/pager.js index d1ea86f..76ef7f0 100644 --- a/IPython/frontend/html/notebook/static/js/pager.js +++ b/IPython/frontend/html/notebook/static/js/pager.js @@ -26,6 +26,7 @@ var IPython = (function (IPython) { Pager.prototype.style = function () { this.pager_splitter_element.addClass('border-box-sizing ui-widget ui-state-default'); this.pager_element.addClass('border-box-sizing ui-widget'); + this.pager_splitter_element.attr('title', 'Click to Show/Hide pager area'); }; diff --git a/IPython/frontend/html/notebook/static/js/panelsection.js b/IPython/frontend/html/notebook/static/js/panelsection.js index 9213775..ea84567 100644 --- a/IPython/frontend/html/notebook/static/js/panelsection.js +++ b/IPython/frontend/html/notebook/static/js/panelsection.js @@ -30,6 +30,7 @@ var IPython = (function (IPython) { PanelSection.prototype.style = function () { this.header.addClass('ui-widget ui-state-default'); + this.header.attr('title', "Click to Show/Hide Section"); this.content.addClass('ui-widget section_content'); }; @@ -88,7 +89,13 @@ var IPython = (function (IPython) { this.content.addClass('ui-helper-clearfix'); this.content.find('div.section_row').addClass('ui-helper-clearfix'); this.content.find('#new_open').buttonset(); + this.content.find('#new_notebook').attr('title', "Create a new notebook"); + this.content.find('#open_notebook').attr('title', "Open an existing notebook"); this.content.find('#download_notebook').button(); + this.content.find('#download_notebook').attr('title', + "Download the notebook in the specified format," + + " either full ipynb notebook or as a Python script."); + // upload notebook doesn't exist: this.content.find('#upload_notebook').button(); this.content.find('#download_format').addClass('ui-widget ui-widget-content'); this.content.find('#download_format option').addClass('ui-widget ui-widget-content'); @@ -127,11 +134,29 @@ var IPython = (function (IPython) { this.content.addClass('ui-helper-clearfix'); this.content.find('div.section_row').addClass('ui-helper-clearfix'); this.content.find('#delete_cell').button(); + this.content.find('#delete_cell').attr('title', "Delete the selected cell"); + this.content.find('#insert').buttonset(); + this.content.find('#insert_cell_above').attr('title', "Insert new cell above selected"); + this.content.find('#insert_cell_below').attr('title', "Insert new cell below selected"); + this.content.find('#move').buttonset(); + this.content.find('#move_cell_up').attr('title', "Move selected cell up one in the Notebook"); + this.content.find('#move_cell_down').attr('title', "Move selected cell down one in the Notebook"); + this.content.find('#cell_type').buttonset(); + this.content.find('#to_markdown').attr('title', 'Change selected cell to markdown (for text)') + this.content.find('#to_code').attr('title', 'Change selected cell to code (for execution)') + this.content.find('#cell_output').buttonset(); + this.content.find('#toggle_output').attr('title', 'Toggle visibility of the output of code cells') + this.content.find('#clear_all_output').attr('title', 'Clear output of all code cells (actually removes the data, unlike toggle)') + this.content.find('#run_cells').buttonset(); + this.content.find('#run_selected_cell').attr('title', 'Submit the selected cell for execution') + this.content.find('#run_all_cells').attr('title', 'Run *all* code cells in the notebook in order') + this.content.find('#autoindent').attr('title', 'Autoindent code as-you-type') + this.content.find('#autoindent_label').attr('title', 'Autoindent code as-you-type') }; @@ -192,6 +217,16 @@ var IPython = (function (IPython) { this.content.addClass('ui-helper-clearfix'); this.content.find('div.section_row').addClass('ui-helper-clearfix'); this.content.find('#int_restart').buttonset(); + this.content.find("#int_kernel").attr('title', "Interrupt the kernel with SIGINT/Ctrl-C"); + this.content.find("#restart_kernel").attr('title', + "Restart the kernel. This will shutdown the current kernel," + + " and start a new, clean kernel in its place, connected to this Notebook." + + " This may break the connection of other clients connected to this kernel." ); + var kill_tip = "Kill the kernel on exit. If unchecked, the kernel will remain" + + " active after closing the session, allowing you to reconnect and resume later."; + this.content.find('#kill_kernel').attr('title', kill_tip); + this.content.find('#kill_kernel_label').attr('title', kill_tip); + }; @@ -224,6 +259,12 @@ var IPython = (function (IPython) { this.content.find('#help_buttons0').buttonset(); this.content.find('#help_buttons1').buttonset(); this.content.find('#help_buttons2').buttonset(); + this.content.find('#python_help').attr('title', "Open the online Python documentation in a new tab") + this.content.find('#ipython_help').attr('title', "Open the online IPython documentation in a new tab") + this.content.find('#numpy_help').attr('title', "Open the online NumPy documentation in a new tab") + this.content.find('#scipy_help').attr('title', "Open the online SciPy documentation in a new tab") + this.content.find('#matplotlib_help').attr('title', "Open the online Matplotlib documentation in a new tab") + this.content.find('#sympy_help').attr('title', "Open the online SymPy documentation in a new tab") }; diff --git a/IPython/frontend/html/notebook/static/js/printwidget.js b/IPython/frontend/html/notebook/static/js/printwidget.js index 896740a..cae0c61 100644 --- a/IPython/frontend/html/notebook/static/js/printwidget.js +++ b/IPython/frontend/html/notebook/static/js/printwidget.js @@ -11,6 +11,10 @@ var IPython = (function (IPython) { PrintWidget.prototype.style = function () { this.element.find('button#print_notebook').button(); + this.element.find('button#print_notebook').attr('title', + "Open a new window with printer-friendly HTML of the Notebook." + + " Note that this is incomplete, and may not produce perfect" + + " printed output."); }; PrintWidget.prototype.bind_events = function () { diff --git a/IPython/frontend/html/notebook/static/js/quickhelp.js b/IPython/frontend/html/notebook/static/js/quickhelp.js index 0831819..4931fd0 100644 --- a/IPython/frontend/html/notebook/static/js/quickhelp.js +++ b/IPython/frontend/html/notebook/static/js/quickhelp.js @@ -22,6 +22,7 @@ var IPython = (function (IPython) { QuickHelp.prototype.style = function () { this.element.find('button#quick_help').button(); + this.element.find('button#quick_help').attr('title', "Show/Hide the keyboard shortcuts for the IPython Notebook"); }; QuickHelp.prototype.bind_events = function () { diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 8aafca8..18a16cd 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -29,6 +29,7 @@ var IPython = (function (IPython) { this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); this.element.find('input#notebook_name').attr('tabindex','1'); this.element.find('button#save_notebook').button(); + this.element.find('button#save_notebook').attr('title', 'Save the Notebook'); var left_panel_width = $('div#left_panel').outerWidth(); var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index b77c1df..6f16348 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -169,7 +169,7 @@ - Autoindent: + Autoindent: @@ -188,7 +188,7 @@ - Kill kernel upon exit: + Kill kernel upon exit: