##// END OF EJS Templates
Tweak test for magic_cpaste.
Tweak test for magic_cpaste.

File last commit:

r5150:bbc4d01c
r5203:15192a1f
Show More
panelsection.js
289 lines | 10.9 KiB | application/javascript | JavascriptLexer
Brian E. Granger
More review changes....
r4609 //----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365
//============================================================================
Brian E. Granger
More review changes....
r4609 // PanelSection
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 //============================================================================
var IPython = (function (IPython) {
var utils = IPython.utils;
// Base PanelSection class
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 var PanelSection = function (selector) {
this.selector = selector;
if (this.selector !== undefined) {
this.element = $(selector);
MinRK
Moving status widget to Kernel section of L panel.
r5116 this.header = this.element.find('div.section_header');
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content = this.element.find('div.section_content');
this.style();
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 this.bind_events();
}
this.expanded = true;
};
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 PanelSection.prototype.style = function () {
MinRK
Moving status widget to Kernel section of L panel.
r5116 this.header.addClass('ui-widget ui-state-default ui-helper-clearfix');
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 this.header.attr('title', "Click to Show/Hide Section");
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content.addClass('ui-widget section_content');
};
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 PanelSection.prototype.bind_events = function () {
var that = this;
this.header.click(function () {
that.toggle();
});
this.header.hover(function () {
that.header.toggleClass('ui-state-hover');
});
};
PanelSection.prototype.expand = function () {
if (!this.expanded) {
this.content.slideDown('fast');
this.expanded = true;
};
};
PanelSection.prototype.collapse = function () {
if (this.expanded) {
this.content.slideUp('fast');
this.expanded = false;
};
};
PanelSection.prototype.toggle = function () {
if (this.expanded === true) {
this.collapse();
} else {
this.expand();
};
};
PanelSection.prototype.create_children = function () {};
// NotebookSection
var NotebookSection = function () {
PanelSection.apply(this, arguments);
};
NotebookSection.prototype = new PanelSection();
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 NotebookSection.prototype.style = function () {
PanelSection.prototype.style.apply(this);
this.content.addClass('ui-helper-clearfix');
this.content.find('div.section_row').addClass('ui-helper-clearfix');
this.content.find('#new_open').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 this.content.find('#new_notebook').attr('title', "Create a new notebook");
this.content.find('#open_notebook').attr('title', "Open an existing notebook");
Brian E. Granger
Massive work on the notebook document format....
r4484 this.content.find('#download_notebook').button();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 this.content.find('#download_notebook').attr('title',
"Download the notebook in the specified format," +
MinRK
Add tooltip to Download/Print indicating need to save first...
r5150 " either full ipynb notebook or as a Python script." +
" Make sure to save before downloading, to ensure the file is up to date."
);
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 // upload notebook doesn't exist:
Brian E. Granger
Massive work on the notebook document format....
r4484 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');
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 };
NotebookSection.prototype.bind_events = function () {
PanelSection.prototype.bind_events.apply(this);
Brian E. Granger
Massive work on the notebook document format....
r4484 var that = this;
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content.find('#new_notebook').click(function () {
Brian E. Granger
Further work updating JS URL scheme to use data-base-project-url.
r5108 window.open($('body').data('baseProjectUrl')+'new');
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 });
this.content.find('#open_notebook').click(function () {
Brian E. Granger
Further work updating JS URL scheme to use data-base-project-url.
r5108 window.open($('body').data('baseProjectUrl'));
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 });
Brian E. Granger
Massive work on the notebook document format....
r4484 this.content.find('#download_notebook').click(function () {
var format = that.content.find('#download_format').val();
var notebook_id = IPython.save_widget.get_notebook_id();
Brian E. Granger
Further work updating JS URL scheme to use data-base-project-url.
r5108 var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id + '?format=' + format;
Brian E. Granger
Massive work on the notebook document format....
r4484 window.open(url,'_newtab');
});
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 };
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 // CellSection
var CellSection = function () {
PanelSection.apply(this, arguments);
};
CellSection.prototype = new PanelSection();
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 CellSection.prototype.style = function () {
PanelSection.prototype.style.apply(this);
this.content.addClass('ui-helper-clearfix');
this.content.find('div.section_row').addClass('ui-helper-clearfix');
this.content.find('#delete_cell').button();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 this.content.find('#delete_cell').attr('title', "Delete the selected cell");
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content.find('#insert').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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");
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content.find('#move').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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");
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content.find('#cell_type').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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)')
Brian E. Granger
Cell collapse/expand is not called "Toggle".
r4639 this.content.find('#cell_output').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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)')
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 this.content.find('#run_cells').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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')
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 };
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 CellSection.prototype.bind_events = function () {
PanelSection.prototype.bind_events.apply(this);
Brian E. Granger
Cell collapse/expand is not called "Toggle".
r4639 this.content.find('#toggle_output').click(function () {
IPython.notebook.toggle_output();
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 });
Brian E. Granger
Clear all output is implemented.
r4543 this.content.find('#clear_all_output').click(function () {
IPython.notebook.clear_all_output();
});
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 this.content.find('#delete_cell').click(function () {
IPython.notebook.delete_cell();
});
this.content.find('#insert_cell_above').click(function () {
Fernando Perez
Fix above/below keybinding mismatch and rename api to use above/below
r4659 IPython.notebook.insert_code_cell_above();
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 });
this.content.find('#insert_cell_below').click(function () {
Fernando Perez
Fix above/below keybinding mismatch and rename api to use above/below
r4659 IPython.notebook.insert_code_cell_below();
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 });
this.content.find('#move_cell_up').click(function () {
IPython.notebook.move_cell_up();
});
this.content.find('#move_cell_down').click(function () {
IPython.notebook.move_cell_down();
});
this.content.find('#to_code').click(function () {
Brian E. Granger
Starting work on a Markdown cell.
r4507 IPython.notebook.to_code();
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 });
Brian Granger
Refactoring of text/markdown/rst/html cells.
r4508 this.content.find('#to_markdown').click(function () {
IPython.notebook.to_markdown();
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 });
Brian E. Granger
Controls in cell section have a solid layout.
r4367 this.content.find('#run_selected_cell').click(function () {
Brian E. Granger
Fixing execution related things....
r4378 IPython.notebook.execute_selected_cell();
Brian E. Granger
Controls in cell section have a solid layout.
r4367 });
this.content.find('#run_all_cells').click(function () {
Brian E. Granger
Fixing execution related things....
r4378 IPython.notebook.execute_all_cells();
Brian E. Granger
Controls in cell section have a solid layout.
r4367 });
Brian E. Granger
Implemented smart autoindenting.
r4512 this.content.find('#autoindent').change(function () {
var state = $('#autoindent').prop('checked');
IPython.notebook.set_autoindent(state);
});
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 };
// KernelSection
var KernelSection = function () {
PanelSection.apply(this, arguments);
};
KernelSection.prototype = new PanelSection();
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 KernelSection.prototype.style = function () {
PanelSection.prototype.style.apply(this);
this.content.addClass('ui-helper-clearfix');
this.content.find('div.section_row').addClass('ui-helper-clearfix');
this.content.find('#int_restart').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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);
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 };
Brian E. Granger
Help section implemented and working.
r4368 KernelSection.prototype.bind_events = function () {
PanelSection.prototype.bind_events.apply(this);
this.content.find('#restart_kernel').click(function () {
Brian E. Granger
Major refactor of kernel connection management in the notebook....
r4545 IPython.notebook.restart_kernel();
Brian E. Granger
Help section implemented and working.
r4368 });
this.content.find('#int_kernel').click(function () {
IPython.notebook.kernel.interrupt();
});
};
// HelpSection
var HelpSection = function () {
PanelSection.apply(this, arguments);
};
HelpSection.prototype = new PanelSection();
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 HelpSection.prototype.style = function () {
PanelSection.prototype.style.apply(this);
PanelSection.prototype.style.apply(this);
this.content.addClass('ui-helper-clearfix');
this.content.find('div.section_row').addClass('ui-helper-clearfix');
this.content.find('#help_buttons0').buttonset();
this.content.find('#help_buttons1').buttonset();
Brian E. Granger
Reorganize the L panel buttons.
r4640 this.content.find('#help_buttons2').buttonset();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 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")
Brian E. Granger
Help section implemented and working.
r4368 };
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 HelpSection.prototype.bind_events = function () {
PanelSection.prototype.bind_events.apply(this);
};
Brian E. Granger
Help section implemented and working.
r4368
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 // Set module variables
Brian E. Granger
Help section implemented and working.
r4368
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365 IPython.PanelSection = PanelSection;
IPython.NotebookSection = NotebookSection;
IPython.CellSection = CellSection;
IPython.KernelSection = KernelSection;
Brian E. Granger
Help section implemented and working.
r4368 IPython.HelpSection = HelpSection;
Brian E. Granger
Initial draft of panel section and the cell section working.
r4365
return IPython;
}(IPython));