##// END OF EJS Templates
moved getdefaultencoding from text to py3compat
moved getdefaultencoding from text to py3compat

File last commit:

r6248:fe46a420
r6653:521fe811
Show More
menubar.js
178 lines | 6.7 KiB | application/javascript | JavascriptLexer
Brian Granger
Implemented menu based UI using Wijmo.
r5857 //----------------------------------------------------------------------------
// 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.
//----------------------------------------------------------------------------
//============================================================================
// MenuBar
//============================================================================
var IPython = (function (IPython) {
var MenuBar = function (selector) {
this.selector = selector;
if (this.selector !== undefined) {
this.element = $(selector);
this.style();
this.bind_events();
}
};
MenuBar.prototype.style = function () {
Brian Granger
Major refactoring of notebook....
r6193 this.element.addClass('border-box-sizing');
Brian Granger
Cell splitting and merging is done!
r5898 $('ul#menus').menubar({
select : function (event, ui) {
Brian Granger
Fixing minor typo in menubar.js.
r5908 // The selected cell loses focus when the menu is entered, so we
Brian Granger
Cell splitting and merging is done!
r5898 // re-select it upon selection.
Brian Granger
Refactoring of the notebooks cell management....
r5945 var i = IPython.notebook.get_selected_index();
Brian Granger
Cell splitting and merging is done!
r5898 IPython.notebook.select(i);
}
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 };
MenuBar.prototype.bind_events = function () {
// File
this.element.find('#new_notebook').click(function () {
window.open($('body').data('baseProjectUrl')+'new');
});
this.element.find('#open_notebook').click(function () {
window.open($('body').data('baseProjectUrl'));
});
Brian Granger
Improved notebook renaming....
r5859 this.element.find('#rename_notebook').click(function () {
IPython.save_widget.rename_notebook();
});
Brian Granger
Beginning work on notebook duplication.
r5860 this.element.find('#copy_notebook').click(function () {
Brian Granger
Major refactoring of saving, notification....
r6047 var notebook_id = IPython.notebook.get_notebook_id();
Brian Granger
Beginning work on notebook duplication.
r5860 var url = $('body').data('baseProjectUrl') + notebook_id + '/copy';
window.open(url,'_newtab');
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 this.element.find('#save_notebook').click(function () {
Brian Granger
Major refactoring of saving, notification....
r6047 IPython.notebook.save_notebook();
Brian Granger
Implemented menu based UI using Wijmo.
r5857 });
this.element.find('#download_ipynb').click(function () {
Brian Granger
Major refactoring of saving, notification....
r6047 var notebook_id = IPython.notebook.get_notebook_id();
Brian Granger
Implemented menu based UI using Wijmo.
r5857 var url = $('body').data('baseProjectUrl') + 'notebooks/' +
notebook_id + '?format=json';
window.open(url,'_newtab');
});
this.element.find('#download_py').click(function () {
Brian Granger
Major refactoring of saving, notification....
r6047 var notebook_id = IPython.notebook.get_notebook_id();
Brian Granger
Implemented menu based UI using Wijmo.
r5857 var url = $('body').data('baseProjectUrl') + 'notebooks/' +
notebook_id + '?format=py';
window.open(url,'_newtab');
});
this.element.find('button#print_notebook').click(function () {
IPython.print_widget.print_notebook();
});
// Edit
Brian Granger
Added cell level cut/copy/paste.
r5879 this.element.find('#cut_cell').click(function () {
IPython.notebook.cut_cell();
});
this.element.find('#copy_cell').click(function () {
IPython.notebook.copy_cell();
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 this.element.find('#delete_cell').click(function () {
IPython.notebook.delete_cell();
});
Brian Granger
Basic code cell splitting implemented.
r5896 this.element.find('#split_cell').click(function () {
IPython.notebook.split_cell();
});
this.element.find('#merge_cell_above').click(function () {
IPython.notebook.merge_cell_above();
});
this.element.find('#merge_cell_below').click(function () {
IPython.notebook.merge_cell_below();
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 this.element.find('#move_cell_up').click(function () {
IPython.notebook.move_cell_up();
});
this.element.find('#move_cell_down').click(function () {
IPython.notebook.move_cell_down();
});
Brian Granger
Cleaning up menu code....
r5858 this.element.find('#select_previous').click(function () {
IPython.notebook.select_prev();
});
this.element.find('#select_next').click(function () {
IPython.notebook.select_next();
});
Brian Granger
Further work on the toolbar UI....
r5994 // View
this.element.find('#toggle_header').click(function () {
$('div#header').toggle();
IPython.layout_manager.do_resize();
});
this.element.find('#toggle_toolbar').click(function () {
IPython.toolbar.toggle();
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 // Insert
this.element.find('#insert_cell_above').click(function () {
Brian Granger
Refactoring of the notebooks cell management....
r5945 IPython.notebook.insert_cell_above('code');
Brian Granger
Implemented menu based UI using Wijmo.
r5857 });
this.element.find('#insert_cell_below').click(function () {
Brian Granger
Refactoring of the notebooks cell management....
r5945 IPython.notebook.insert_cell_below('code');
Brian Granger
Implemented menu based UI using Wijmo.
r5857 });
// Cell
this.element.find('#run_cell').click(function () {
IPython.notebook.execute_selected_cell();
});
this.element.find('#run_cell_in_place').click(function () {
IPython.notebook.execute_selected_cell({terminal:true});
});
this.element.find('#run_all_cells').click(function () {
IPython.notebook.execute_all_cells();
});
this.element.find('#to_code').click(function () {
IPython.notebook.to_code();
});
this.element.find('#to_markdown').click(function () {
IPython.notebook.to_markdown();
});
MinRK
rename plaintext cell -> raw cell
r6248 this.element.find('#to_raw').click(function () {
IPython.notebook.to_raw();
Brian Granger
A first go at RST cell support in the notebook.
r6017 });
Brian Granger
Finishing first draft of RST and heading cells.
r6019 this.element.find('#to_heading1').click(function () {
IPython.notebook.to_heading(undefined, 1);
});
this.element.find('#to_heading2').click(function () {
IPython.notebook.to_heading(undefined, 2);
});
this.element.find('#to_heading3').click(function () {
IPython.notebook.to_heading(undefined, 3);
});
this.element.find('#to_heading4').click(function () {
IPython.notebook.to_heading(undefined, 4);
});
this.element.find('#to_heading5').click(function () {
IPython.notebook.to_heading(undefined, 5);
});
this.element.find('#to_heading6').click(function () {
IPython.notebook.to_heading(undefined, 6);
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 this.element.find('#toggle_output').click(function () {
IPython.notebook.toggle_output();
});
this.element.find('#clear_all_output').click(function () {
IPython.notebook.clear_all_output();
});
// Kernel
this.element.find('#int_kernel').click(function () {
IPython.notebook.kernel.interrupt();
});
this.element.find('#restart_kernel').click(function () {
IPython.notebook.restart_kernel();
});
Brian Granger
Cleaning up menu code....
r5858 // Help
this.element.find('#keyboard_shortcuts').click(function () {
IPython.quick_help.show_keyboard_shortcuts();
});
Brian Granger
Implemented menu based UI using Wijmo.
r5857 };
IPython.MenuBar = MenuBar;
return IPython;
}(IPython));