From 0376908da90e99a4c54fdf32bba773fa731c9b10 2011-07-21 03:42:35 From: Brian E. Granger Date: 2011-07-21 03:42:35 Subject: [PATCH] Help section implemented and working. --- diff --git a/IPython/frontend/html/notebook/static/js/leftpanel.js b/IPython/frontend/html/notebook/static/js/leftpanel.js index 07bdbd7..ac68852 100644 --- a/IPython/frontend/html/notebook/static/js/leftpanel.js +++ b/IPython/frontend/html/notebook/static/js/leftpanel.js @@ -63,6 +63,9 @@ var IPython = (function (IPython) { this.left_panel_element.append(this.cell_section.element); this.kernel_section = new IPython.KernelSection(); this.left_panel_element.append(this.kernel_section.element); + this.help_section = new IPython.HelpSection(); + this.left_panel_element.append(this.help_section.element); + this.help_section.collapse(); } LeftPanel.prototype.collapse = function () { diff --git a/IPython/frontend/html/notebook/static/js/notebook_main.js b/IPython/frontend/html/notebook/static/js/notebook_main.js index 66dc899..3c34879 100644 --- a/IPython/frontend/html/notebook/static/js/notebook_main.js +++ b/IPython/frontend/html/notebook/static/js/notebook_main.js @@ -28,31 +28,5 @@ $(document).ready(function () { IPython.notebook.insert_code_cell_after(); IPython.layout_manager.do_resize(); IPython.pager.collapse(); - -// $("#menu_tabs").tabs(); - -// $("#help_toolbar").buttonset(); - -// $("#kernel_toolbar").buttonset(); -// $("#interrupt_kernel").click(function () {IPython.notebook.kernel.interrupt();}); -// $("#restart_kernel").click(function () {IPython.notebook.kernel.restart();}); -// $("#kernel_status").addClass("status_idle"); - -// $("#move_cell").buttonset(); -// $("#move_up").button("option", "icons", {primary:"ui-icon-arrowthick-1-n"}); -// $("#move_up").button("option", "text", false); -// $("#move_up").click(function () {IPython.notebook.move_cell_up();}); -// $("#move_down").button("option", "icons", {primary:"ui-icon-arrowthick-1-s"}); -// $("#move_down").button("option", "text", false); -// $("#move_down").click(function () {IPython.notebook.move_cell_down();}); - -// $("#insert_delete").buttonset(); -// $("#insert_cell_before").click(function () {IPython.notebook.insert_code_cell_before();}); -// $("#insert_cell_after").click(function () {IPython.notebook.insert_code_cell_after();}); -// $("#delete_cell").button("option", "icons", {primary:"ui-icon-closethick"}); -// $("#delete_cell").button("option", "text", false); -// $("#delete_cell").click(function () {IPython.notebook.delete_cell();}); - - }); diff --git a/IPython/frontend/html/notebook/static/js/panelsection.js b/IPython/frontend/html/notebook/static/js/panelsection.js index 50cc6dd..517eeb4 100644 --- a/IPython/frontend/html/notebook/static/js/panelsection.js +++ b/IPython/frontend/html/notebook/static/js/panelsection.js @@ -144,12 +144,12 @@ var IPython = (function (IPython) { this.content.addClass('ui-helper-clearfix'); - var row1 = $('
').addClass('cell_section_row ui-helper-clearfix'). + var row0 = $('
').addClass('cell_section_row ui-helper-clearfix'). append($('').addClass('cell_section_row_buttons'). append($('').attr('id','delete_cell'))). append($('').html('Actions').addClass('cell_section_row_header')); - row1.find('#delete_cell').button(); - this.content.append(row1); + row0.find('#delete_cell').button(); + this.content.append(row0); var row1 = $('
').addClass('cell_section_row ui-helper-clearfix'). append($('').attr('id','insert').addClass('cell_section_row_buttons'). @@ -175,13 +175,13 @@ var IPython = (function (IPython) { row3.find('#cell_type').buttonset(); this.content.append(row3); - var row0 = $('
').addClass('cell_section_row ui-helper-clearfix'). + var row1 = $('
').addClass('cell_section_row ui-helper-clearfix'). append($('').attr('id','toggle_output').addClass('cell_section_row_buttons'). append( $('').attr('id','collapse_cell') ). append( $('').attr('id','expand_cell') ) ). append($('').html('Output').addClass('button_label')); - row0.find('#toggle_output').buttonset(); - this.content.append(row0); + row1.find('#toggle_output').buttonset(); + this.content.append(row1); var row0 = $('
').addClass('cell_section_row'). append($('').attr('id','run_cells').addClass('cell_section_row_buttons'). @@ -204,10 +204,80 @@ var IPython = (function (IPython) { KernelSection.prototype = new PanelSection(); + KernelSection.prototype.bind_events = function () { + PanelSection.prototype.bind_events.apply(this); + this.content.find('#restart_kernel').click(function () { + IPython.notebook.kernel.restart(); + }); + this.content.find('#int_kernel').click(function () { + IPython.notebook.kernel.interrupt(); + }); + }; + + + KernelSection.prototype.create_children = function () { + + this.content.addClass('ui-helper-clearfix'); + + var row0 = $('
').addClass('cell_section_row ui-helper-clearfix'). + append($('').attr('id','int_restart').addClass('cell_section_row_buttons'). + append( $('').attr('id','int_kernel') ). + append( $('').attr('id','restart_kernel') )). + append($('').html('Actions').addClass('cell_section_row_header')); + row0.find('#int_restart').buttonset(); + this.content.append(row0); + }; + + + // HelpSection + + var HelpSection = function () { + this.section_name = "Help"; + PanelSection.apply(this, arguments); + }; + + + HelpSection.prototype = new PanelSection(); + + + HelpSection.prototype.bind_events = function () { + PanelSection.prototype.bind_events.apply(this); + }; + + + HelpSection.prototype.create_children = function () { + + this.content.addClass('ui-helper-clearfix'); + + var row0 = $('
').addClass('cell_section_row ui-helper-clearfix'). + append($('').attr('id','help_buttons0').addClass('cell_section_row_buttons'). + append( $('