Show More
@@ -1,73 +1,73 | |||
|
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 | // QuickHelp button |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var QuickHelp = function (selector) { |
|
15 | 15 | }; |
|
16 | 16 | |
|
17 | 17 | QuickHelp.prototype.show_keyboard_shortcuts = function () { |
|
18 | 18 | // toggles display of keyboard shortcut dialog |
|
19 | 19 | var that = this; |
|
20 | 20 | if ( this.shortcut_dialog ){ |
|
21 | 21 | // if dialog is already shown, close it |
|
22 | 22 | this.shortcut_dialog.dialog("close"); |
|
23 | 23 | this.shortcut_dialog = null; |
|
24 | 24 | return; |
|
25 | 25 | } |
|
26 | 26 | var dialog = $('<div/>'); |
|
27 | 27 | this.shortcut_dialog = dialog; |
|
28 | 28 | var shortcuts = [ |
|
29 | 29 | {key: 'Shift-Enter', help: 'run cell'}, |
|
30 | 30 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, |
|
31 | 31 | {key: 'Alt-Enter', help: 'run cell, insert below'}, |
|
32 | 32 | {key: 'Ctrl-m x', help: 'cut cell'}, |
|
33 | 33 | {key: 'Ctrl-m c', help: 'copy cell'}, |
|
34 | 34 | {key: 'Ctrl-m v', help: 'paste cell'}, |
|
35 | 35 | {key: 'Ctrl-m d', help: 'delete cell'}, |
|
36 | {key: 'Ctrl-m z', help: 'undo last cell deletion'}, | |
|
36 | 37 | {key: 'Ctrl-m a', help: 'insert cell above'}, |
|
37 | 38 | {key: 'Ctrl-m b', help: 'insert cell below'}, |
|
38 | 39 | {key: 'Ctrl-m o', help: 'toggle output'}, |
|
39 | 40 | {key: 'Ctrl-m O', help: 'toggle output scroll'}, |
|
40 | 41 | {key: 'Ctrl-m l', help: 'toggle line numbers'}, |
|
41 | 42 | {key: 'Ctrl-m s', help: 'save notebook'}, |
|
42 | 43 | {key: 'Ctrl-m j', help: 'move cell down'}, |
|
43 | 44 | {key: 'Ctrl-m k', help: 'move cell up'}, |
|
44 | 45 | {key: 'Ctrl-m y', help: 'code cell'}, |
|
45 | 46 | {key: 'Ctrl-m m', help: 'markdown cell'}, |
|
46 | 47 | {key: 'Ctrl-m t', help: 'raw cell'}, |
|
47 | 48 | {key: 'Ctrl-m 1-6', help: 'heading 1-6 cell'}, |
|
48 | 49 | {key: 'Ctrl-m p', help: 'select previous'}, |
|
49 | 50 | {key: 'Ctrl-m n', help: 'select next'}, |
|
50 | 51 | {key: 'Ctrl-m i', help: 'interrupt kernel'}, |
|
51 | 52 | {key: 'Ctrl-m .', help: 'restart kernel'}, |
|
52 |
{key: 'Ctrl-m h', help: 'show keyboard shortcuts'} |
|
|
53 | {key: 'Ctrl-m z', help: 'undo last cell deletion'} | |
|
53 | {key: 'Ctrl-m h', help: 'show keyboard shortcuts'} | |
|
54 | 54 | ]; |
|
55 | 55 | for (var i=0; i<shortcuts.length; i++) { |
|
56 | 56 | dialog.append($('<div>'). |
|
57 | 57 | append($('<span/>').addClass('shortcut_key').html(shortcuts[i].key)). |
|
58 | 58 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) |
|
59 | 59 | ); |
|
60 | 60 | }; |
|
61 | 61 | dialog.bind('dialogclose', function(event) { |
|
62 | 62 | // dialog has been closed, allow it to be drawn again. |
|
63 | 63 | that.shortcut_dialog = null; |
|
64 | 64 | }); |
|
65 | 65 | dialog.dialog({title: 'Keyboard shortcuts', closeText: ''}); |
|
66 | 66 | }; |
|
67 | 67 | |
|
68 | 68 | // Set module variables |
|
69 | 69 | IPython.QuickHelp = QuickHelp; |
|
70 | 70 | |
|
71 | 71 | return IPython; |
|
72 | 72 | |
|
73 | 73 | }(IPython)); |
General Comments 0
You need to be logged in to leave comments.
Login now