##// END OF EJS Templates
fix celltoolbar select css
Matthias BUSSONNIER -
Show More
@@ -1,415 +1,418 b''
1 /**
1 /**
2 * Primary styles
2 * Primary styles
3 *
3 *
4 * Author: IPython Development Team
4 * Author: IPython Development Team
5 */
5 */
6
6
7
7
8 body {
8 body {
9 overflow: hidden;
9 overflow: hidden;
10 }
10 }
11
11
12 blockquote {
12 blockquote {
13 border-left: 4px solid #DDD;
13 border-left: 4px solid #DDD;
14 padding: 0 15px;
14 padding: 0 15px;
15 color: #777;
15 color: #777;
16 }
16 }
17
17
18 span#save_widget {
18 span#save_widget {
19 padding: 5px;
19 padding: 5px;
20 margin: 0px 0px 0px 300px;
20 margin: 0px 0px 0px 300px;
21 display:inline-block;
21 display:inline-block;
22 }
22 }
23
23
24 span#notebook_name {
24 span#notebook_name {
25 height: 1em;
25 height: 1em;
26 line-height: 1em;
26 line-height: 1em;
27 padding: 3px;
27 padding: 3px;
28 border: none;
28 border: none;
29 font-size: 146.5%;
29 font-size: 146.5%;
30 }
30 }
31
31
32
32
33 .ui-menubar-item .ui-button .ui-button-text {
33 .ui-menubar-item .ui-button .ui-button-text {
34 padding: 0.4em 1.0em;
34 padding: 0.4em 1.0em;
35 font-size: 100%;
35 font-size: 100%;
36 }
36 }
37
37
38 .ui-menu {
38 .ui-menu {
39 -moz-box-shadow: 0px 6px 10px -1px #adadad;
39 -moz-box-shadow: 0px 6px 10px -1px #adadad;
40 -webkit-box-shadow: 0px 6px 10px -1px #adadad;
40 -webkit-box-shadow: 0px 6px 10px -1px #adadad;
41 box-shadow: 0px 6px 10px -1px #adadad;
41 box-shadow: 0px 6px 10px -1px #adadad;
42 }
42 }
43
43
44 .ui-menu .ui-menu-item a {
44 .ui-menu .ui-menu-item a {
45 border: 1px solid transparent;
45 border: 1px solid transparent;
46 padding: 2px 1.6em;
46 padding: 2px 1.6em;
47 }
47 }
48
48
49 .ui-menu .ui-menu-item a.ui-state-focus {
49 .ui-menu .ui-menu-item a.ui-state-focus {
50 margin: 0;
50 margin: 0;
51 }
51 }
52
52
53 .ui-menu hr {
53 .ui-menu hr {
54 margin: 0.3em 0;
54 margin: 0.3em 0;
55 }
55 }
56
56
57 #menubar_container {
57 #menubar_container {
58 position: relative;
58 position: relative;
59 }
59 }
60
60
61 #notification_area {
61 #notification_area {
62 position: absolute;
62 position: absolute;
63 right: 0px;
63 right: 0px;
64 top: 0px;
64 top: 0px;
65 height: 25px;
65 height: 25px;
66 padding: 3px 0px;
66 padding: 3px 0px;
67 padding-right: 3px;
67 padding-right: 3px;
68 z-index: 10;
68 z-index: 10;
69 }
69 }
70
70
71 .notification_widget{
71 .notification_widget{
72 float : right;
72 float : right;
73 right: 0px;
73 right: 0px;
74 top: 1px;
74 top: 1px;
75 height: 25px;
75 height: 25px;
76 padding: 3px 6px;
76 padding: 3px 6px;
77 z-index: 10;
77 z-index: 10;
78 }
78 }
79
79
80 .toolbar {
80 .toolbar {
81 padding: 3px 15px;
81 padding: 3px 15px;
82 }
82 }
83
83
84 #maintoolbar > select, #maintoolbar label {
84 #maintoolbar > select, #maintoolbar label {
85 font-size: 85%;
85 font-size: 85%;
86 margin-left:0.3em;
87 margin-right:0.3em;
88
86 }
89 }
87
90
88
91
89 div#main_app {
92 div#main_app {
90 width: 100%;
93 width: 100%;
91 position: relative;
94 position: relative;
92 }
95 }
93
96
94 span#quick_help_area {
97 span#quick_help_area {
95 position: static;
98 position: static;
96 padding: 5px 0px;
99 padding: 5px 0px;
97 margin: 0px 0px 0px 0px;
100 margin: 0px 0px 0px 0px;
98 }
101 }
99
102
100 .help_string {
103 .help_string {
101 float: right;
104 float: right;
102 width: 170px;
105 width: 170px;
103 padding: 0px 5px;
106 padding: 0px 5px;
104 text-align: left;
107 text-align: left;
105 font-size: 85%;
108 font-size: 85%;
106 }
109 }
107
110
108 .help_string_label {
111 .help_string_label {
109 float: right;
112 float: right;
110 font-size: 85%;
113 font-size: 85%;
111 }
114 }
112
115
113 div#notebook_panel {
116 div#notebook_panel {
114 margin: 0px 0px 0px 0px;
117 margin: 0px 0px 0px 0px;
115 padding: 0px;
118 padding: 0px;
116 }
119 }
117
120
118 div#notebook {
121 div#notebook {
119 overflow-y: scroll;
122 overflow-y: scroll;
120 overflow-x: auto;
123 overflow-x: auto;
121 width: 100%;
124 width: 100%;
122 /* This spaces the cell away from the edge of the notebook area */
125 /* This spaces the cell away from the edge of the notebook area */
123 padding: 5px 5px 15px 5px;
126 padding: 5px 5px 15px 5px;
124 margin: 0px;
127 margin: 0px;
125 background-color: white;
128 background-color: white;
126 }
129 }
127
130
128 div#pager_splitter {
131 div#pager_splitter {
129 height: 8px;
132 height: 8px;
130 }
133 }
131
134
132 #pager_container {
135 #pager_container {
133 position : relative;
136 position : relative;
134 }
137 }
135
138
136 div#pager {
139 div#pager {
137 padding: 15px;
140 padding: 15px;
138 overflow: auto;
141 overflow: auto;
139 display: none;
142 display: none;
140 }
143 }
141
144
142 div.ui-widget-content {
145 div.ui-widget-content {
143 border: 1px solid #aaa;
146 border: 1px solid #aaa;
144 outline: none;
147 outline: none;
145 }
148 }
146
149
147 .cell {
150 .cell {
148 border: 1px solid transparent;
151 border: 1px solid transparent;
149 }
152 }
150
153
151 div.cell {
154 div.cell {
152 width: 100%;
155 width: 100%;
153 padding: 5px 5px 5px 0px;
156 padding: 5px 5px 5px 0px;
154 /* This acts as a spacer between cells, that is outside the border */
157 /* This acts as a spacer between cells, that is outside the border */
155 margin: 2px 0px 2px 0px;
158 margin: 2px 0px 2px 0px;
156 }
159 }
157
160
158 div.code_cell {
161 div.code_cell {
159 background-color: white;
162 background-color: white;
160 }
163 }
161
164
162 /* any special styling for code cells that are currently running goes here */
165 /* any special styling for code cells that are currently running goes here */
163 div.code_cell.running {
166 div.code_cell.running {
164 }
167 }
165
168
166 div.prompt {
169 div.prompt {
167 /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
170 /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
168 width: 11ex;
171 width: 11ex;
169 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
172 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
170 padding: 0.4em;
173 padding: 0.4em;
171 margin: 0px;
174 margin: 0px;
172 font-family: monospace;
175 font-family: monospace;
173 text-align:right;
176 text-align:right;
174 }
177 }
175
178
176 div.input {
179 div.input {
177 page-break-inside: avoid;
180 page-break-inside: avoid;
178 }
181 }
179
182
180 /* input_area and input_prompt must match in top border and margin for alignment */
183 /* input_area and input_prompt must match in top border and margin for alignment */
181 div.input_area {
184 div.input_area {
182 color: black;
185 color: black;
183 border: 1px solid #ddd;
186 border: 1px solid #ddd;
184 border-radius: 3px;
187 border-radius: 3px;
185 background: #f7f7f7;
188 background: #f7f7f7;
186 }
189 }
187
190
188 div.input_prompt {
191 div.input_prompt {
189 color: navy;
192 color: navy;
190 border-top: 1px solid transparent;
193 border-top: 1px solid transparent;
191 }
194 }
192
195
193 div.output_wrapper {
196 div.output_wrapper {
194 /* This is a spacer between the input and output of each cell */
197 /* This is a spacer between the input and output of each cell */
195 margin-top: 5px;
198 margin-top: 5px;
196 margin-left: 5px;
199 margin-left: 5px;
197 /* FF needs explicit width to stretch */
200 /* FF needs explicit width to stretch */
198 width: 100%;
201 width: 100%;
199 /* this position must be relative to enable descendents to be absolute within it */
202 /* this position must be relative to enable descendents to be absolute within it */
200 position: relative;
203 position: relative;
201 }
204 }
202
205
203 /* class for the output area when it should be height-limited */
206 /* class for the output area when it should be height-limited */
204 div.output_scroll {
207 div.output_scroll {
205 /* ideally, this would be max-height, but FF barfs all over that */
208 /* ideally, this would be max-height, but FF barfs all over that */
206 height: 24em;
209 height: 24em;
207 /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */
210 /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */
208 width: 100%;
211 width: 100%;
209
212
210 overflow: auto;
213 overflow: auto;
211 border-radius: 3px;
214 border-radius: 3px;
212 box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8);
215 box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8);
213 }
216 }
214
217
215 /* output div while it is collapsed */
218 /* output div while it is collapsed */
216 div.output_collapsed {
219 div.output_collapsed {
217 margin-right: 5px;
220 margin-right: 5px;
218 }
221 }
219
222
220 div.out_prompt_overlay {
223 div.out_prompt_overlay {
221 height: 100%;
224 height: 100%;
222 padding: 0px;
225 padding: 0px;
223 position: absolute;
226 position: absolute;
224 border-radius: 3px;
227 border-radius: 3px;
225 }
228 }
226
229
227 div.out_prompt_overlay:hover {
230 div.out_prompt_overlay:hover {
228 /* use inner shadow to get border that is computed the same on WebKit/FF */
231 /* use inner shadow to get border that is computed the same on WebKit/FF */
229 box-shadow: inset 0 0 1px #000;
232 box-shadow: inset 0 0 1px #000;
230 background: rgba(240, 240, 240, 0.5);
233 background: rgba(240, 240, 240, 0.5);
231 }
234 }
232
235
233 div.output_prompt {
236 div.output_prompt {
234 color: darkred;
237 color: darkred;
235 /* 5px right shift to account for margin in parent container */
238 /* 5px right shift to account for margin in parent container */
236 margin: 0 5px 0 -5px;
239 margin: 0 5px 0 -5px;
237 }
240 }
238
241
239 /* This class is the outer container of all output sections. */
242 /* This class is the outer container of all output sections. */
240 div.output_area {
243 div.output_area {
241 padding: 0px;
244 padding: 0px;
242 page-break-inside: avoid;
245 page-break-inside: avoid;
243 }
246 }
244
247
245 /* This class is for the output subarea inside the output_area and after
248 /* This class is for the output subarea inside the output_area and after
246 the prompt div. */
249 the prompt div. */
247 div.output_subarea {
250 div.output_subarea {
248 padding: 0.44em 0.4em 0.4em 1px;
251 padding: 0.44em 0.4em 0.4em 1px;
249 }
252 }
250
253
251 /* The rest of the output_* classes are for special styling of the different
254 /* The rest of the output_* classes are for special styling of the different
252 output types */
255 output types */
253
256
254 /* all text output has this class: */
257 /* all text output has this class: */
255 div.output_text {
258 div.output_text {
256 text-align: left;
259 text-align: left;
257 color: black;
260 color: black;
258 font-family: monospace;
261 font-family: monospace;
259 }
262 }
260
263
261 /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
264 /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
262 div.output_stream {
265 div.output_stream {
263 padding-top: 0.0em;
266 padding-top: 0.0em;
264 padding-bottom: 0.0em;
267 padding-bottom: 0.0em;
265 }
268 }
266 div.output_stdout {
269 div.output_stdout {
267 }
270 }
268 div.output_stderr {
271 div.output_stderr {
269 background: #fdd; /* very light red background for stderr */
272 background: #fdd; /* very light red background for stderr */
270 }
273 }
271
274
272 div.output_latex {
275 div.output_latex {
273 text-align: left;
276 text-align: left;
274 color: black;
277 color: black;
275 }
278 }
276
279
277 div.output_html {
280 div.output_html {
278 }
281 }
279
282
280 div.output_png {
283 div.output_png {
281 }
284 }
282
285
283 div.output_jpeg {
286 div.output_jpeg {
284 }
287 }
285
288
286 div.text_cell {
289 div.text_cell {
287 background-color: white;
290 background-color: white;
288 padding: 5px 5px 5px 5px;
291 padding: 5px 5px 5px 5px;
289 }
292 }
290
293
291 div.text_cell_input {
294 div.text_cell_input {
292 color: black;
295 color: black;
293 border: 1px solid #ddd;
296 border: 1px solid #ddd;
294 border-radius: 3px;
297 border-radius: 3px;
295 background: #f7f7f7;
298 background: #f7f7f7;
296 }
299 }
297
300
298 div.text_cell_render {
301 div.text_cell_render {
299 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
302 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
300 outline: none;
303 outline: none;
301 resize: none;
304 resize: none;
302 width: inherit;
305 width: inherit;
303 border-style: none;
306 border-style: none;
304 padding: 5px;
307 padding: 5px;
305 color: black;
308 color: black;
306 }
309 }
307
310
308 /* The following gets added to the <head> if it is detected that the user has a
311 /* The following gets added to the <head> if it is detected that the user has a
309 * monospace font with inconsistent normal/bold/italic height. See
312 * monospace font with inconsistent normal/bold/italic height. See
310 * notebookmain.js. Such fonts will have keywords vertically offset with
313 * notebookmain.js. Such fonts will have keywords vertically offset with
311 * respect to the rest of the text. The user should select a better font.
314 * respect to the rest of the text. The user should select a better font.
312 * See: https://github.com/ipython/ipython/issues/1503
315 * See: https://github.com/ipython/ipython/issues/1503
313 *
316 *
314 * .CodeMirror span {
317 * .CodeMirror span {
315 * vertical-align: bottom;
318 * vertical-align: bottom;
316 * }
319 * }
317 */
320 */
318
321
319 .CodeMirror {
322 .CodeMirror {
320 line-height: 1.231; /* Changed from 1em to our global default */
323 line-height: 1.231; /* Changed from 1em to our global default */
321 }
324 }
322
325
323 .CodeMirror-scroll {
326 .CodeMirror-scroll {
324 height: auto; /* Changed to auto to autogrow */
327 height: auto; /* Changed to auto to autogrow */
325 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
328 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
326 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
329 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
327 overflow-y: hidden;
330 overflow-y: hidden;
328 overflow-x: auto; /* Changed from auto to remove scrollbar */
331 overflow-x: auto; /* Changed from auto to remove scrollbar */
329 }
332 }
330
333
331 /* CSS font colors for translated ANSI colors. */
334 /* CSS font colors for translated ANSI colors. */
332
335
333
336
334 .ansiblack {color: black;}
337 .ansiblack {color: black;}
335 .ansired {color: darkred;}
338 .ansired {color: darkred;}
336 .ansigreen {color: darkgreen;}
339 .ansigreen {color: darkgreen;}
337 .ansiyellow {color: brown;}
340 .ansiyellow {color: brown;}
338 .ansiblue {color: darkblue;}
341 .ansiblue {color: darkblue;}
339 .ansipurple {color: darkviolet;}
342 .ansipurple {color: darkviolet;}
340 .ansicyan {color: steelblue;}
343 .ansicyan {color: steelblue;}
341 .ansigrey {color: grey;}
344 .ansigrey {color: grey;}
342 .ansibold {font-weight: bold;}
345 .ansibold {font-weight: bold;}
343
346
344 .completions {
347 .completions {
345 position: absolute;
348 position: absolute;
346 z-index: 10;
349 z-index: 10;
347 overflow: hidden;
350 overflow: hidden;
348 border: 1px solid grey;
351 border: 1px solid grey;
349 }
352 }
350
353
351 .completions select {
354 .completions select {
352 background: white;
355 background: white;
353 outline: none;
356 outline: none;
354 border: none;
357 border: none;
355 padding: 0px;
358 padding: 0px;
356 margin: 0px;
359 margin: 0px;
357 overflow: auto;
360 overflow: auto;
358 font-family: monospace;
361 font-family: monospace;
359 }
362 }
360
363
361 option.context {
364 option.context {
362 background-color: #DEF7FF;
365 background-color: #DEF7FF;
363 }
366 }
364 option.introspection {
367 option.introspection {
365 background-color: #EBF4EB;
368 background-color: #EBF4EB;
366 }
369 }
367
370
368 /*fixed part of the completion*/
371 /*fixed part of the completion*/
369 .completions p b {
372 .completions p b {
370 font-weight:bold;
373 font-weight:bold;
371 }
374 }
372
375
373 .completions p {
376 .completions p {
374 background: #DDF;
377 background: #DDF;
375 /*outline: none;
378 /*outline: none;
376 padding: 0px;*/
379 padding: 0px;*/
377 border-bottom: black solid 1px;
380 border-bottom: black solid 1px;
378 padding: 1px;
381 padding: 1px;
379 font-family: monospace;
382 font-family: monospace;
380 }
383 }
381
384
382 pre.dialog {
385 pre.dialog {
383 background-color: #f7f7f7;
386 background-color: #f7f7f7;
384 border: 1px solid #ddd;
387 border: 1px solid #ddd;
385 border-radius: 3px;
388 border-radius: 3px;
386 padding: 0.4em;
389 padding: 0.4em;
387 padding-left: 2em;
390 padding-left: 2em;
388 }
391 }
389
392
390 p.dialog {
393 p.dialog {
391 padding : 0.2em;
394 padding : 0.2em;
392 }
395 }
393
396
394 .shortcut_key {
397 .shortcut_key {
395 display: inline-block;
398 display: inline-block;
396 width: 15ex;
399 width: 15ex;
397 text-align: right;
400 text-align: right;
398 font-family: monospace;
401 font-family: monospace;
399 }
402 }
400
403
401 .shortcut_descr {
404 .shortcut_descr {
402 }
405 }
403
406
404 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
407 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
405 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
408 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
406 */
409 */
407 pre, code, kbd, samp { white-space: pre-wrap; }
410 pre, code, kbd, samp { white-space: pre-wrap; }
408
411
409 #fonttest {
412 #fonttest {
410 font-family: monospace;
413 font-family: monospace;
411 }
414 }
412
415
413 .js-error {
416 .js-error {
414 color: darkred;
417 color: darkred;
415 }
418 }
@@ -1,178 +1,178 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2011 The IPython Development Team
2 // Copyright (C) 2011 The IPython Development Team
3 //
3 //
4 // Distributed under the terms of the BSD License. The full license is in
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7
7
8 //============================================================================
8 //============================================================================
9 // ToolBar
9 // ToolBar
10 //============================================================================
10 //============================================================================
11
11
12 var IPython = (function (IPython) {
12 var IPython = (function (IPython) {
13
13
14 var MainToolBar = function (selector) {
14 var MainToolBar = function (selector) {
15 this.selector = selector;
15 this.selector = selector;
16 IPython.ToolBar.apply(this, arguments);
16 IPython.ToolBar.apply(this, arguments);
17 this.construct();
17 this.construct();
18 this.add_drop_down_list();
18 this.add_drop_down_list();
19 this.bind_events();
19 this.bind_events();
20 $(this.selector)
20 $(this.selector)
21 .append($('<label/>').text('CellToolbar'))
21 .append($('<label/>').text('Cell Toolbar:'))
22 .append(IPython.CellToolbar.dropdown_preset_element)
22 .append(IPython.CellToolbar.dropdown_preset_element)
23 };
23 };
24
24
25 MainToolBar.prototype = new IPython.ToolBar();
25 MainToolBar.prototype = new IPython.ToolBar();
26
26
27 MainToolBar.prototype.construct = function () {
27 MainToolBar.prototype.construct = function () {
28 this.add_buttons_group([
28 this.add_buttons_group([
29 {
29 {
30 id : 'save_b',
30 id : 'save_b',
31 label : 'Save',
31 label : 'Save',
32 icon : 'ui-icon-disk',
32 icon : 'ui-icon-disk',
33 callback : function () {
33 callback : function () {
34 IPython.notebook.save_notebook();
34 IPython.notebook.save_notebook();
35 }
35 }
36 }
36 }
37 ]);
37 ]);
38 this.add_buttons_group([
38 this.add_buttons_group([
39 {
39 {
40 id : 'cut_b',
40 id : 'cut_b',
41 label : 'Cut Cell',
41 label : 'Cut Cell',
42 icon : 'ui-icon-scissors',
42 icon : 'ui-icon-scissors',
43 callback : function () {
43 callback : function () {
44 IPython.notebook.cut_cell();
44 IPython.notebook.cut_cell();
45 }
45 }
46 },
46 },
47 {
47 {
48 id : 'copy_b',
48 id : 'copy_b',
49 label : 'Copy Cell',
49 label : 'Copy Cell',
50 icon : 'ui-icon-copy',
50 icon : 'ui-icon-copy',
51 callback : function () {
51 callback : function () {
52 IPython.notebook.copy_cell();
52 IPython.notebook.copy_cell();
53 }
53 }
54 },
54 },
55 {
55 {
56 id : 'paste_b',
56 id : 'paste_b',
57 label : 'Paste Cell Below',
57 label : 'Paste Cell Below',
58 icon : 'ui-icon-clipboard',
58 icon : 'ui-icon-clipboard',
59 callback : function () {
59 callback : function () {
60 IPython.notebook.paste_cell_below();
60 IPython.notebook.paste_cell_below();
61 }
61 }
62 }
62 }
63 ],'cut_copy_paste');
63 ],'cut_copy_paste');
64
64
65 this.add_buttons_group([
65 this.add_buttons_group([
66 {
66 {
67 id : 'move_up_b',
67 id : 'move_up_b',
68 label : 'Move Cell Up',
68 label : 'Move Cell Up',
69 icon : 'ui-icon-arrowthick-1-n',
69 icon : 'ui-icon-arrowthick-1-n',
70 callback : function () {
70 callback : function () {
71 IPython.notebook.move_cell_up();
71 IPython.notebook.move_cell_up();
72 }
72 }
73 },
73 },
74 {
74 {
75 id : 'move_down_b',
75 id : 'move_down_b',
76 label : 'Move Cell Down',
76 label : 'Move Cell Down',
77 icon : 'ui-icon-arrowthick-1-s',
77 icon : 'ui-icon-arrowthick-1-s',
78 callback : function () {
78 callback : function () {
79 IPython.notebook.move_cell_down();
79 IPython.notebook.move_cell_down();
80 }
80 }
81 }
81 }
82 ],'move_up_down');
82 ],'move_up_down');
83
83
84 this.add_buttons_group([
84 this.add_buttons_group([
85 {
85 {
86 id : 'insert_above_b',
86 id : 'insert_above_b',
87 label : 'Insert Cell Above',
87 label : 'Insert Cell Above',
88 icon : 'ui-icon-arrowthickstop-1-n',
88 icon : 'ui-icon-arrowthickstop-1-n',
89 callback : function () {
89 callback : function () {
90 IPython.notebook.insert_cell_above('code');
90 IPython.notebook.insert_cell_above('code');
91 }
91 }
92 },
92 },
93 {
93 {
94 id : 'insert_below_b',
94 id : 'insert_below_b',
95 label : 'Insert Cell Below',
95 label : 'Insert Cell Below',
96 icon : 'ui-icon-arrowthickstop-1-s',
96 icon : 'ui-icon-arrowthickstop-1-s',
97 callback : function () {
97 callback : function () {
98 IPython.notebook.insert_cell_below('code');
98 IPython.notebook.insert_cell_below('code');
99 }
99 }
100 }
100 }
101 ],'insert_above_below');
101 ],'insert_above_below');
102
102
103 this.add_buttons_group([
103 this.add_buttons_group([
104 {
104 {
105 id : 'run_b',
105 id : 'run_b',
106 label : 'Run Cell',
106 label : 'Run Cell',
107 icon : 'ui-icon-play',
107 icon : 'ui-icon-play',
108 callback : function () {
108 callback : function () {
109 IPython.notebook.execute_selected_cell();
109 IPython.notebook.execute_selected_cell();
110 }
110 }
111 },
111 },
112 {
112 {
113 id : 'interrupt_b',
113 id : 'interrupt_b',
114 label : 'Interrupt',
114 label : 'Interrupt',
115 icon : 'ui-icon-stop',
115 icon : 'ui-icon-stop',
116 callback : function () {
116 callback : function () {
117 IPython.notebook.kernel.interrupt();
117 IPython.notebook.kernel.interrupt();
118 }
118 }
119 }
119 }
120 ],'run_int');
120 ],'run_int');
121 };
121 };
122
122
123 MainToolBar.prototype.add_drop_down_list = function () {
123 MainToolBar.prototype.add_drop_down_list = function () {
124 var select = $(this.selector)
124 var select = $(this.selector)
125 .append($('<select/>')
125 .append($('<select/>')
126 .attr('id','cell_type')
126 .attr('id','cell_type')
127 .addClass('ui-widget ui-widget-content')
127 .addClass('ui-widget ui-widget-content')
128 .append($('<option/>').attr('value','code').text('Code'))
128 .append($('<option/>').attr('value','code').text('Code'))
129 .append($('<option/>').attr('value','markdown').text('Markdown'))
129 .append($('<option/>').attr('value','markdown').text('Markdown'))
130 .append($('<option/>').attr('value','raw').text('Raw Text'))
130 .append($('<option/>').attr('value','raw').text('Raw Text'))
131 .append($('<option/>').attr('value','heading1').text('Heading 1'))
131 .append($('<option/>').attr('value','heading1').text('Heading 1'))
132 .append($('<option/>').attr('value','heading2').text('Heading 2'))
132 .append($('<option/>').attr('value','heading2').text('Heading 2'))
133 .append($('<option/>').attr('value','heading3').text('Heading 3'))
133 .append($('<option/>').attr('value','heading3').text('Heading 3'))
134 .append($('<option/>').attr('value','heading4').text('Heading 4'))
134 .append($('<option/>').attr('value','heading4').text('Heading 4'))
135 .append($('<option/>').attr('value','heading5').text('Heading 5'))
135 .append($('<option/>').attr('value','heading5').text('Heading 5'))
136 .append($('<option/>').attr('value','heading6').text('Heading 6'))
136 .append($('<option/>').attr('value','heading6').text('Heading 6'))
137 );
137 );
138 };
138 };
139
139
140 MainToolBar.prototype.bind_events = function () {
140 MainToolBar.prototype.bind_events = function () {
141 var that = this;
141 var that = this;
142
142
143 this.element.find('#cell_type').change(function () {
143 this.element.find('#cell_type').change(function () {
144 var cell_type = $(this).val();
144 var cell_type = $(this).val();
145 if (cell_type === 'code') {
145 if (cell_type === 'code') {
146 IPython.notebook.to_code();
146 IPython.notebook.to_code();
147 } else if (cell_type === 'markdown') {
147 } else if (cell_type === 'markdown') {
148 IPython.notebook.to_markdown();
148 IPython.notebook.to_markdown();
149 } else if (cell_type === 'raw') {
149 } else if (cell_type === 'raw') {
150 IPython.notebook.to_raw();
150 IPython.notebook.to_raw();
151 } else if (cell_type === 'heading1') {
151 } else if (cell_type === 'heading1') {
152 IPython.notebook.to_heading(undefined, 1);
152 IPython.notebook.to_heading(undefined, 1);
153 } else if (cell_type === 'heading2') {
153 } else if (cell_type === 'heading2') {
154 IPython.notebook.to_heading(undefined, 2);
154 IPython.notebook.to_heading(undefined, 2);
155 } else if (cell_type === 'heading3') {
155 } else if (cell_type === 'heading3') {
156 IPython.notebook.to_heading(undefined, 3);
156 IPython.notebook.to_heading(undefined, 3);
157 } else if (cell_type === 'heading4') {
157 } else if (cell_type === 'heading4') {
158 IPython.notebook.to_heading(undefined, 4);
158 IPython.notebook.to_heading(undefined, 4);
159 } else if (cell_type === 'heading5') {
159 } else if (cell_type === 'heading5') {
160 IPython.notebook.to_heading(undefined, 5);
160 IPython.notebook.to_heading(undefined, 5);
161 } else if (cell_type === 'heading6') {
161 } else if (cell_type === 'heading6') {
162 IPython.notebook.to_heading(undefined, 6);
162 IPython.notebook.to_heading(undefined, 6);
163 }
163 }
164 });
164 });
165 $([IPython.events]).on('selected_cell_type_changed.Notebook', function (event, data) {
165 $([IPython.events]).on('selected_cell_type_changed.Notebook', function (event, data) {
166 if (data.cell_type === 'heading') {
166 if (data.cell_type === 'heading') {
167 that.element.find('#cell_type').val(data.cell_type+data.level);
167 that.element.find('#cell_type').val(data.cell_type+data.level);
168 } else {
168 } else {
169 that.element.find('#cell_type').val(data.cell_type);
169 that.element.find('#cell_type').val(data.cell_type);
170 }
170 }
171 });
171 });
172 };
172 };
173
173
174 IPython.MainToolBar = MainToolBar;
174 IPython.MainToolBar = MainToolBar;
175
175
176 return IPython;
176 return IPython;
177
177
178 }(IPython));
178 }(IPython));
General Comments 0
You need to be logged in to leave comments. Login now