Show More
@@ -80,6 +80,7 var IPython = (function (IPython) { | |||||
80 | var default_common_shortcuts = { |
|
80 | var default_common_shortcuts = { | |
81 | 'meta+s' : { |
|
81 | 'meta+s' : { | |
82 | help : 'save notebook', |
|
82 | help : 'save notebook', | |
|
83 | help_index : 'fb', | |||
83 | handler : function (event) { |
|
84 | handler : function (event) { | |
84 | IPython.notebook.save_checkpoint(); |
|
85 | IPython.notebook.save_checkpoint(); | |
85 | event.preventDefault(); |
|
86 | event.preventDefault(); | |
@@ -88,6 +89,7 var IPython = (function (IPython) { | |||||
88 | }, |
|
89 | }, | |
89 | 'ctrl+s' : { |
|
90 | 'ctrl+s' : { | |
90 | help : 'save notebook', |
|
91 | help : 'save notebook', | |
|
92 | help_index : 'fc', | |||
91 | handler : function (event) { |
|
93 | handler : function (event) { | |
92 | IPython.notebook.save_checkpoint(); |
|
94 | IPython.notebook.save_checkpoint(); | |
93 | event.preventDefault(); |
|
95 | event.preventDefault(); | |
@@ -96,6 +98,7 var IPython = (function (IPython) { | |||||
96 | }, |
|
98 | }, | |
97 | 'shift' : { |
|
99 | 'shift' : { | |
98 | help : '', |
|
100 | help : '', | |
|
101 | help_index : '', | |||
99 | handler : function (event) { |
|
102 | handler : function (event) { | |
100 | // ignore shift keydown |
|
103 | // ignore shift keydown | |
101 | return true; |
|
104 | return true; | |
@@ -103,22 +106,25 var IPython = (function (IPython) { | |||||
103 | }, |
|
106 | }, | |
104 | 'shift+enter' : { |
|
107 | 'shift+enter' : { | |
105 | help : 'run cell', |
|
108 | help : 'run cell', | |
|
109 | help_index : 'ba', | |||
106 | handler : function (event) { |
|
110 | handler : function (event) { | |
107 | IPython.notebook.execute_cell(); |
|
111 | IPython.notebook.execute_cell(); | |
108 | return false; |
|
112 | return false; | |
109 | } |
|
113 | } | |
110 | }, |
|
114 | }, | |
111 |
' |
|
115 | 'ctrl+enter' : { | |
112 |
help : 'run cell, |
|
116 | help : 'run cell, select below', | |
|
117 | help_index : 'bb', | |||
113 | handler : function (event) { |
|
118 | handler : function (event) { | |
114 |
IPython.notebook.execute_cell_and_ |
|
119 | IPython.notebook.execute_cell_and_select_below(); | |
115 | return false; |
|
120 | return false; | |
116 | } |
|
121 | } | |
117 | }, |
|
122 | }, | |
118 |
' |
|
123 | 'alt+enter' : { | |
119 |
help : 'run cell, |
|
124 | help : 'run cell, insert below', | |
|
125 | help_index : 'bc', | |||
120 | handler : function (event) { |
|
126 | handler : function (event) { | |
121 |
IPython.notebook.execute_cell_and_ |
|
127 | IPython.notebook.execute_cell_and_insert_below(); | |
122 | return false; |
|
128 | return false; | |
123 | } |
|
129 | } | |
124 | } |
|
130 | } | |
@@ -129,6 +135,7 var IPython = (function (IPython) { | |||||
129 | var default_edit_shortcuts = { |
|
135 | var default_edit_shortcuts = { | |
130 | 'esc' : { |
|
136 | 'esc' : { | |
131 | help : 'command mode', |
|
137 | help : 'command mode', | |
|
138 | help_index : 'aa', | |||
132 | handler : function (event) { |
|
139 | handler : function (event) { | |
133 | IPython.notebook.command_mode(); |
|
140 | IPython.notebook.command_mode(); | |
134 | IPython.notebook.focus_cell(); |
|
141 | IPython.notebook.focus_cell(); | |
@@ -137,6 +144,7 var IPython = (function (IPython) { | |||||
137 | }, |
|
144 | }, | |
138 | 'ctrl+m' : { |
|
145 | 'ctrl+m' : { | |
139 | help : 'command mode', |
|
146 | help : 'command mode', | |
|
147 | help_index : 'ab', | |||
140 | handler : function (event) { |
|
148 | handler : function (event) { | |
141 | IPython.notebook.command_mode(); |
|
149 | IPython.notebook.command_mode(); | |
142 | IPython.notebook.focus_cell(); |
|
150 | IPython.notebook.focus_cell(); | |
@@ -145,6 +153,7 var IPython = (function (IPython) { | |||||
145 | }, |
|
153 | }, | |
146 | 'up' : { |
|
154 | 'up' : { | |
147 | help : 'select previous cell', |
|
155 | help : 'select previous cell', | |
|
156 | help_index : 'da', | |||
148 | handler : function (event) { |
|
157 | handler : function (event) { | |
149 | var cell = IPython.notebook.get_selected_cell(); |
|
158 | var cell = IPython.notebook.get_selected_cell(); | |
150 | if (cell && cell.at_top()) { |
|
159 | if (cell && cell.at_top()) { | |
@@ -158,6 +167,7 var IPython = (function (IPython) { | |||||
158 | }, |
|
167 | }, | |
159 | 'down' : { |
|
168 | 'down' : { | |
160 | help : 'select next cell', |
|
169 | help : 'select next cell', | |
|
170 | help_index : 'db', | |||
161 | handler : function (event) { |
|
171 | handler : function (event) { | |
162 | var cell = IPython.notebook.get_selected_cell(); |
|
172 | var cell = IPython.notebook.get_selected_cell(); | |
163 | if (cell && cell.at_bottom()) { |
|
173 | if (cell && cell.at_bottom()) { | |
@@ -171,13 +181,15 var IPython = (function (IPython) { | |||||
171 | }, |
|
181 | }, | |
172 | 'alt+-' : { |
|
182 | 'alt+-' : { | |
173 | help : 'split cell', |
|
183 | help : 'split cell', | |
|
184 | help_index : 'ea', | |||
174 | handler : function (event) { |
|
185 | handler : function (event) { | |
175 | IPython.notebook.split_cell(); |
|
186 | IPython.notebook.split_cell(); | |
176 | return false; |
|
187 | return false; | |
177 | } |
|
188 | } | |
178 | }, |
|
189 | }, | |
179 | 'alt+subtract' : { |
|
190 | 'alt+subtract' : { | |
180 |
help : ' |
|
191 | help : '', | |
|
192 | help_index : 'eb', | |||
181 | handler : function (event) { |
|
193 | handler : function (event) { | |
182 | IPython.notebook.split_cell(); |
|
194 | IPython.notebook.split_cell(); | |
183 | return false; |
|
195 | return false; | |
@@ -190,6 +202,7 var IPython = (function (IPython) { | |||||
190 | var default_command_shortcuts = { |
|
202 | var default_command_shortcuts = { | |
191 | 'enter' : { |
|
203 | 'enter' : { | |
192 | help : 'edit mode', |
|
204 | help : 'edit mode', | |
|
205 | help_index : 'aa', | |||
193 | handler : function (event) { |
|
206 | handler : function (event) { | |
194 | IPython.notebook.edit_mode(); |
|
207 | IPython.notebook.edit_mode(); | |
195 | return false; |
|
208 | return false; | |
@@ -197,6 +210,7 var IPython = (function (IPython) { | |||||
197 | }, |
|
210 | }, | |
198 | 'up' : { |
|
211 | 'up' : { | |
199 | help : 'select previous cell', |
|
212 | help : 'select previous cell', | |
|
213 | help_index : 'da', | |||
200 | handler : function (event) { |
|
214 | handler : function (event) { | |
201 | var index = IPython.notebook.get_selected_index(); |
|
215 | var index = IPython.notebook.get_selected_index(); | |
202 | if (index !== 0 && index !== null) { |
|
216 | if (index !== 0 && index !== null) { | |
@@ -209,6 +223,7 var IPython = (function (IPython) { | |||||
209 | }, |
|
223 | }, | |
210 | 'down' : { |
|
224 | 'down' : { | |
211 | help : 'select next cell', |
|
225 | help : 'select next cell', | |
|
226 | help_index : 'db', | |||
212 | handler : function (event) { |
|
227 | handler : function (event) { | |
213 | var index = IPython.notebook.get_selected_index(); |
|
228 | var index = IPython.notebook.get_selected_index(); | |
214 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { |
|
229 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { | |
@@ -221,6 +236,7 var IPython = (function (IPython) { | |||||
221 | }, |
|
236 | }, | |
222 | 'k' : { |
|
237 | 'k' : { | |
223 | help : 'select previous cell', |
|
238 | help : 'select previous cell', | |
|
239 | help_index : 'dc', | |||
224 | handler : function (event) { |
|
240 | handler : function (event) { | |
225 | var index = IPython.notebook.get_selected_index(); |
|
241 | var index = IPython.notebook.get_selected_index(); | |
226 | if (index !== 0 && index !== null) { |
|
242 | if (index !== 0 && index !== null) { | |
@@ -233,6 +249,7 var IPython = (function (IPython) { | |||||
233 | }, |
|
249 | }, | |
234 | 'j' : { |
|
250 | 'j' : { | |
235 | help : 'select next cell', |
|
251 | help : 'select next cell', | |
|
252 | help_index : 'dd', | |||
236 | handler : function (event) { |
|
253 | handler : function (event) { | |
237 | var index = IPython.notebook.get_selected_index(); |
|
254 | var index = IPython.notebook.get_selected_index(); | |
238 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { |
|
255 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { | |
@@ -245,6 +262,7 var IPython = (function (IPython) { | |||||
245 | }, |
|
262 | }, | |
246 | 'x' : { |
|
263 | 'x' : { | |
247 | help : 'cut cell', |
|
264 | help : 'cut cell', | |
|
265 | help_index : 'ee', | |||
248 | handler : function (event) { |
|
266 | handler : function (event) { | |
249 | IPython.notebook.cut_cell(); |
|
267 | IPython.notebook.cut_cell(); | |
250 | return false; |
|
268 | return false; | |
@@ -252,6 +270,7 var IPython = (function (IPython) { | |||||
252 | }, |
|
270 | }, | |
253 | 'c' : { |
|
271 | 'c' : { | |
254 | help : 'copy cell', |
|
272 | help : 'copy cell', | |
|
273 | help_index : 'ef', | |||
255 | handler : function (event) { |
|
274 | handler : function (event) { | |
256 | IPython.notebook.copy_cell(); |
|
275 | IPython.notebook.copy_cell(); | |
257 | return false; |
|
276 | return false; | |
@@ -259,6 +278,7 var IPython = (function (IPython) { | |||||
259 | }, |
|
278 | }, | |
260 | 'v' : { |
|
279 | 'v' : { | |
261 | help : 'paste cell below', |
|
280 | help : 'paste cell below', | |
|
281 | help_index : 'eg', | |||
262 | handler : function (event) { |
|
282 | handler : function (event) { | |
263 | IPython.notebook.paste_cell_below(); |
|
283 | IPython.notebook.paste_cell_below(); | |
264 | return false; |
|
284 | return false; | |
@@ -266,6 +286,7 var IPython = (function (IPython) { | |||||
266 | }, |
|
286 | }, | |
267 | 'd' : { |
|
287 | 'd' : { | |
268 | help : 'delete cell (press twice)', |
|
288 | help : 'delete cell (press twice)', | |
|
289 | help_index : 'ei', | |||
269 | handler : function (event) { |
|
290 | handler : function (event) { | |
270 | var dc = IPython.keyboard_manager._delete_count; |
|
291 | var dc = IPython.keyboard_manager._delete_count; | |
271 | if (dc === 0) { |
|
292 | if (dc === 0) { | |
@@ -282,6 +303,7 var IPython = (function (IPython) { | |||||
282 | }, |
|
303 | }, | |
283 | 'a' : { |
|
304 | 'a' : { | |
284 | help : 'insert cell above', |
|
305 | help : 'insert cell above', | |
|
306 | help_index : 'ec', | |||
285 | handler : function (event) { |
|
307 | handler : function (event) { | |
286 | IPython.notebook.insert_cell_above('code'); |
|
308 | IPython.notebook.insert_cell_above('code'); | |
287 | IPython.notebook.select_prev(); |
|
309 | IPython.notebook.select_prev(); | |
@@ -291,6 +313,7 var IPython = (function (IPython) { | |||||
291 | }, |
|
313 | }, | |
292 | 'b' : { |
|
314 | 'b' : { | |
293 | help : 'insert cell below', |
|
315 | help : 'insert cell below', | |
|
316 | help_index : 'ed', | |||
294 | handler : function (event) { |
|
317 | handler : function (event) { | |
295 | IPython.notebook.insert_cell_below('code'); |
|
318 | IPython.notebook.insert_cell_below('code'); | |
296 | IPython.notebook.select_next(); |
|
319 | IPython.notebook.select_next(); | |
@@ -300,6 +323,7 var IPython = (function (IPython) { | |||||
300 | }, |
|
323 | }, | |
301 | 'y' : { |
|
324 | 'y' : { | |
302 | help : 'to code', |
|
325 | help : 'to code', | |
|
326 | help_index : 'ca', | |||
303 | handler : function (event) { |
|
327 | handler : function (event) { | |
304 | IPython.notebook.to_code(); |
|
328 | IPython.notebook.to_code(); | |
305 | return false; |
|
329 | return false; | |
@@ -307,6 +331,7 var IPython = (function (IPython) { | |||||
307 | }, |
|
331 | }, | |
308 | 'm' : { |
|
332 | 'm' : { | |
309 | help : 'to markdown', |
|
333 | help : 'to markdown', | |
|
334 | help_index : 'cb', | |||
310 | handler : function (event) { |
|
335 | handler : function (event) { | |
311 | IPython.notebook.to_markdown(); |
|
336 | IPython.notebook.to_markdown(); | |
312 | return false; |
|
337 | return false; | |
@@ -314,6 +339,7 var IPython = (function (IPython) { | |||||
314 | }, |
|
339 | }, | |
315 | 't' : { |
|
340 | 't' : { | |
316 | help : 'to raw', |
|
341 | help : 'to raw', | |
|
342 | help_index : 'cc', | |||
317 | handler : function (event) { |
|
343 | handler : function (event) { | |
318 | IPython.notebook.to_raw(); |
|
344 | IPython.notebook.to_raw(); | |
319 | return false; |
|
345 | return false; | |
@@ -321,6 +347,7 var IPython = (function (IPython) { | |||||
321 | }, |
|
347 | }, | |
322 | '1' : { |
|
348 | '1' : { | |
323 | help : 'to heading 1', |
|
349 | help : 'to heading 1', | |
|
350 | help_index : 'cd', | |||
324 | handler : function (event) { |
|
351 | handler : function (event) { | |
325 | IPython.notebook.to_heading(undefined, 1); |
|
352 | IPython.notebook.to_heading(undefined, 1); | |
326 | return false; |
|
353 | return false; | |
@@ -328,6 +355,7 var IPython = (function (IPython) { | |||||
328 | }, |
|
355 | }, | |
329 | '2' : { |
|
356 | '2' : { | |
330 | help : 'to heading 2', |
|
357 | help : 'to heading 2', | |
|
358 | help_index : 'ce', | |||
331 | handler : function (event) { |
|
359 | handler : function (event) { | |
332 | IPython.notebook.to_heading(undefined, 2); |
|
360 | IPython.notebook.to_heading(undefined, 2); | |
333 | return false; |
|
361 | return false; | |
@@ -335,6 +363,7 var IPython = (function (IPython) { | |||||
335 | }, |
|
363 | }, | |
336 | '3' : { |
|
364 | '3' : { | |
337 | help : 'to heading 3', |
|
365 | help : 'to heading 3', | |
|
366 | help_index : 'cf', | |||
338 | handler : function (event) { |
|
367 | handler : function (event) { | |
339 | IPython.notebook.to_heading(undefined, 3); |
|
368 | IPython.notebook.to_heading(undefined, 3); | |
340 | return false; |
|
369 | return false; | |
@@ -342,6 +371,7 var IPython = (function (IPython) { | |||||
342 | }, |
|
371 | }, | |
343 | '4' : { |
|
372 | '4' : { | |
344 | help : 'to heading 4', |
|
373 | help : 'to heading 4', | |
|
374 | help_index : 'cg', | |||
345 | handler : function (event) { |
|
375 | handler : function (event) { | |
346 | IPython.notebook.to_heading(undefined, 4); |
|
376 | IPython.notebook.to_heading(undefined, 4); | |
347 | return false; |
|
377 | return false; | |
@@ -349,6 +379,7 var IPython = (function (IPython) { | |||||
349 | }, |
|
379 | }, | |
350 | '5' : { |
|
380 | '5' : { | |
351 | help : 'to heading 5', |
|
381 | help : 'to heading 5', | |
|
382 | help_index : 'ch', | |||
352 | handler : function (event) { |
|
383 | handler : function (event) { | |
353 | IPython.notebook.to_heading(undefined, 5); |
|
384 | IPython.notebook.to_heading(undefined, 5); | |
354 | return false; |
|
385 | return false; | |
@@ -356,6 +387,7 var IPython = (function (IPython) { | |||||
356 | }, |
|
387 | }, | |
357 | '6' : { |
|
388 | '6' : { | |
358 | help : 'to heading 6', |
|
389 | help : 'to heading 6', | |
|
390 | help_index : 'ci', | |||
359 | handler : function (event) { |
|
391 | handler : function (event) { | |
360 | IPython.notebook.to_heading(undefined, 6); |
|
392 | IPython.notebook.to_heading(undefined, 6); | |
361 | return false; |
|
393 | return false; | |
@@ -363,6 +395,7 var IPython = (function (IPython) { | |||||
363 | }, |
|
395 | }, | |
364 | 'o' : { |
|
396 | 'o' : { | |
365 | help : 'toggle output', |
|
397 | help : 'toggle output', | |
|
398 | help_index : 'gb', | |||
366 | handler : function (event) { |
|
399 | handler : function (event) { | |
367 | IPython.notebook.toggle_output(); |
|
400 | IPython.notebook.toggle_output(); | |
368 | return false; |
|
401 | return false; | |
@@ -370,6 +403,7 var IPython = (function (IPython) { | |||||
370 | }, |
|
403 | }, | |
371 | 'shift+o' : { |
|
404 | 'shift+o' : { | |
372 | help : 'toggle output', |
|
405 | help : 'toggle output', | |
|
406 | help_index : 'gc', | |||
373 | handler : function (event) { |
|
407 | handler : function (event) { | |
374 | IPython.notebook.toggle_output_scroll(); |
|
408 | IPython.notebook.toggle_output_scroll(); | |
375 | return false; |
|
409 | return false; | |
@@ -377,6 +411,7 var IPython = (function (IPython) { | |||||
377 | }, |
|
411 | }, | |
378 | 's' : { |
|
412 | 's' : { | |
379 | help : 'save notebook', |
|
413 | help : 'save notebook', | |
|
414 | help_index : 'fa', | |||
380 | handler : function (event) { |
|
415 | handler : function (event) { | |
381 | IPython.notebook.save_checkpoint(); |
|
416 | IPython.notebook.save_checkpoint(); | |
382 | return false; |
|
417 | return false; | |
@@ -384,6 +419,7 var IPython = (function (IPython) { | |||||
384 | }, |
|
419 | }, | |
385 | 'ctrl+j' : { |
|
420 | 'ctrl+j' : { | |
386 | help : 'move cell down', |
|
421 | help : 'move cell down', | |
|
422 | help_index : 'eb', | |||
387 | handler : function (event) { |
|
423 | handler : function (event) { | |
388 | IPython.notebook.move_cell_down(); |
|
424 | IPython.notebook.move_cell_down(); | |
389 | return false; |
|
425 | return false; | |
@@ -391,6 +427,7 var IPython = (function (IPython) { | |||||
391 | }, |
|
427 | }, | |
392 | 'ctrl+k' : { |
|
428 | 'ctrl+k' : { | |
393 | help : 'move cell up', |
|
429 | help : 'move cell up', | |
|
430 | help_index : 'ea', | |||
394 | handler : function (event) { |
|
431 | handler : function (event) { | |
395 | IPython.notebook.move_cell_up(); |
|
432 | IPython.notebook.move_cell_up(); | |
396 | return false; |
|
433 | return false; | |
@@ -398,6 +435,7 var IPython = (function (IPython) { | |||||
398 | }, |
|
435 | }, | |
399 | 'l' : { |
|
436 | 'l' : { | |
400 | help : 'toggle line numbers', |
|
437 | help : 'toggle line numbers', | |
|
438 | help_index : 'ga', | |||
401 | handler : function (event) { |
|
439 | handler : function (event) { | |
402 | IPython.notebook.cell_toggle_line_numbers(); |
|
440 | IPython.notebook.cell_toggle_line_numbers(); | |
403 | return false; |
|
441 | return false; | |
@@ -405,6 +443,7 var IPython = (function (IPython) { | |||||
405 | }, |
|
443 | }, | |
406 | 'i' : { |
|
444 | 'i' : { | |
407 | help : 'interrupt kernel', |
|
445 | help : 'interrupt kernel', | |
|
446 | help_index : 'ha', | |||
408 | handler : function (event) { |
|
447 | handler : function (event) { | |
409 | IPython.notebook.kernel.interrupt(); |
|
448 | IPython.notebook.kernel.interrupt(); | |
410 | return false; |
|
449 | return false; | |
@@ -412,6 +451,7 var IPython = (function (IPython) { | |||||
412 | }, |
|
451 | }, | |
413 | '.' : { |
|
452 | '.' : { | |
414 | help : 'restart kernel', |
|
453 | help : 'restart kernel', | |
|
454 | help_index : 'hb', | |||
415 | handler : function (event) { |
|
455 | handler : function (event) { | |
416 | IPython.notebook.restart_kernel(); |
|
456 | IPython.notebook.restart_kernel(); | |
417 | return false; |
|
457 | return false; | |
@@ -419,6 +459,7 var IPython = (function (IPython) { | |||||
419 | }, |
|
459 | }, | |
420 | 'h' : { |
|
460 | 'h' : { | |
421 | help : 'keyboard shortcuts', |
|
461 | help : 'keyboard shortcuts', | |
|
462 | help_index : 'gd', | |||
422 | handler : function (event) { |
|
463 | handler : function (event) { | |
423 | IPython.quick_help.show_keyboard_shortcuts(); |
|
464 | IPython.quick_help.show_keyboard_shortcuts(); | |
424 | return false; |
|
465 | return false; | |
@@ -426,6 +467,7 var IPython = (function (IPython) { | |||||
426 | }, |
|
467 | }, | |
427 | 'z' : { |
|
468 | 'z' : { | |
428 | help : 'undo last delete', |
|
469 | help : 'undo last delete', | |
|
470 | help_index : 'eh', | |||
429 | handler : function (event) { |
|
471 | handler : function (event) { | |
430 | IPython.notebook.undelete_cell(); |
|
472 | IPython.notebook.undelete_cell(); | |
431 | return false; |
|
473 | return false; | |
@@ -433,6 +475,7 var IPython = (function (IPython) { | |||||
433 | }, |
|
475 | }, | |
434 | 'shift+=' : { |
|
476 | 'shift+=' : { | |
435 | help : 'merge cell below', |
|
477 | help : 'merge cell below', | |
|
478 | help_index : 'ej', | |||
436 | handler : function (event) { |
|
479 | handler : function (event) { | |
437 | IPython.notebook.merge_cell_below(); |
|
480 | IPython.notebook.merge_cell_below(); | |
438 | return false; |
|
481 | return false; | |
@@ -450,8 +493,24 var IPython = (function (IPython) { | |||||
450 | ShortcutManager.prototype.help = function () { |
|
493 | ShortcutManager.prototype.help = function () { | |
451 | var help = []; |
|
494 | var help = []; | |
452 | for (var shortcut in this._shortcuts) { |
|
495 | for (var shortcut in this._shortcuts) { | |
453 |
|
|
496 | var help_string = this._shortcuts[shortcut]['help']; | |
|
497 | var help_index = this._shortcuts[shortcut]['help_index']; | |||
|
498 | if (help_string) { | |||
|
499 | help.push({ | |||
|
500 | shortcut: shortcut, | |||
|
501 | help: help_string, | |||
|
502 | help_index: help_index} | |||
|
503 | ); | |||
|
504 | } | |||
454 | } |
|
505 | } | |
|
506 | help.sort(function (a, b) { | |||
|
507 | if (a.help_index > b.help_index) | |||
|
508 | return 1; | |||
|
509 | if (a.help_index < b.help_index) | |||
|
510 | return -1; | |||
|
511 | return 0; | |||
|
512 | }); | |||
|
513 | console.log(help); | |||
455 | return help; |
|
514 | return help; | |
456 | } |
|
515 | } | |
457 |
|
516 | |||
@@ -489,6 +548,9 var IPython = (function (IPython) { | |||||
489 | } |
|
548 | } | |
490 |
|
549 | |||
491 | ShortcutManager.prototype.add_shortcut = function (shortcut, data) { |
|
550 | ShortcutManager.prototype.add_shortcut = function (shortcut, data) { | |
|
551 | if (typeof(data) === 'function') { | |||
|
552 | data = {help: '', handler: data} | |||
|
553 | } | |||
492 | shortcut = this.normalize_shortcut(shortcut); |
|
554 | shortcut = this.normalize_shortcut(shortcut); | |
493 | this._shortcuts[shortcut] = data; |
|
555 | this._shortcuts[shortcut] = data; | |
494 | } |
|
556 | } |
@@ -1345,6 +1345,7 var IPython = (function (IPython) { | |||||
1345 |
|
1345 | |||
1346 | cell.execute(); |
|
1346 | cell.execute(); | |
1347 | this.command_mode(); |
|
1347 | this.command_mode(); | |
|
1348 | cell.focus_cell(); | |||
1348 | this.set_dirty(true); |
|
1349 | this.set_dirty(true); | |
1349 | } |
|
1350 | } | |
1350 |
|
1351 |
@@ -26,6 +26,7 var IPython = (function (IPython) { | |||||
26 | var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help(); |
|
26 | var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help(); | |
27 | var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); |
|
27 | var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); | |
28 | var help, shortcut; |
|
28 | var help, shortcut; | |
|
29 | var i, half, n; | |||
29 | var element = $('<div/>'); |
|
30 | var element = $('<div/>'); | |
30 |
|
31 | |||
31 | // The documentation |
|
32 | // The documentation | |
@@ -35,39 +36,65 var IPython = (function (IPython) { | |||||
35 | ).append( |
|
36 | ).append( | |
36 | 'The IPython Notebook has two different keyboard input modes. <b>Edit mode</b> '+ |
|
37 | 'The IPython Notebook has two different keyboard input modes. <b>Edit mode</b> '+ | |
37 | 'allow you the type code/text into a cell and is indicated by a green cell '+ |
|
38 | 'allow you the type code/text into a cell and is indicated by a green cell '+ | |
38 |
'border. <b>Comm |
|
39 | 'border. <b>Command mode</b> binds the keyboard to notebook level actions '+ | |
39 |
'and is in |
|
40 | 'and is indicated by a grey cell border.' | |
40 | ) |
|
41 | ) | |
41 | element.append(doc); |
|
42 | element.append(doc); | |
42 |
|
43 | |||
43 | // Command mode |
|
44 | // Command mode | |
44 |
var cmd_div = $('<div/>'). |
|
45 | var cmd_div = $('<div/>').append($('<h4>Command Mode (press ESC to enable)</h4>')); | |
45 | element.append(cmd_div); |
|
46 | var cmd_sub_div = $('<div/>').addClass('hbox'); | |
46 | for (var i=0; i<command_shortcuts.length; i++) { |
|
47 | var cmd_col1 = $('<div/>').addClass('box-flex0'); | |
|
48 | var cmd_col2 = $('<div/>').addClass('box-flex0'); | |||
|
49 | n = command_shortcuts.length; | |||
|
50 | half = ~~(n/2); // Truncate :) | |||
|
51 | for (i=0; i<half; i++) { | |||
47 | help = command_shortcuts[i]['help']; |
|
52 | help = command_shortcuts[i]['help']; | |
48 | shortcut = command_shortcuts[i]['shortcut']; |
|
53 | shortcut = command_shortcuts[i]['shortcut']; | |
49 | if (help) { |
|
54 | cmd_col1.append($('<div>').addClass('quickhelp'). | |
50 |
|
|
55 | append($('<span/>').addClass('shortcut_key').html(shortcut)). | |
51 |
|
|
56 | append($('<span/>').addClass('shortcut_descr').html(' : ' + help)) | |
52 | append($('<span/>').addClass('shortcut_descr').html(' : ' + help)) |
|
57 | ); | |
53 | ); |
|
|||
54 | } |
|
|||
55 | }; |
|
58 | }; | |
|
59 | for (i=half; i<n; i++) { | |||
|
60 | help = command_shortcuts[i]['help']; | |||
|
61 | shortcut = command_shortcuts[i]['shortcut']; | |||
|
62 | cmd_col2.append($('<div>').addClass('quickhelp'). | |||
|
63 | append($('<span/>').addClass('shortcut_key').html(shortcut)). | |||
|
64 | append($('<span/>').addClass('shortcut_descr').html(' : ' + help)) | |||
|
65 | ); | |||
|
66 | }; | |||
|
67 | cmd_sub_div.append(cmd_col1).append(cmd_col2); | |||
|
68 | cmd_div.append(cmd_sub_div); | |||
|
69 | element.append(cmd_div); | |||
56 |
|
70 | |||
57 | // Edit mode |
|
71 | // Edit mode | |
58 |
var edit_div = $('<div/>'). |
|
72 | var edit_div = $('<div/>').append($('<h4>Edit Mode (press ENTER to enable)</h4>')); | |
59 | element.append(edit_div); |
|
73 | var edit_sub_div = $('<div/>').addClass('hbox'); | |
60 | for (var i=0; i<edit_shortcuts.length; i++) { |
|
74 | var edit_col1 = $('<div/>').addClass('box-flex0'); | |
|
75 | var edit_col2 = $('<div/>').addClass('box-flex0'); | |||
|
76 | n = edit_shortcuts.length; | |||
|
77 | half = ~~(n/2); // Truncate :) | |||
|
78 | for (i=0; i<half; i++) { | |||
61 | help = edit_shortcuts[i]['help']; |
|
79 | help = edit_shortcuts[i]['help']; | |
62 | shortcut = edit_shortcuts[i]['shortcut']; |
|
80 | shortcut = edit_shortcuts[i]['shortcut']; | |
63 | if (help) { |
|
81 | edit_col1.append($('<div>').addClass('quickhelp'). | |
64 |
|
|
82 | append($('<span/>').addClass('shortcut_key').html(shortcut)). | |
65 |
|
|
83 | append($('<span/>').addClass('shortcut_descr').html(' : ' + help)) | |
66 | append($('<span/>').addClass('shortcut_descr').html(' : ' + help)) |
|
84 | ); | |
67 |
|
|
85 | }; | |
68 | } |
|
86 | for (i=half; i<n; i++) { | |
|
87 | help = edit_shortcuts[i]['help']; | |||
|
88 | shortcut = edit_shortcuts[i]['shortcut']; | |||
|
89 | edit_col2.append($('<div>').addClass('quickhelp'). | |||
|
90 | append($('<span/>').addClass('shortcut_key').html(shortcut)). | |||
|
91 | append($('<span/>').addClass('shortcut_descr').html(' : ' + help)) | |||
|
92 | ); | |||
69 | }; |
|
93 | }; | |
70 |
|
94 | edit_sub_div.append(edit_col1).append(edit_col2); | ||
|
95 | edit_div.append(edit_sub_div); | |||
|
96 | element.append(edit_div); | |||
|
97 | ||||
71 | this.shortcut_dialog = IPython.dialog.modal({ |
|
98 | this.shortcut_dialog = IPython.dialog.modal({ | |
72 | title : "Keyboard shortcuts", |
|
99 | title : "Keyboard shortcuts", | |
73 | body : element, |
|
100 | body : element, |
@@ -9,7 +9,3 | |||||
9 | display: inline-block; |
|
9 | display: inline-block; | |
10 | } |
|
10 | } | |
11 |
|
11 | |||
12 | div.quickhelp { |
|
|||
13 | float: left; |
|
|||
14 | width: 50%; |
|
|||
15 | } |
|
@@ -1565,7 +1565,6 div#pager_splitter{height:8px;} | |||||
1565 | div#pager{overflow:auto;display:none;}div#pager pre{font-size:13px;line-height:1.231em;color:#000000;background-color:#f7f7f7;padding:0.4em;} |
|
1565 | div#pager{overflow:auto;display:none;}div#pager pre{font-size:13px;line-height:1.231em;color:#000000;background-color:#f7f7f7;padding:0.4em;} | |
1566 | .shortcut_key{display:inline-block;width:15ex;text-align:right;font-family:monospace;} |
|
1566 | .shortcut_key{display:inline-block;width:15ex;text-align:right;font-family:monospace;} | |
1567 | .shortcut_descr{display:inline-block;} |
|
1567 | .shortcut_descr{display:inline-block;} | |
1568 | div.quickhelp{float:left;width:50%;} |
|
|||
1569 | span#save_widget{padding:0px 5px;margin-top:12px;} |
|
1568 | span#save_widget{padding:0px 5px;margin-top:12px;} | |
1570 | span#checkpoint_status,span#autosave_status{font-size:small;} |
|
1569 | span#checkpoint_status,span#autosave_status{font-size:small;} | |
1571 | @media (max-width:767px){span#save_widget{font-size:small;} span#checkpoint_status,span#autosave_status{font-size:x-small;}}@media (max-width:767px){span#checkpoint_status,span#autosave_status{display:none;}}@media (min-width:768px) and (max-width:979px){span#checkpoint_status{display:none;} span#autosave_status{font-size:x-small;}}.toolbar{padding:0px 10px;margin-top:-5px;}.toolbar select,.toolbar label{width:auto;height:26px;vertical-align:middle;margin-right:2px;margin-bottom:0px;display:inline;font-size:92%;margin-left:0.3em;margin-right:0.3em;padding:0px;padding-top:3px;} |
|
1570 | @media (max-width:767px){span#save_widget{font-size:small;} span#checkpoint_status,span#autosave_status{font-size:x-small;}}@media (max-width:767px){span#checkpoint_status,span#autosave_status{display:none;}}@media (min-width:768px) and (max-width:979px){span#checkpoint_status{display:none;} span#autosave_status{font-size:x-small;}}.toolbar{padding:0px 10px;margin-top:-5px;}.toolbar select,.toolbar label{width:auto;height:26px;vertical-align:middle;margin-right:2px;margin-bottom:0px;display:inline;font-size:92%;margin-left:0.3em;margin-right:0.3em;padding:0px;padding-top:3px;} |
General Comments 0
You need to be logged in to leave comments.
Login now