##// END OF EJS Templates
#toolbar -> #maintoolbar
Matthias BUSSONNIER -
Show More
@@ -1,62 +1,62 b''
1 1 //----------------------------------------------------------------------------
2 2 // Copyright (C) 2008-2011 The IPython Development Team
3 3 //
4 4 // Distributed under the terms of the BSD License. The full license is in
5 5 // the file COPYING, distributed as part of this software.
6 6 //----------------------------------------------------------------------------
7 7
8 8 //============================================================================
9 9 // Layout
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var LayoutManager = function () {
15 15 this.bind_events();
16 16 };
17 17
18 18
19 19 LayoutManager.prototype.bind_events = function () {
20 20 $(window).resize($.proxy(this.do_resize,this));
21 21 };
22 22
23 23 LayoutManager.prototype.app_height = function() {
24 24 var win = $(window);
25 25 var w = win.width();
26 26 var h = win.height();
27 27 var header_height;
28 28 if ($('div#header').css('display') === 'none') {
29 29 header_height = 0;
30 30 } else {
31 31 header_height = $('div#header').outerHeight(true);
32 32 }
33 33 var menubar_height = $('div#menubar').outerHeight(true);
34 34 var toolbar_height;
35 if ($('div#toolbar').css('display') === 'none') {
35 if ($('div#maintoolbar').css('display') === 'none') {
36 36 toolbar_height = 0;
37 37 } else {
38 toolbar_height = $('div#toolbar').outerHeight(true);
38 toolbar_height = $('div#maintoolbar').outerHeight(true);
39 39 }
40 40 return h-header_height-menubar_height-toolbar_height; // content height
41 41 }
42 42
43 43 LayoutManager.prototype.do_resize = function () {
44 44 var app_height = this.app_height() // content height
45 45
46 46 $('div#main_app').height(app_height); // content+padding+border height
47 47
48 48 var pager_height = IPython.pager.percentage_height*app_height;
49 49 var pager_splitter_height = $('div#pager_splitter').outerHeight(true);
50 50 $('div#pager').height(pager_height);
51 51 if (IPython.pager.expanded) {
52 52 $('div#notebook').height(app_height-pager_height-pager_splitter_height);
53 53 } else {
54 54 $('div#notebook').height(app_height-pager_splitter_height);
55 55 }
56 56 };
57 57
58 58 IPython.LayoutManager = LayoutManager;
59 59
60 60 return IPython;
61 61
62 62 }(IPython));
@@ -1,182 +1,182 b''
1 1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008 The IPython Development Team
2 // Copyright (C) 2011 The IPython Development Team
3 3 //
4 4 // Distributed under the terms of the BSD License. The full license is in
5 5 // the file COPYING, distributed as part of this software.
6 6 //----------------------------------------------------------------------------
7 7
8 8 //============================================================================
9 9 // ToolBar
10 10 //============================================================================
11 11
12 12 var IPython = (function (IPython) {
13 13
14 14 var MainToolBar = function (selector) {
15 15 this.selector = selector;
16 16 if (this.selector !== undefined) {
17 17 IPython.ToolBar.apply(this, arguments);
18 18 // move the rest ouside
19 19 this.construct();
20 20 this.add_drop_down_list();
21 21 this.bind_events();
22 22 }
23 23 };
24 24
25 25 MainToolBar.prototype = new IPython.ToolBar();
26 26
27 27 MainToolBar.prototype.add_drop_down_list = function() {
28 28 var select = $(this.selector)
29 29 .append($('<select/>')
30 30 .attr('id','cell_type')
31 31 .addClass('ui-widget ui-widget-content')
32 32 .append($('<option/>').attr('value','code').text('Code'))
33 33 .append($('<option/>').attr('value','markdown').text('Markdown'))
34 34 .append($('<option/>').attr('value','raw').text('Raw Text'))
35 35 .append($('<option/>').attr('value','heading1').text('Heading 1'))
36 36 .append($('<option/>').attr('value','heading2').text('Heading 2'))
37 37 .append($('<option/>').attr('value','heading3').text('Heading 3'))
38 38 .append($('<option/>').attr('value','heading4').text('Heading 4'))
39 39 .append($('<option/>').attr('value','heading5').text('Heading 5'))
40 40 .append($('<option/>').attr('value','heading6').text('Heading 6'))
41 41 .append($('<option/>').attr('value','heading7').text('Heading 7'))
42 42 .append($('<option/>').attr('value','heading8').text('Heading 8'))
43 43 );
44 44 }
45 45
46 46 MainToolBar.prototype.construct = function() {
47 47 this.add_buttons_group([
48 48 {
49 49 id:'save_b',
50 50 label:'Save',
51 51 icon:'ui-icon-disk',
52 52 callback:function(){
53 53 IPython.notebook.save_notebook();
54 54 },
55 55 },
56 56 ]);
57 57 this.add_buttons_group([
58 58 {
59 59 id:'cut_b',
60 60 label:'Cut Cell',
61 61 icon:'ui-icon-scissors',
62 62 callback:function(){
63 63 IPython.notebook.cut_cell();
64 64 },
65 65 },
66 66 {
67 67 id:'copy_b',
68 68 label:'Copy Cell',
69 69 icon:'ui-icon-copy',
70 70 callback:function(){
71 71 IPython.notebook.copy_cell();
72 72 },
73 73 },
74 74 {
75 75 id:'paste_b',
76 76 label:'Paste Cell',
77 77 icon:'ui-icon-clipboard',
78 78 callback:function(){
79 79 IPython.notebook.paste_cell();
80 80 },
81 81 },
82 82 ],'cut_copy_paste');
83 83
84 84 this.add_buttons_group([
85 85 {
86 86 id:'move_up_b',
87 87 label:'Move Cell Up',
88 88 icon:'ui-icon-arrowthick-1-n',
89 89 callback:function(){
90 90 IPython.notebook.move_cell_up();
91 91 },
92 92 },
93 93 {
94 94 id:'move_down_b',
95 95 label:'Move Cell Down',
96 96 icon:'ui-icon-arrowthick-1-s',
97 97 callback:function(){
98 98 IPython.notebook.move_cell_down();
99 99 },
100 100 },
101 101 ],'move_up_down');
102 102
103 103 this.add_buttons_group([
104 104 {
105 105 id:'insert_above_b',
106 106 label:'Insert Cell Above',
107 107 icon:'ui-icon-arrowthickstop-1-n',
108 108 callback:function(){
109 109 IPython.notebook.insert_cell_above('code');
110 110 },
111 111 },
112 112 {
113 113 id:'insert_below_b',
114 114 label:'Insert Cell Below',
115 115 icon:'ui-icon-arrowthickstop-1-s',
116 116 callback:function(){
117 117 IPython.notebook.insert_cell_below('code');
118 118 },
119 119 },
120 120 ],'insert_above_below');
121 121
122 122 this.add_buttons_group([
123 123 {
124 124 id:'run_b',
125 125 label:'Run Cell',
126 126 icon:'ui-icon-play',
127 127 callback:function(){
128 128 IPython.notebook.execute_selected_cell();
129 129 },
130 130 },
131 131 {
132 132 id:'interrupt_b',
133 133 label:'Interrupt',
134 134 icon:'ui-icon-stop',
135 135 callback:function(){
136 136 IPython.notebook.kernel.interrupt();
137 137 },
138 138 },
139 139 ],'run_int');
140 140
141 141
142 142 }
143 143
144 144 MainToolBar.prototype.bind_events = function () {
145 145 var that = this;
146 146
147 147 this.element.find('#cell_type').change(function () {
148 148 var cell_type = $(this).val();
149 149 if (cell_type === 'code') {
150 150 IPython.notebook.to_code();
151 151 } else if (cell_type === 'markdown') {
152 152 IPython.notebook.to_markdown();
153 153 } else if (cell_type === 'raw') {
154 154 IPython.notebook.to_raw();
155 155 } else if (cell_type === 'heading1') {
156 156 IPython.notebook.to_heading(undefined, 1);
157 157 } else if (cell_type === 'heading2') {
158 158 IPython.notebook.to_heading(undefined, 2);
159 159 } else if (cell_type === 'heading3') {
160 160 IPython.notebook.to_heading(undefined, 3);
161 161 } else if (cell_type === 'heading4') {
162 162 IPython.notebook.to_heading(undefined, 4);
163 163 } else if (cell_type === 'heading5') {
164 164 IPython.notebook.to_heading(undefined, 5);
165 165 } else if (cell_type === 'heading6') {
166 166 IPython.notebook.to_heading(undefined, 6);
167 167 };
168 168 });
169 169 $([IPython.events]).on('selected_cell_type_changed.Notebook', function (event, data) {
170 170 if (data.cell_type === 'heading') {
171 171 that.element.find('#cell_type').val(data.cell_type+data.level);
172 172 } else {
173 173 that.element.find('#cell_type').val(data.cell_type);
174 174 }
175 175 });
176 176 };
177 177
178 178 IPython.MainToolBar = MainToolBar;
179 179
180 180 return IPython;
181 181
182 182 }(IPython));
@@ -1,68 +1,68 b''
1 1 //----------------------------------------------------------------------------
2 2 // Copyright (C) 2008-2011 The IPython Development Team
3 3 //
4 4 // Distributed under the terms of the BSD License. The full license is in
5 5 // the file COPYING, distributed as part of this software.
6 6 //----------------------------------------------------------------------------
7 7
8 8 //============================================================================
9 9 // On document ready
10 10 //============================================================================
11 11
12 12
13 13 $(document).ready(function () {
14 14
15 15 IPython.init_mathjax();
16 16
17 17 IPython.read_only = $('body').data('readOnly') === 'True';
18 18 $('div#main_app').addClass('border-box-sizing ui-widget');
19 19 $('div#notebook_panel').addClass('border-box-sizing ui-widget');
20 20 // The header's bottom border is provided by the menu bar so we remove it.
21 21 $('div#header').css('border-bottom-style','none');
22 22
23 23 IPython.page = new IPython.Page();
24 24 IPython.markdown_converter = new Markdown.Converter();
25 25 IPython.layout_manager = new IPython.LayoutManager();
26 26 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
27 27 IPython.quick_help = new IPython.QuickHelp('span#quick_help_area');
28 28 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
29 29 IPython.notebook = new IPython.Notebook('div#notebook');
30 30 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
31 31 IPython.menubar = new IPython.MenuBar('#menubar')
32 IPython.toolbar = new IPython.MainToolBar('#toolbar')
32 IPython.toolbar = new IPython.MainToolBar('#maintoolbar')
33 33 IPython.tooltip = new IPython.Tooltip()
34 34 IPython.notification_widget = new IPython.NotificationWidget('#notification')
35 35
36 36 IPython.layout_manager.do_resize();
37 37
38 38 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
39 39 '<span id="test2" style="font-weight: bold;">x</span>'+
40 40 '<span id="test3" style="font-style: italic;">x</span></pre></div>')
41 41 var nh = $('#test1').innerHeight();
42 42 var bh = $('#test2').innerHeight();
43 43 var ih = $('#test3').innerHeight();
44 44 if(nh != bh || nh != ih) {
45 45 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
46 46 }
47 47 $('#fonttest').remove();
48 48
49 49 if(IPython.read_only){
50 50 // hide various elements from read-only view
51 51 $('div#pager').remove();
52 52 $('div#pager_splitter').remove();
53 53
54 54 // set the notebook name field as not modifiable
55 55 $('#notebook_name').attr('disabled','disabled')
56 56 }
57 57
58 58 IPython.page.show();
59 59
60 60 IPython.layout_manager.do_resize();
61 61 $([IPython.events]).on('notebook_loaded.Notebook', function () {
62 62 IPython.layout_manager.do_resize();
63 63 IPython.save_widget.update_url();
64 64 })
65 65 IPython.notebook.load_notebook($('body').data('notebookId'));
66 66
67 67 });
68 68
@@ -1,213 +1,213 b''
1 1 {% extends page.html %}
2 2 {% block stylesheet %}
3 3
4 4 {% if mathjax_url %}
5 5 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script>
6 6 {% end %}
7 7 <script type="text/javascript">
8 8 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 9 // where it will be undefined, and should prompt a dialog later.
10 10 window.mathjax_url = "{{mathjax_url}}";
11 11 </script>
12 12
13 13 <link rel="stylesheet" href="{{ static_url("codemirror/lib/codemirror.css") }}">
14 14 <link rel="stylesheet" href="{{ static_url("codemirror/theme/ipython.css") }}">
15 15
16 16 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
17 17
18 18 <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" />
19 19 <link rel="stylesheet" href="{{ static_url("css/tooltip.css") }}" type="text/css" />
20 20 <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" />
21 21
22 22 {% end %}
23 23
24 24
25 25 {% block params %}
26 26
27 27 data-project={{project}}
28 28 data-base-project-url={{base_project_url}}
29 29 data-base-kernel-url={{base_kernel_url}}
30 30 data-read-only={{read_only and not logged_in}}
31 31 data-notebook-id={{notebook_id}}
32 32
33 33 {% end %}
34 34
35 35
36 36 {% block header %}
37 37
38 38 <span id="save_widget">
39 39 <span id="notebook_name"></span>
40 40 <span id="save_status"></span>
41 41 </span>
42 42
43 43 {% end %}
44 44
45 45
46 46 {% block site %}
47 47
48 48 <div id="menubar_container">
49 49 <div id="menubar">
50 50 <ul id="menus">
51 51 <li><a href="#">File</a>
52 52 <ul>
53 53 <li id="new_notebook"><a href="#">New</a></li>
54 54 <li id="open_notebook"><a href="#">Open...</a></li>
55 55 <hr/>
56 56 <li id="copy_notebook"><a href="#">Make a Copy...</a></li>
57 57 <li id="rename_notebook"><a href="#">Rename...</a></li>
58 58 <li id="save_notebook"><a href="#">Save</a></li>
59 59 <hr/>
60 60 <li><a href="#">Download as</a>
61 61 <ul>
62 62 <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li>
63 63 <li id="download_py"><a href="#">Python (.py)</a></li>
64 64 </ul>
65 65 </li>
66 66 <hr/>
67 67 <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li>
68 68 <hr/>
69 69 <li id="kill_and_exit"><a href="#" >Close and halt</a></li>
70 70 </ul>
71 71 </li>
72 72 <li><a href="#">Edit</a>
73 73 <ul>
74 74 <li id="cut_cell"><a href="#">Cut Cell</a></li>
75 75 <li id="copy_cell"><a href="#">Copy Cell</a></li>
76 76 <li id="paste_cell" class="ui-state-disabled"><a href="#">Paste Cell</a></li>
77 77 <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Cell Above</a></li>
78 78 <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Cell Below</a></li>
79 79 <li id="delete_cell"><a href="#">Delete</a></li>
80 80 <hr/>
81 81 <li id="split_cell"><a href="#">Split Cell</a></li>
82 82 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
83 83 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
84 84 <hr/>
85 85 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
86 86 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
87 87 <hr/>
88 88 <li id="select_previous"><a href="#">Select Previous Cell</a></li>
89 89 <li id="select_next"><a href="#">Select Next Cell</a></li>
90 90 </ul>
91 91 </li>
92 92 <li><a href="#">View</a>
93 93 <ul>
94 94 <li id="toggle_header"><a href="#">Toggle Header</a></li>
95 95 <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li>
96 96 </ul>
97 97 </li>
98 98 <li><a href="#">Insert</a>
99 99 <ul>
100 100 <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li>
101 101 <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li>
102 102 </ul>
103 103 </li>
104 104 <li><a href="#">Cell</a>
105 105 <ul>
106 106 <li id="run_cell"><a href="#">Run</a></li>
107 107 <li id="run_cell_in_place"><a href="#">Run in Place</a></li>
108 108 <li id="run_all_cells"><a href="#">Run All</a></li>
109 109 <hr/>
110 110 <li id="to_code"><a href="#">Code</a></li>
111 111 <li id="to_markdown"><a href="#">Markdown </a></li>
112 112 <li id="to_raw"><a href="#">Raw Text</a></li>
113 113 <li id="to_heading1"><a href="#">Heading 1</a></li>
114 114 <li id="to_heading2"><a href="#">Heading 2</a></li>
115 115 <li id="to_heading3"><a href="#">Heading 3</a></li>
116 116 <li id="to_heading4"><a href="#">Heading 4</a></li>
117 117 <li id="to_heading5"><a href="#">Heading 5</a></li>
118 118 <li id="to_heading6"><a href="#">Heading 6</a></li>
119 119 <hr/>
120 120 <li id="toggle_output"><a href="#">Toggle Current Output</a></li>
121 121 <li id="all_outputs"><a href="#">All Output</a>
122 122 <ul>
123 123 <li id="expand_all_output"><a href="#">Expand</a></li>
124 124 <li id="scroll_all_output"><a href="#">Scroll Long</a></li>
125 125 <li id="collapse_all_output"><a href="#">Collapse</a></li>
126 126 <li id="clear_all_output"><a href="#">Clear</a></li>
127 127 </ul>
128 128 </li>
129 129 </ul>
130 130 </li>
131 131 <li><a href="#">Kernel</a>
132 132 <ul>
133 133 <li id="int_kernel"><a href="#">Interrupt</a></li>
134 134 <li id="restart_kernel"><a href="#">Restart</a></li>
135 135 </ul>
136 136 </li>
137 137 <li><a href="#">Help</a>
138 138 <ul>
139 139 <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li>
140 140 <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li>
141 141 <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li>
142 142 <hr/>
143 143 <li><a href="http://docs.python.org" target="_blank">Python</a></li>
144 144 <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li>
145 145 <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li>
146 146 <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li>
147 147 <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li>
148 148 </ul>
149 149 </li>
150 150 </ul>
151 151
152 152 </div>
153 153 <div id="notification"></div>
154 154 </div>
155 155
156 156
157 <div id="toolbar"></div>
157 <div id="maintoolbar"></div>
158 158
159 159 <div id="main_app">
160 160
161 161 <div id="notebook_panel">
162 162 <div id="notebook"></div>
163 163 <div id="pager_splitter"></div>
164 164 <div id="pager"></div>
165 165 </div>
166 166
167 167 </div>
168 168 <div id='tooltip' class='tooltip ui-corner-all' style='display:none'></div>
169 169
170 170
171 171 {% end %}
172 172
173 173
174 174 {% block script %}
175 175
176 176 <script src="{{ static_url("codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
177 177 <script src="{{ static_url("codemirror/mode/python/python.js") }}" charset="utf-8"></script>
178 178 <script src="{{ static_url("codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
179 179 <script src="{{ static_url("codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
180 180 <script src="{{ static_url("codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
181 181 <script src="{{ static_url("codemirror/mode/css/css.js") }}" charset="utf-8"></script>
182 182 <script src="{{ static_url("codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
183 183 <script src="{{ static_url("codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
184 184
185 185 <script src="{{ static_url("pagedown/Markdown.Converter.js") }}" charset="utf-8"></script>
186 186
187 187 <script src="{{ static_url("prettify/prettify.js") }}" charset="utf-8"></script>
188 188 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
189 189
190 190 <script src="{{ static_url("js/events.js") }}" type="text/javascript" charset="utf-8"></script>
191 191 <script src="{{ static_url("js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
192 192 <script src="{{ static_url("js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
193 193 <script src="{{ static_url("js/initmathjax.js") }}" type="text/javascript" charset="utf-8"></script>
194 194 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
195 195 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
196 196 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
197 197 <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
198 198 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
199 199 <script src="{{ static_url("js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
200 200 <script src="{{ static_url("js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
201 201 <script src="{{ static_url("js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
202 202 <script src="{{ static_url("js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
203 203 <script src="{{ static_url("js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
204 204 <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
205 205 <script src="{{ static_url("js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
206 206 <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
207 207 <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
208 208 <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
209 209 <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
210 210
211 211 <script src="{{ static_url("js/contexthint.js") }} charset="utf-8"></script>
212 212
213 213 {% end %}
General Comments 0
You need to be logged in to leave comments. Login now