Show More
@@ -1,681 +1,683 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 | // Keyboard management |
|
9 | // Keyboard management | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 | "use strict"; |
|
13 | "use strict"; | |
14 |
|
14 | |||
15 | // Setup global keycodes and inverse keycodes. |
|
15 | // Setup global keycodes and inverse keycodes. | |
16 |
|
16 | |||
17 | // See http://unixpapa.com/js/key.html for a complete description. The short of |
|
17 | // See http://unixpapa.com/js/key.html for a complete description. The short of | |
18 | // it is that there are different keycode sets. Firefox uses the "Mozilla keycodes" |
|
18 | // it is that there are different keycode sets. Firefox uses the "Mozilla keycodes" | |
19 | // and Webkit/IE use the "IE keycodes". These keycode sets are mostly the same |
|
19 | // and Webkit/IE use the "IE keycodes". These keycode sets are mostly the same | |
20 | // but have minor differences. |
|
20 | // but have minor differences. | |
21 |
|
21 | |||
22 | // These apply to Firefox, (Webkit and IE) |
|
22 | // These apply to Firefox, (Webkit and IE) | |
23 | var _keycodes = { |
|
23 | var _keycodes = { | |
24 | 'a': 65, 'b': 66, 'c': 67, 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73, |
|
24 | 'a': 65, 'b': 66, 'c': 67, 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73, | |
25 | 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82, |
|
25 | 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82, | |
26 | 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, 'z': 90, |
|
26 | 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, 'z': 90, | |
27 | '1 !': 49, '2 @': 50, '3 #': 51, '4 $': 52, '5 %': 53, '6 ^': 54, |
|
27 | '1 !': 49, '2 @': 50, '3 #': 51, '4 $': 52, '5 %': 53, '6 ^': 54, | |
28 | '7 &': 55, '8 *': 56, '9 (': 57, '0 )': 48, |
|
28 | '7 &': 55, '8 *': 56, '9 (': 57, '0 )': 48, | |
29 | '[ {': 219, '] }': 221, '` ~': 192, ', <': 188, '. >': 190, '/ ?': 191, |
|
29 | '[ {': 219, '] }': 221, '` ~': 192, ', <': 188, '. >': 190, '/ ?': 191, | |
30 | '\\ |': 220, '\' "': 222, |
|
30 | '\\ |': 220, '\' "': 222, | |
31 | 'numpad0': 96, 'numpad1': 97, 'numpad2': 98, 'numpad3': 99, 'numpad4': 100, |
|
31 | 'numpad0': 96, 'numpad1': 97, 'numpad2': 98, 'numpad3': 99, 'numpad4': 100, | |
32 | 'numpad5': 101, 'numpad6': 102, 'numpad7': 103, 'numpad8': 104, 'numpad9': 105, |
|
32 | 'numpad5': 101, 'numpad6': 102, 'numpad7': 103, 'numpad8': 104, 'numpad9': 105, | |
33 | 'multiply': 106, 'add': 107, 'subtract': 109, 'decimal': 110, 'divide': 111, |
|
33 | 'multiply': 106, 'add': 107, 'subtract': 109, 'decimal': 110, 'divide': 111, | |
34 | 'f1': 112, 'f2': 113, 'f3': 114, 'f4': 115, 'f5': 116, 'f6': 117, 'f7': 118, |
|
34 | 'f1': 112, 'f2': 113, 'f3': 114, 'f4': 115, 'f5': 116, 'f6': 117, 'f7': 118, | |
35 | 'f8': 119, 'f9': 120, 'f11': 122, 'f12': 123, 'f13': 124, 'f14': 125, 'f15': 126, |
|
35 | 'f8': 119, 'f9': 120, 'f11': 122, 'f12': 123, 'f13': 124, 'f14': 125, 'f15': 126, | |
36 | 'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18, |
|
36 | 'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18, | |
37 | 'meta': 91, 'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34, |
|
37 | 'meta': 91, 'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34, | |
38 | 'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40, |
|
38 | 'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40, | |
39 | 'insert': 45, 'delete': 46, 'numlock': 144, |
|
39 | 'insert': 45, 'delete': 46, 'numlock': 144, | |
40 | }; |
|
40 | }; | |
41 |
|
41 | |||
42 | // These apply to Firefox and Opera |
|
42 | // These apply to Firefox and Opera | |
43 | var _mozilla_keycodes = { |
|
43 | var _mozilla_keycodes = { | |
44 | '; :': 59, '= +': 61, '- _': 173, 'meta': 224 |
|
44 | '; :': 59, '= +': 61, '- _': 173, 'meta': 224 | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | // This apply to Webkit and IE |
|
47 | // This apply to Webkit and IE | |
48 | var _ie_keycodes = { |
|
48 | var _ie_keycodes = { | |
49 | '; :': 186, '= +': 187, '- _': 189, |
|
49 | '; :': 186, '= +': 187, '- _': 189, | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | var browser = IPython.utils.browser[0]; |
|
52 | var browser = IPython.utils.browser[0]; | |
53 |
|
53 | |||
54 | if (browser === 'Firefox' || browser === 'Opera') { |
|
54 | if (browser === 'Firefox' || browser === 'Opera') { | |
55 | $.extend(_keycodes, _mozilla_keycodes); |
|
55 | $.extend(_keycodes, _mozilla_keycodes); | |
56 | } else if (browser === 'Safari' || browser === 'Chrome' || browser === 'MSIE') { |
|
56 | } else if (browser === 'Safari' || browser === 'Chrome' || browser === 'MSIE') { | |
57 | $.extend(_keycodes, _ie_keycodes); |
|
57 | $.extend(_keycodes, _ie_keycodes); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | var keycodes = {}; |
|
60 | var keycodes = {}; | |
61 | var inv_keycodes = {}; |
|
61 | var inv_keycodes = {}; | |
62 | for (var name in _keycodes) { |
|
62 | for (var name in _keycodes) { | |
63 | var names = name.split(' '); |
|
63 | var names = name.split(' '); | |
64 | if (names.length === 1) { |
|
64 | if (names.length === 1) { | |
65 | var n = names[0] |
|
65 | var n = names[0] | |
66 | keycodes[n] = _keycodes[n] |
|
66 | keycodes[n] = _keycodes[n] | |
67 | inv_keycodes[_keycodes[n]] = n |
|
67 | inv_keycodes[_keycodes[n]] = n | |
68 | } else { |
|
68 | } else { | |
69 | var primary = names[0]; |
|
69 | var primary = names[0]; | |
70 | var secondary = names[1]; |
|
70 | var secondary = names[1]; | |
71 | keycodes[primary] = _keycodes[name] |
|
71 | keycodes[primary] = _keycodes[name] | |
72 | keycodes[secondary] = _keycodes[name] |
|
72 | keycodes[secondary] = _keycodes[name] | |
73 | inv_keycodes[_keycodes[name]] = primary |
|
73 | inv_keycodes[_keycodes[name]] = primary | |
74 | } |
|
74 | } | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 |
|
77 | |||
78 | // Default keyboard shortcuts |
|
78 | // Default keyboard shortcuts | |
79 |
|
79 | |||
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 | help_index : 'fb', | |
84 | handler : function (event) { |
|
84 | handler : function (event) { | |
85 | IPython.notebook.save_checkpoint(); |
|
85 | IPython.notebook.save_checkpoint(); | |
86 | event.preventDefault(); |
|
86 | event.preventDefault(); | |
87 | return false; |
|
87 | return false; | |
88 | } |
|
88 | } | |
89 | }, |
|
89 | }, | |
90 | 'ctrl+s' : { |
|
90 | 'ctrl+s' : { | |
91 | help : 'save notebook', |
|
91 | help : 'save notebook', | |
92 | help_index : 'fc', |
|
92 | help_index : 'fc', | |
93 | handler : function (event) { |
|
93 | handler : function (event) { | |
94 | IPython.notebook.save_checkpoint(); |
|
94 | IPython.notebook.save_checkpoint(); | |
95 | event.preventDefault(); |
|
95 | event.preventDefault(); | |
96 | return false; |
|
96 | return false; | |
97 | } |
|
97 | } | |
98 | }, |
|
98 | }, | |
99 | 'shift' : { |
|
99 | 'shift' : { | |
100 | help : '', |
|
100 | help : '', | |
101 | help_index : '', |
|
101 | help_index : '', | |
102 | handler : function (event) { |
|
102 | handler : function (event) { | |
103 | // ignore shift keydown |
|
103 | // ignore shift keydown | |
104 | return true; |
|
104 | return true; | |
105 | } |
|
105 | } | |
106 | }, |
|
106 | }, | |
107 | 'shift+enter' : { |
|
107 | 'shift+enter' : { | |
108 | help : 'run cell', |
|
108 | help : 'run cell', | |
109 | help_index : 'ba', |
|
109 | help_index : 'ba', | |
110 | handler : function (event) { |
|
110 | handler : function (event) { | |
111 | IPython.notebook.execute_cell(); |
|
111 | IPython.notebook.execute_cell(); | |
112 | return false; |
|
112 | return false; | |
113 | } |
|
113 | } | |
114 | }, |
|
114 | }, | |
115 | 'ctrl+enter' : { |
|
115 | 'ctrl+enter' : { | |
116 | help : 'run cell, select below', |
|
116 | help : 'run cell, select below', | |
117 | help_index : 'bb', |
|
117 | help_index : 'bb', | |
118 | handler : function (event) { |
|
118 | handler : function (event) { | |
119 | IPython.notebook.execute_cell_and_select_below(); |
|
119 | IPython.notebook.execute_cell_and_select_below(); | |
120 | return false; |
|
120 | return false; | |
121 | } |
|
121 | } | |
122 | }, |
|
122 | }, | |
123 | 'alt+enter' : { |
|
123 | 'alt+enter' : { | |
124 | help : 'run cell, insert below', |
|
124 | help : 'run cell, insert below', | |
125 | help_index : 'bc', |
|
125 | help_index : 'bc', | |
126 | handler : function (event) { |
|
126 | handler : function (event) { | |
127 | IPython.notebook.execute_cell_and_insert_below(); |
|
127 | IPython.notebook.execute_cell_and_insert_below(); | |
128 | return false; |
|
128 | return false; | |
129 | } |
|
129 | } | |
130 | } |
|
130 | } | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | // Edit mode defaults |
|
133 | // Edit mode defaults | |
134 |
|
134 | |||
135 | var default_edit_shortcuts = { |
|
135 | var default_edit_shortcuts = { | |
136 | 'esc' : { |
|
136 | 'esc' : { | |
137 | help : 'command mode', |
|
137 | help : 'command mode', | |
138 | help_index : 'aa', |
|
138 | help_index : 'aa', | |
139 | handler : function (event) { |
|
139 | handler : function (event) { | |
140 | IPython.notebook.command_mode(); |
|
140 | IPython.notebook.command_mode(); | |
141 | IPython.notebook.focus_cell(); |
|
141 | IPython.notebook.focus_cell(); | |
142 | return false; |
|
142 | return false; | |
143 | } |
|
143 | } | |
144 | }, |
|
144 | }, | |
145 | 'ctrl+m' : { |
|
145 | 'ctrl+m' : { | |
146 | help : 'command mode', |
|
146 | help : 'command mode', | |
147 | help_index : 'ab', |
|
147 | help_index : 'ab', | |
148 | handler : function (event) { |
|
148 | handler : function (event) { | |
149 | IPython.notebook.command_mode(); |
|
149 | IPython.notebook.command_mode(); | |
150 | IPython.notebook.focus_cell(); |
|
150 | IPython.notebook.focus_cell(); | |
151 | return false; |
|
151 | return false; | |
152 | } |
|
152 | } | |
153 | }, |
|
153 | }, | |
154 | 'up' : { |
|
154 | 'up' : { | |
155 | help : '', |
|
155 | help : '', | |
156 | help_index : '', |
|
156 | help_index : '', | |
157 | handler : function (event) { |
|
157 | handler : function (event) { | |
158 | var cell = IPython.notebook.get_selected_cell(); |
|
158 | var cell = IPython.notebook.get_selected_cell(); | |
159 | if (cell && cell.at_top()) { |
|
159 | if (cell && cell.at_top()) { | |
160 | event.preventDefault(); |
|
160 | event.preventDefault(); | |
161 | IPython.notebook.command_mode() |
|
161 | IPython.notebook.command_mode() | |
162 | IPython.notebook.select_prev(); |
|
162 | IPython.notebook.select_prev(); | |
163 | IPython.notebook.edit_mode(); |
|
163 | IPython.notebook.edit_mode(); | |
164 | return false; |
|
164 | return false; | |
165 | }; |
|
165 | }; | |
166 | } |
|
166 | } | |
167 | }, |
|
167 | }, | |
168 | 'down' : { |
|
168 | 'down' : { | |
169 | help : '', |
|
169 | help : '', | |
170 | help_index : '', |
|
170 | help_index : '', | |
171 | handler : function (event) { |
|
171 | handler : function (event) { | |
172 | var cell = IPython.notebook.get_selected_cell(); |
|
172 | var cell = IPython.notebook.get_selected_cell(); | |
173 | if (cell && cell.at_bottom()) { |
|
173 | if (cell && cell.at_bottom()) { | |
174 | event.preventDefault(); |
|
174 | event.preventDefault(); | |
175 | IPython.notebook.command_mode() |
|
175 | IPython.notebook.command_mode() | |
176 | IPython.notebook.select_next(); |
|
176 | IPython.notebook.select_next(); | |
177 | IPython.notebook.edit_mode(); |
|
177 | IPython.notebook.edit_mode(); | |
178 | return false; |
|
178 | return false; | |
179 | }; |
|
179 | }; | |
180 | } |
|
180 | } | |
181 | }, |
|
181 | }, | |
182 | 'alt+-' : { |
|
182 | 'alt+-' : { | |
183 | help : 'split cell', |
|
183 | help : 'split cell', | |
184 | help_index : 'ea', |
|
184 | help_index : 'ea', | |
185 | handler : function (event) { |
|
185 | handler : function (event) { | |
186 | IPython.notebook.split_cell(); |
|
186 | IPython.notebook.split_cell(); | |
187 | return false; |
|
187 | return false; | |
188 | } |
|
188 | } | |
189 | }, |
|
189 | }, | |
190 | 'alt+subtract' : { |
|
190 | 'alt+subtract' : { | |
191 | help : '', |
|
191 | help : '', | |
192 | help_index : 'eb', |
|
192 | help_index : 'eb', | |
193 | handler : function (event) { |
|
193 | handler : function (event) { | |
194 | IPython.notebook.split_cell(); |
|
194 | IPython.notebook.split_cell(); | |
195 | return false; |
|
195 | return false; | |
196 | } |
|
196 | } | |
197 | }, |
|
197 | }, | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | // Command mode defaults |
|
200 | // Command mode defaults | |
201 |
|
201 | |||
202 | var default_command_shortcuts = { |
|
202 | var default_command_shortcuts = { | |
203 | 'enter' : { |
|
203 | 'enter' : { | |
204 | help : 'edit mode', |
|
204 | help : 'edit mode', | |
205 | help_index : 'aa', |
|
205 | help_index : 'aa', | |
206 | handler : function (event) { |
|
206 | handler : function (event) { | |
207 | IPython.notebook.edit_mode(); |
|
207 | IPython.notebook.edit_mode(); | |
208 | return false; |
|
208 | return false; | |
209 | } |
|
209 | } | |
210 | }, |
|
210 | }, | |
211 | 'up' : { |
|
211 | 'up' : { | |
212 | help : 'select previous cell', |
|
212 | help : 'select previous cell', | |
213 | help_index : 'da', |
|
213 | help_index : 'da', | |
214 | handler : function (event) { |
|
214 | handler : function (event) { | |
215 | var index = IPython.notebook.get_selected_index(); |
|
215 | var index = IPython.notebook.get_selected_index(); | |
216 | if (index !== 0 && index !== null) { |
|
216 | if (index !== 0 && index !== null) { | |
217 | IPython.notebook.select_prev(); |
|
217 | IPython.notebook.select_prev(); | |
218 | var cell = IPython.notebook.get_selected_cell(); |
|
218 | var cell = IPython.notebook.get_selected_cell(); | |
219 | cell.focus_cell(); |
|
219 | cell.focus_cell(); | |
220 | }; |
|
220 | }; | |
221 | return false; |
|
221 | return false; | |
222 | } |
|
222 | } | |
223 | }, |
|
223 | }, | |
224 | 'down' : { |
|
224 | 'down' : { | |
225 | help : 'select next cell', |
|
225 | help : 'select next cell', | |
226 | help_index : 'db', |
|
226 | help_index : 'db', | |
227 | handler : function (event) { |
|
227 | handler : function (event) { | |
228 | var index = IPython.notebook.get_selected_index(); |
|
228 | var index = IPython.notebook.get_selected_index(); | |
229 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { |
|
229 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { | |
230 | IPython.notebook.select_next(); |
|
230 | IPython.notebook.select_next(); | |
231 | var cell = IPython.notebook.get_selected_cell(); |
|
231 | var cell = IPython.notebook.get_selected_cell(); | |
232 | cell.focus_cell(); |
|
232 | cell.focus_cell(); | |
233 | }; |
|
233 | }; | |
234 | return false; |
|
234 | return false; | |
235 | } |
|
235 | } | |
236 | }, |
|
236 | }, | |
237 | 'k' : { |
|
237 | 'k' : { | |
238 | help : 'select previous cell', |
|
238 | help : 'select previous cell', | |
239 | help_index : 'dc', |
|
239 | help_index : 'dc', | |
240 | handler : function (event) { |
|
240 | handler : function (event) { | |
241 | var index = IPython.notebook.get_selected_index(); |
|
241 | var index = IPython.notebook.get_selected_index(); | |
242 | if (index !== 0 && index !== null) { |
|
242 | if (index !== 0 && index !== null) { | |
243 | IPython.notebook.select_prev(); |
|
243 | IPython.notebook.select_prev(); | |
244 | var cell = IPython.notebook.get_selected_cell(); |
|
244 | var cell = IPython.notebook.get_selected_cell(); | |
245 | cell.focus_cell(); |
|
245 | cell.focus_cell(); | |
246 | }; |
|
246 | }; | |
247 | return false; |
|
247 | return false; | |
248 | } |
|
248 | } | |
249 | }, |
|
249 | }, | |
250 | 'j' : { |
|
250 | 'j' : { | |
251 | help : 'select next cell', |
|
251 | help : 'select next cell', | |
252 | help_index : 'dd', |
|
252 | help_index : 'dd', | |
253 | handler : function (event) { |
|
253 | handler : function (event) { | |
254 | var index = IPython.notebook.get_selected_index(); |
|
254 | var index = IPython.notebook.get_selected_index(); | |
255 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { |
|
255 | if (index !== (IPython.notebook.ncells()-1) && index !== null) { | |
256 | IPython.notebook.select_next(); |
|
256 | IPython.notebook.select_next(); | |
257 | var cell = IPython.notebook.get_selected_cell(); |
|
257 | var cell = IPython.notebook.get_selected_cell(); | |
258 | cell.focus_cell(); |
|
258 | cell.focus_cell(); | |
259 | }; |
|
259 | }; | |
260 | return false; |
|
260 | return false; | |
261 | } |
|
261 | } | |
262 | }, |
|
262 | }, | |
263 | 'x' : { |
|
263 | 'x' : { | |
264 | help : 'cut cell', |
|
264 | help : 'cut cell', | |
265 | help_index : 'ee', |
|
265 | help_index : 'ee', | |
266 | handler : function (event) { |
|
266 | handler : function (event) { | |
267 | IPython.notebook.cut_cell(); |
|
267 | IPython.notebook.cut_cell(); | |
268 | return false; |
|
268 | return false; | |
269 | } |
|
269 | } | |
270 | }, |
|
270 | }, | |
271 | 'c' : { |
|
271 | 'c' : { | |
272 | help : 'copy cell', |
|
272 | help : 'copy cell', | |
273 | help_index : 'ef', |
|
273 | help_index : 'ef', | |
274 | handler : function (event) { |
|
274 | handler : function (event) { | |
275 | IPython.notebook.copy_cell(); |
|
275 | IPython.notebook.copy_cell(); | |
276 | return false; |
|
276 | return false; | |
277 | } |
|
277 | } | |
278 | }, |
|
278 | }, | |
279 | 'v' : { |
|
279 | 'v' : { | |
280 | help : 'paste cell below', |
|
280 | help : 'paste cell below', | |
281 | help_index : 'eg', |
|
281 | help_index : 'eg', | |
282 | handler : function (event) { |
|
282 | handler : function (event) { | |
283 | IPython.notebook.paste_cell_below(); |
|
283 | IPython.notebook.paste_cell_below(); | |
284 | return false; |
|
284 | return false; | |
285 | } |
|
285 | } | |
286 | }, |
|
286 | }, | |
287 | 'd' : { |
|
287 | 'd' : { | |
288 | help : 'delete cell (press twice)', |
|
288 | help : 'delete cell (press twice)', | |
289 | help_index : 'ei', |
|
289 | help_index : 'ei', | |
290 | handler : function (event) { |
|
290 | handler : function (event) { | |
291 | var dc = IPython.keyboard_manager._delete_count; |
|
291 | var dc = IPython.keyboard_manager._delete_count; | |
292 | if (dc === 0) { |
|
292 | if (dc === 0) { | |
293 | IPython.keyboard_manager._delete_count = 1; |
|
293 | IPython.keyboard_manager._delete_count = 1; | |
294 | setTimeout(function () { |
|
294 | setTimeout(function () { | |
295 | IPython.keyboard_manager._delete_count = 0; |
|
295 | IPython.keyboard_manager._delete_count = 0; | |
296 | }, 800); |
|
296 | }, 800); | |
297 | } else if (dc === 1) { |
|
297 | } else if (dc === 1) { | |
298 | IPython.notebook.delete_cell(); |
|
298 | IPython.notebook.delete_cell(); | |
299 | IPython.keyboard_manager._delete_count = 0; |
|
299 | IPython.keyboard_manager._delete_count = 0; | |
300 | } |
|
300 | } | |
301 | return false; |
|
301 | return false; | |
302 | } |
|
302 | } | |
303 | }, |
|
303 | }, | |
304 | 'a' : { |
|
304 | 'a' : { | |
305 | help : 'insert cell above', |
|
305 | help : 'insert cell above', | |
306 | help_index : 'ec', |
|
306 | help_index : 'ec', | |
307 | handler : function (event) { |
|
307 | handler : function (event) { | |
308 | IPython.notebook.insert_cell_above('code'); |
|
308 | IPython.notebook.insert_cell_above('code'); | |
309 | IPython.notebook.select_prev(); |
|
309 | IPython.notebook.select_prev(); | |
310 | IPython.notebook.focus_cell(); |
|
310 | IPython.notebook.focus_cell(); | |
311 | return false; |
|
311 | return false; | |
312 | } |
|
312 | } | |
313 | }, |
|
313 | }, | |
314 | 'b' : { |
|
314 | 'b' : { | |
315 | help : 'insert cell below', |
|
315 | help : 'insert cell below', | |
316 | help_index : 'ed', |
|
316 | help_index : 'ed', | |
317 | handler : function (event) { |
|
317 | handler : function (event) { | |
318 | IPython.notebook.insert_cell_below('code'); |
|
318 | IPython.notebook.insert_cell_below('code'); | |
319 | IPython.notebook.select_next(); |
|
319 | IPython.notebook.select_next(); | |
320 | IPython.notebook.focus_cell(); |
|
320 | IPython.notebook.focus_cell(); | |
321 | return false; |
|
321 | return false; | |
322 | } |
|
322 | } | |
323 | }, |
|
323 | }, | |
324 | 'y' : { |
|
324 | 'y' : { | |
325 | help : 'to code', |
|
325 | help : 'to code', | |
326 | help_index : 'ca', |
|
326 | help_index : 'ca', | |
327 | handler : function (event) { |
|
327 | handler : function (event) { | |
328 | IPython.notebook.to_code(); |
|
328 | IPython.notebook.to_code(); | |
329 | return false; |
|
329 | return false; | |
330 | } |
|
330 | } | |
331 | }, |
|
331 | }, | |
332 | 'm' : { |
|
332 | 'm' : { | |
333 | help : 'to markdown', |
|
333 | help : 'to markdown', | |
334 | help_index : 'cb', |
|
334 | help_index : 'cb', | |
335 | handler : function (event) { |
|
335 | handler : function (event) { | |
336 | IPython.notebook.to_markdown(); |
|
336 | IPython.notebook.to_markdown(); | |
337 | return false; |
|
337 | return false; | |
338 | } |
|
338 | } | |
339 | }, |
|
339 | }, | |
340 | 't' : { |
|
340 | 't' : { | |
341 | help : 'to raw', |
|
341 | help : 'to raw', | |
342 | help_index : 'cc', |
|
342 | help_index : 'cc', | |
343 | handler : function (event) { |
|
343 | handler : function (event) { | |
344 | IPython.notebook.to_raw(); |
|
344 | IPython.notebook.to_raw(); | |
345 | return false; |
|
345 | return false; | |
346 | } |
|
346 | } | |
347 | }, |
|
347 | }, | |
348 | '1' : { |
|
348 | '1' : { | |
349 | help : 'to heading 1', |
|
349 | help : 'to heading 1', | |
350 | help_index : 'cd', |
|
350 | help_index : 'cd', | |
351 | handler : function (event) { |
|
351 | handler : function (event) { | |
352 | IPython.notebook.to_heading(undefined, 1); |
|
352 | IPython.notebook.to_heading(undefined, 1); | |
353 | return false; |
|
353 | return false; | |
354 | } |
|
354 | } | |
355 | }, |
|
355 | }, | |
356 | '2' : { |
|
356 | '2' : { | |
357 | help : 'to heading 2', |
|
357 | help : 'to heading 2', | |
358 | help_index : 'ce', |
|
358 | help_index : 'ce', | |
359 | handler : function (event) { |
|
359 | handler : function (event) { | |
360 | IPython.notebook.to_heading(undefined, 2); |
|
360 | IPython.notebook.to_heading(undefined, 2); | |
361 | return false; |
|
361 | return false; | |
362 | } |
|
362 | } | |
363 | }, |
|
363 | }, | |
364 | '3' : { |
|
364 | '3' : { | |
365 | help : 'to heading 3', |
|
365 | help : 'to heading 3', | |
366 | help_index : 'cf', |
|
366 | help_index : 'cf', | |
367 | handler : function (event) { |
|
367 | handler : function (event) { | |
368 | IPython.notebook.to_heading(undefined, 3); |
|
368 | IPython.notebook.to_heading(undefined, 3); | |
369 | return false; |
|
369 | return false; | |
370 | } |
|
370 | } | |
371 | }, |
|
371 | }, | |
372 | '4' : { |
|
372 | '4' : { | |
373 | help : 'to heading 4', |
|
373 | help : 'to heading 4', | |
374 | help_index : 'cg', |
|
374 | help_index : 'cg', | |
375 | handler : function (event) { |
|
375 | handler : function (event) { | |
376 | IPython.notebook.to_heading(undefined, 4); |
|
376 | IPython.notebook.to_heading(undefined, 4); | |
377 | return false; |
|
377 | return false; | |
378 | } |
|
378 | } | |
379 | }, |
|
379 | }, | |
380 | '5' : { |
|
380 | '5' : { | |
381 | help : 'to heading 5', |
|
381 | help : 'to heading 5', | |
382 | help_index : 'ch', |
|
382 | help_index : 'ch', | |
383 | handler : function (event) { |
|
383 | handler : function (event) { | |
384 | IPython.notebook.to_heading(undefined, 5); |
|
384 | IPython.notebook.to_heading(undefined, 5); | |
385 | return false; |
|
385 | return false; | |
386 | } |
|
386 | } | |
387 | }, |
|
387 | }, | |
388 | '6' : { |
|
388 | '6' : { | |
389 | help : 'to heading 6', |
|
389 | help : 'to heading 6', | |
390 | help_index : 'ci', |
|
390 | help_index : 'ci', | |
391 | handler : function (event) { |
|
391 | handler : function (event) { | |
392 | IPython.notebook.to_heading(undefined, 6); |
|
392 | IPython.notebook.to_heading(undefined, 6); | |
393 | return false; |
|
393 | return false; | |
394 | } |
|
394 | } | |
395 | }, |
|
395 | }, | |
396 | 'o' : { |
|
396 | 'o' : { | |
397 | help : 'toggle output', |
|
397 | help : 'toggle output', | |
398 | help_index : 'gb', |
|
398 | help_index : 'gb', | |
399 | handler : function (event) { |
|
399 | handler : function (event) { | |
400 | IPython.notebook.toggle_output(); |
|
400 | IPython.notebook.toggle_output(); | |
401 | return false; |
|
401 | return false; | |
402 | } |
|
402 | } | |
403 | }, |
|
403 | }, | |
404 | 'shift+o' : { |
|
404 | 'shift+o' : { | |
405 | help : 'toggle output', |
|
405 | help : 'toggle output', | |
406 | help_index : 'gc', |
|
406 | help_index : 'gc', | |
407 | handler : function (event) { |
|
407 | handler : function (event) { | |
408 | IPython.notebook.toggle_output_scroll(); |
|
408 | IPython.notebook.toggle_output_scroll(); | |
409 | return false; |
|
409 | return false; | |
410 | } |
|
410 | } | |
411 | }, |
|
411 | }, | |
412 | 's' : { |
|
412 | 's' : { | |
413 | help : 'save notebook', |
|
413 | help : 'save notebook', | |
414 | help_index : 'fa', |
|
414 | help_index : 'fa', | |
415 | handler : function (event) { |
|
415 | handler : function (event) { | |
416 | IPython.notebook.save_checkpoint(); |
|
416 | IPython.notebook.save_checkpoint(); | |
417 | return false; |
|
417 | return false; | |
418 | } |
|
418 | } | |
419 | }, |
|
419 | }, | |
420 | 'ctrl+j' : { |
|
420 | 'ctrl+j' : { | |
421 | help : 'move cell down', |
|
421 | help : 'move cell down', | |
422 | help_index : 'eb', |
|
422 | help_index : 'eb', | |
423 | handler : function (event) { |
|
423 | handler : function (event) { | |
424 | IPython.notebook.move_cell_down(); |
|
424 | IPython.notebook.move_cell_down(); | |
425 | return false; |
|
425 | return false; | |
426 | } |
|
426 | } | |
427 | }, |
|
427 | }, | |
428 | 'ctrl+k' : { |
|
428 | 'ctrl+k' : { | |
429 | help : 'move cell up', |
|
429 | help : 'move cell up', | |
430 | help_index : 'ea', |
|
430 | help_index : 'ea', | |
431 | handler : function (event) { |
|
431 | handler : function (event) { | |
432 | IPython.notebook.move_cell_up(); |
|
432 | IPython.notebook.move_cell_up(); | |
433 | return false; |
|
433 | return false; | |
434 | } |
|
434 | } | |
435 | }, |
|
435 | }, | |
436 | 'l' : { |
|
436 | 'l' : { | |
437 | help : 'toggle line numbers', |
|
437 | help : 'toggle line numbers', | |
438 | help_index : 'ga', |
|
438 | help_index : 'ga', | |
439 | handler : function (event) { |
|
439 | handler : function (event) { | |
440 | IPython.notebook.cell_toggle_line_numbers(); |
|
440 | IPython.notebook.cell_toggle_line_numbers(); | |
441 | return false; |
|
441 | return false; | |
442 | } |
|
442 | } | |
443 | }, |
|
443 | }, | |
444 | 'i' : { |
|
444 | 'i' : { | |
445 | help : 'interrupt kernel', |
|
445 | help : 'interrupt kernel', | |
446 | help_index : 'ha', |
|
446 | help_index : 'ha', | |
447 | handler : function (event) { |
|
447 | handler : function (event) { | |
448 | IPython.notebook.kernel.interrupt(); |
|
448 | IPython.notebook.kernel.interrupt(); | |
449 | return false; |
|
449 | return false; | |
450 | } |
|
450 | } | |
451 | }, |
|
451 | }, | |
452 | '.' : { |
|
452 | '.' : { | |
453 | help : 'restart kernel', |
|
453 | help : 'restart kernel', | |
454 | help_index : 'hb', |
|
454 | help_index : 'hb', | |
455 | handler : function (event) { |
|
455 | handler : function (event) { | |
456 | IPython.notebook.restart_kernel(); |
|
456 | IPython.notebook.restart_kernel(); | |
457 | return false; |
|
457 | return false; | |
458 | } |
|
458 | } | |
459 | }, |
|
459 | }, | |
460 | 'h' : { |
|
460 | 'h' : { | |
461 | help : 'keyboard shortcuts', |
|
461 | help : 'keyboard shortcuts', | |
462 | help_index : 'gd', |
|
462 | help_index : 'gd', | |
463 | handler : function (event) { |
|
463 | handler : function (event) { | |
464 | IPython.quick_help.show_keyboard_shortcuts(); |
|
464 | IPython.quick_help.show_keyboard_shortcuts(); | |
465 | return false; |
|
465 | return false; | |
466 | } |
|
466 | } | |
467 | }, |
|
467 | }, | |
468 | 'z' : { |
|
468 | 'z' : { | |
469 | help : 'undo last delete', |
|
469 | help : 'undo last delete', | |
470 | help_index : 'eh', |
|
470 | help_index : 'eh', | |
471 | handler : function (event) { |
|
471 | handler : function (event) { | |
472 | IPython.notebook.undelete_cell(); |
|
472 | IPython.notebook.undelete_cell(); | |
473 | return false; |
|
473 | return false; | |
474 | } |
|
474 | } | |
475 | }, |
|
475 | }, | |
476 | 'shift+=' : { |
|
476 | 'shift+=' : { | |
477 | help : 'merge cell below', |
|
477 | help : 'merge cell below', | |
478 | help_index : 'ej', |
|
478 | help_index : 'ej', | |
479 | handler : function (event) { |
|
479 | handler : function (event) { | |
480 | IPython.notebook.merge_cell_below(); |
|
480 | IPython.notebook.merge_cell_below(); | |
481 | return false; |
|
481 | return false; | |
482 | } |
|
482 | } | |
483 | }, |
|
483 | }, | |
484 | } |
|
484 | } | |
485 |
|
485 | |||
486 |
|
486 | |||
487 | // Shortcut manager class |
|
487 | // Shortcut manager class | |
488 |
|
488 | |||
489 | var ShortcutManager = function () { |
|
489 | var ShortcutManager = function () { | |
490 | this._shortcuts = {} |
|
490 | this._shortcuts = {} | |
491 | } |
|
491 | } | |
492 |
|
492 | |||
493 | ShortcutManager.prototype.help = function () { |
|
493 | ShortcutManager.prototype.help = function () { | |
494 | var help = []; |
|
494 | var help = []; | |
495 | for (var shortcut in this._shortcuts) { |
|
495 | for (var shortcut in this._shortcuts) { | |
496 | var help_string = this._shortcuts[shortcut]['help']; |
|
496 | var help_string = this._shortcuts[shortcut]['help']; | |
497 | var help_index = this._shortcuts[shortcut]['help_index']; |
|
497 | var help_index = this._shortcuts[shortcut]['help_index']; | |
498 | if (help_string) { |
|
498 | if (help_string) { | |
499 | help.push({ |
|
499 | help.push({ | |
500 | shortcut: shortcut, |
|
500 | shortcut: shortcut, | |
501 | help: help_string, |
|
501 | help: help_string, | |
502 | help_index: help_index} |
|
502 | help_index: help_index} | |
503 | ); |
|
503 | ); | |
504 | } |
|
504 | } | |
505 | } |
|
505 | } | |
506 | help.sort(function (a, b) { |
|
506 | help.sort(function (a, b) { | |
507 | if (a.help_index > b.help_index) |
|
507 | if (a.help_index > b.help_index) | |
508 | return 1; |
|
508 | return 1; | |
509 | if (a.help_index < b.help_index) |
|
509 | if (a.help_index < b.help_index) | |
510 | return -1; |
|
510 | return -1; | |
511 | return 0; |
|
511 | return 0; | |
512 | }); |
|
512 | }); | |
513 | return help; |
|
513 | return help; | |
514 | } |
|
514 | } | |
515 |
|
515 | |||
516 | ShortcutManager.prototype.normalize_key = function (key) { |
|
516 | ShortcutManager.prototype.normalize_key = function (key) { | |
517 | return inv_keycodes[keycodes[key]]; |
|
517 | return inv_keycodes[keycodes[key]]; | |
518 | } |
|
518 | } | |
519 |
|
519 | |||
520 | ShortcutManager.prototype.normalize_shortcut = function (shortcut) { |
|
520 | ShortcutManager.prototype.normalize_shortcut = function (shortcut) { | |
521 | // Sort a sequence of + separated modifiers into the order alt+ctrl+meta+shift |
|
521 | // Sort a sequence of + separated modifiers into the order alt+ctrl+meta+shift | |
522 | var values = shortcut.split("+"); |
|
522 | var values = shortcut.split("+"); | |
523 | if (values.length === 1) { |
|
523 | if (values.length === 1) { | |
524 | return this.normalize_key(values[0]) |
|
524 | return this.normalize_key(values[0]) | |
525 | } else { |
|
525 | } else { | |
526 | var modifiers = values.slice(0,-1); |
|
526 | var modifiers = values.slice(0,-1); | |
527 | var key = this.normalize_key(values[values.length-1]); |
|
527 | var key = this.normalize_key(values[values.length-1]); | |
528 | modifiers.sort(); |
|
528 | modifiers.sort(); | |
529 | return modifiers.join('+') + '+' + key; |
|
529 | return modifiers.join('+') + '+' + key; | |
530 | } |
|
530 | } | |
531 | } |
|
531 | } | |
532 |
|
532 | |||
533 | ShortcutManager.prototype.event_to_shortcut = function (event) { |
|
533 | ShortcutManager.prototype.event_to_shortcut = function (event) { | |
534 | // Convert a jQuery keyboard event to a strong based keyboard shortcut |
|
534 | // Convert a jQuery keyboard event to a strong based keyboard shortcut | |
535 | var shortcut = ''; |
|
535 | var shortcut = ''; | |
536 | var key = inv_keycodes[event.which] |
|
536 | var key = inv_keycodes[event.which] | |
537 | if (event.altKey && key !== 'alt') {shortcut += 'alt+';} |
|
537 | if (event.altKey && key !== 'alt') {shortcut += 'alt+';} | |
538 | if (event.ctrlKey && key !== 'ctrl') {shortcut += 'ctrl+';} |
|
538 | if (event.ctrlKey && key !== 'ctrl') {shortcut += 'ctrl+';} | |
539 | if (event.metaKey && key !== 'meta') {shortcut += 'meta+';} |
|
539 | if (event.metaKey && key !== 'meta') {shortcut += 'meta+';} | |
540 | if (event.shiftKey && key !== 'shift') {shortcut += 'shift+';} |
|
540 | if (event.shiftKey && key !== 'shift') {shortcut += 'shift+';} | |
541 | shortcut += key; |
|
541 | shortcut += key; | |
542 | return shortcut |
|
542 | return shortcut | |
543 | } |
|
543 | } | |
544 |
|
544 | |||
545 | ShortcutManager.prototype.clear_shortcuts = function () { |
|
545 | ShortcutManager.prototype.clear_shortcuts = function () { | |
546 | this._shortcuts = {}; |
|
546 | this._shortcuts = {}; | |
547 | } |
|
547 | } | |
548 |
|
548 | |||
549 | ShortcutManager.prototype.add_shortcut = function (shortcut, data) { |
|
549 | ShortcutManager.prototype.add_shortcut = function (shortcut, data) { | |
550 | if (typeof(data) === 'function') { |
|
550 | if (typeof(data) === 'function') { | |
551 | data = {help: '', help_index: '', handler: data} |
|
551 | data = {help: '', help_index: '', handler: data} | |
552 | } |
|
552 | } | |
|
553 | data.help_index = data.help_index || ''; | |||
|
554 | data.help = data.help || ''; | |||
553 | if (data.help_index === '') { |
|
555 | if (data.help_index === '') { | |
554 |
data.help_index = 'zz' |
|
556 | data.help_index = 'zz'; | |
555 | } |
|
557 | } | |
556 | shortcut = this.normalize_shortcut(shortcut); |
|
558 | shortcut = this.normalize_shortcut(shortcut); | |
557 | this._shortcuts[shortcut] = data; |
|
559 | this._shortcuts[shortcut] = data; | |
558 | } |
|
560 | } | |
559 |
|
561 | |||
560 | ShortcutManager.prototype.add_shortcuts = function (data) { |
|
562 | ShortcutManager.prototype.add_shortcuts = function (data) { | |
561 | for (var shortcut in data) { |
|
563 | for (var shortcut in data) { | |
562 | this.add_shortcut(shortcut, data[shortcut]); |
|
564 | this.add_shortcut(shortcut, data[shortcut]); | |
563 | } |
|
565 | } | |
564 | } |
|
566 | } | |
565 |
|
567 | |||
566 | ShortcutManager.prototype.remove_shortcut = function (shortcut) { |
|
568 | ShortcutManager.prototype.remove_shortcut = function (shortcut) { | |
567 | shortcut = this.normalize_shortcut(shortcut); |
|
569 | shortcut = this.normalize_shortcut(shortcut); | |
568 | delete this._shortcuts[shortcut]; |
|
570 | delete this._shortcuts[shortcut]; | |
569 | } |
|
571 | } | |
570 |
|
572 | |||
571 | ShortcutManager.prototype.call_handler = function (event) { |
|
573 | ShortcutManager.prototype.call_handler = function (event) { | |
572 | var shortcut = this.event_to_shortcut(event); |
|
574 | var shortcut = this.event_to_shortcut(event); | |
573 | var data = this._shortcuts[shortcut]; |
|
575 | var data = this._shortcuts[shortcut]; | |
574 | if (data !== undefined) { |
|
576 | if (data !== undefined) { | |
575 | var handler = data['handler']; |
|
577 | var handler = data['handler']; | |
576 | if (handler !== undefined) { |
|
578 | if (handler !== undefined) { | |
577 | return handler(event); |
|
579 | return handler(event); | |
578 | } |
|
580 | } | |
579 | } |
|
581 | } | |
580 | return true; |
|
582 | return true; | |
581 | } |
|
583 | } | |
582 |
|
584 | |||
583 |
|
585 | |||
584 |
|
586 | |||
585 | // Main keyboard manager for the notebook |
|
587 | // Main keyboard manager for the notebook | |
586 |
|
588 | |||
587 | var KeyboardManager = function () { |
|
589 | var KeyboardManager = function () { | |
588 | this.mode = 'command'; |
|
590 | this.mode = 'command'; | |
589 | this.enabled = true; |
|
591 | this.enabled = true; | |
590 | this._delete_count = 0; |
|
592 | this._delete_count = 0; | |
591 | this.bind_events(); |
|
593 | this.bind_events(); | |
592 | this.command_shortcuts = new ShortcutManager(); |
|
594 | this.command_shortcuts = new ShortcutManager(); | |
593 | this.command_shortcuts.add_shortcuts(default_common_shortcuts); |
|
595 | this.command_shortcuts.add_shortcuts(default_common_shortcuts); | |
594 | this.command_shortcuts.add_shortcuts(default_command_shortcuts); |
|
596 | this.command_shortcuts.add_shortcuts(default_command_shortcuts); | |
595 | this.edit_shortcuts = new ShortcutManager(); |
|
597 | this.edit_shortcuts = new ShortcutManager(); | |
596 | this.edit_shortcuts.add_shortcuts(default_common_shortcuts); |
|
598 | this.edit_shortcuts.add_shortcuts(default_common_shortcuts); | |
597 | this.edit_shortcuts.add_shortcuts(default_edit_shortcuts); |
|
599 | this.edit_shortcuts.add_shortcuts(default_edit_shortcuts); | |
598 | }; |
|
600 | }; | |
599 |
|
601 | |||
600 | KeyboardManager.prototype.bind_events = function () { |
|
602 | KeyboardManager.prototype.bind_events = function () { | |
601 | var that = this; |
|
603 | var that = this; | |
602 | $(document).keydown(function (event) { |
|
604 | $(document).keydown(function (event) { | |
603 | return that.handle_keydown(event); |
|
605 | return that.handle_keydown(event); | |
604 | }); |
|
606 | }); | |
605 | }; |
|
607 | }; | |
606 |
|
608 | |||
607 | KeyboardManager.prototype.handle_keydown = function (event) { |
|
609 | KeyboardManager.prototype.handle_keydown = function (event) { | |
608 | var notebook = IPython.notebook; |
|
610 | var notebook = IPython.notebook; | |
609 |
|
611 | |||
610 | if (event.which === keycodes['esc']) { |
|
612 | if (event.which === keycodes['esc']) { | |
611 | // Intercept escape at highest level to avoid closing |
|
613 | // Intercept escape at highest level to avoid closing | |
612 | // websocket connection with firefox |
|
614 | // websocket connection with firefox | |
613 | event.preventDefault(); |
|
615 | event.preventDefault(); | |
614 | } |
|
616 | } | |
615 |
|
617 | |||
616 | if (!this.enabled) { |
|
618 | if (!this.enabled) { | |
617 | if (event.which === keycodes['esc']) { |
|
619 | if (event.which === keycodes['esc']) { | |
618 | // ESC |
|
620 | // ESC | |
619 | notebook.command_mode(); |
|
621 | notebook.command_mode(); | |
620 | return false; |
|
622 | return false; | |
621 | } |
|
623 | } | |
622 | return true; |
|
624 | return true; | |
623 | } |
|
625 | } | |
624 |
|
626 | |||
625 | if (this.mode === 'edit') { |
|
627 | if (this.mode === 'edit') { | |
626 | return this.edit_shortcuts.call_handler(event); |
|
628 | return this.edit_shortcuts.call_handler(event); | |
627 | } else if (this.mode === 'command') { |
|
629 | } else if (this.mode === 'command') { | |
628 | return this.command_shortcuts.call_handler(event); |
|
630 | return this.command_shortcuts.call_handler(event); | |
629 | } |
|
631 | } | |
630 | return true; |
|
632 | return true; | |
631 | } |
|
633 | } | |
632 |
|
634 | |||
633 | KeyboardManager.prototype.edit_mode = function () { |
|
635 | KeyboardManager.prototype.edit_mode = function () { | |
634 | this.last_mode = this.mode; |
|
636 | this.last_mode = this.mode; | |
635 | this.mode = 'edit'; |
|
637 | this.mode = 'edit'; | |
636 | } |
|
638 | } | |
637 |
|
639 | |||
638 | KeyboardManager.prototype.command_mode = function () { |
|
640 | KeyboardManager.prototype.command_mode = function () { | |
639 | this.last_mode = this.mode; |
|
641 | this.last_mode = this.mode; | |
640 | this.mode = 'command'; |
|
642 | this.mode = 'command'; | |
641 | } |
|
643 | } | |
642 |
|
644 | |||
643 | KeyboardManager.prototype.enable = function () { |
|
645 | KeyboardManager.prototype.enable = function () { | |
644 | this.enabled = true; |
|
646 | this.enabled = true; | |
645 | } |
|
647 | } | |
646 |
|
648 | |||
647 | KeyboardManager.prototype.disable = function () { |
|
649 | KeyboardManager.prototype.disable = function () { | |
648 | this.enabled = false; |
|
650 | this.enabled = false; | |
649 | } |
|
651 | } | |
650 |
|
652 | |||
651 | KeyboardManager.prototype.register_events = function (e) { |
|
653 | KeyboardManager.prototype.register_events = function (e) { | |
652 | var that = this; |
|
654 | var that = this; | |
653 | e.on('focusin', function () { |
|
655 | e.on('focusin', function () { | |
654 | that.command_mode(); |
|
656 | that.command_mode(); | |
655 | that.disable(); |
|
657 | that.disable(); | |
656 | }); |
|
658 | }); | |
657 | e.on('focusout', function () { |
|
659 | e.on('focusout', function () { | |
658 | that.command_mode(); |
|
660 | that.command_mode(); | |
659 | that.enable(); |
|
661 | that.enable(); | |
660 | }); |
|
662 | }); | |
661 | // There are times (raw_input) where we remove the element from the DOM before |
|
663 | // There are times (raw_input) where we remove the element from the DOM before | |
662 | // focusout is called. In this case we bind to the remove event of jQueryUI, |
|
664 | // focusout is called. In this case we bind to the remove event of jQueryUI, | |
663 | // which gets triggered upon removal. |
|
665 | // which gets triggered upon removal. | |
664 | e.on('remove', function () { |
|
666 | e.on('remove', function () { | |
665 | that.command_mode(); |
|
667 | that.command_mode(); | |
666 | that.enable(); |
|
668 | that.enable(); | |
667 | }); |
|
669 | }); | |
668 | } |
|
670 | } | |
669 |
|
671 | |||
670 |
|
672 | |||
671 | IPython.keycodes = keycodes; |
|
673 | IPython.keycodes = keycodes; | |
672 | IPython.inv_keycodes = inv_keycodes; |
|
674 | IPython.inv_keycodes = inv_keycodes; | |
673 | IPython.default_common_shortcuts = default_common_shortcuts; |
|
675 | IPython.default_common_shortcuts = default_common_shortcuts; | |
674 | IPython.default_edit_shortcuts = default_edit_shortcuts; |
|
676 | IPython.default_edit_shortcuts = default_edit_shortcuts; | |
675 | IPython.default_command_shortcuts = default_command_shortcuts; |
|
677 | IPython.default_command_shortcuts = default_command_shortcuts; | |
676 | IPython.ShortcutManager = ShortcutManager; |
|
678 | IPython.ShortcutManager = ShortcutManager; | |
677 | IPython.KeyboardManager = KeyboardManager; |
|
679 | IPython.KeyboardManager = KeyboardManager; | |
678 |
|
680 | |||
679 | return IPython; |
|
681 | return IPython; | |
680 |
|
682 | |||
681 | }(IPython)); |
|
683 | }(IPython)); |
@@ -1,378 +1,421 b'' | |||||
1 | { |
|
1 | { | |
2 | "metadata": { |
|
2 | "metadata": { | |
3 | "name": "" |
|
3 | "name": "" | |
4 | }, |
|
4 | }, | |
5 | "nbformat": 3, |
|
5 | "nbformat": 3, | |
6 | "nbformat_minor": 0, |
|
6 | "nbformat_minor": 0, | |
7 | "worksheets": [ |
|
7 | "worksheets": [ | |
8 | { |
|
8 | { | |
9 | "cells": [ |
|
9 | "cells": [ | |
10 | { |
|
10 | { | |
11 | "cell_type": "heading", |
|
11 | "cell_type": "heading", | |
12 | "level": 1, |
|
12 | "level": 1, | |
13 | "metadata": {}, |
|
13 | "metadata": {}, | |
14 | "source": [ |
|
14 | "source": [ | |
15 |
"User |
|
15 | "User Interface" | |
16 | ] |
|
16 | ] | |
17 | }, |
|
17 | }, | |
18 | { |
|
18 | { | |
19 | "cell_type": "markdown", |
|
19 | "cell_type": "markdown", | |
20 | "metadata": {}, |
|
20 | "metadata": {}, | |
21 | "source": [ |
|
21 | "source": [ | |
22 |
"This notebook describes the user |
|
22 | "This notebook describes the user interface of the IPython Notebook. This includes both mouse and keyboard based navigation and interaction.\n", | |
23 | "\n", |
|
23 | "\n", | |
24 | "<div class=\"alert\" style=\"margin: 10px\">\n", |
|
24 | "<div class=\"alert\" style=\"margin: 10px\">\n", | |
25 |
"As of IPython 2.0, the user |
|
25 | "As of IPython 2.0, the user interface has changed significantly. Because of this we highly recommend existing users to review this information after upgrading to IPython 2.0. All new users of IPython should review this information as well.\n", | |
26 | "</div>" |
|
26 | "</div>" | |
27 | ] |
|
27 | ] | |
28 | }, |
|
28 | }, | |
29 | { |
|
29 | { | |
30 | "cell_type": "heading", |
|
30 | "cell_type": "heading", | |
31 | "level": 2, |
|
31 | "level": 2, | |
32 | "metadata": {}, |
|
32 | "metadata": {}, | |
33 | "source": [ |
|
33 | "source": [ | |
34 | "Modal editor" |
|
34 | "Modal editor" | |
35 | ] |
|
35 | ] | |
36 | }, |
|
36 | }, | |
37 | { |
|
37 | { | |
38 | "cell_type": "markdown", |
|
38 | "cell_type": "markdown", | |
39 | "metadata": {}, |
|
39 | "metadata": {}, | |
40 | "source": [ |
|
40 | "source": [ | |
41 |
"Starting with IPython 2.0, the IPython Notebook has a modal user |
|
41 | "Starting with IPython 2.0, the IPython Notebook has a modal user interface. This means that the keyboard does different things depending on which mode the Notebook is in. There are two modes: edit mode and command mode." | |
42 | ] |
|
42 | ] | |
43 | }, |
|
43 | }, | |
44 | { |
|
44 | { | |
45 | "cell_type": "heading", |
|
45 | "cell_type": "heading", | |
46 | "level": 3, |
|
46 | "level": 3, | |
47 | "metadata": {}, |
|
47 | "metadata": {}, | |
48 | "source": [ |
|
48 | "source": [ | |
49 | "Edit mode" |
|
49 | "Edit mode" | |
50 | ] |
|
50 | ] | |
51 | }, |
|
51 | }, | |
52 | { |
|
52 | { | |
53 | "cell_type": "markdown", |
|
53 | "cell_type": "markdown", | |
54 | "metadata": {}, |
|
54 | "metadata": {}, | |
55 | "source": [ |
|
55 | "source": [ | |
56 | "Edit mode is indicated by a green cell border and a prompt showing in the editor area:\n", |
|
56 | "Edit mode is indicated by a green cell border and a prompt showing in the editor area:\n", | |
57 | "\n", |
|
57 | "\n", | |
58 | "<img src=\"images/edit_mode.png\">\n", |
|
58 | "<img src=\"images/edit_mode.png\">\n", | |
59 | "\n", |
|
59 | "\n", | |
60 | "When a cell is in edit mode, you can type into the cell, like a normal text editor.\n", |
|
60 | "When a cell is in edit mode, you can type into the cell, like a normal text editor.\n", | |
61 | "\n", |
|
61 | "\n", | |
62 | "<div class=\"alert alert-success\" style=\"margin: 10px\">\n", |
|
62 | "<div class=\"alert alert-success\" style=\"margin: 10px\">\n", | |
63 | "Enter edit mode by pressing `enter` or using the mouse to click on a cell's editor area.\n", |
|
63 | "Enter edit mode by pressing `enter` or using the mouse to click on a cell's editor area.\n", | |
64 | "</div>" |
|
64 | "</div>" | |
65 | ] |
|
65 | ] | |
66 | }, |
|
66 | }, | |
67 | { |
|
67 | { | |
68 | "cell_type": "heading", |
|
68 | "cell_type": "heading", | |
69 | "level": 3, |
|
69 | "level": 3, | |
70 | "metadata": {}, |
|
70 | "metadata": {}, | |
71 | "source": [ |
|
71 | "source": [ | |
72 | "Command mode" |
|
72 | "Command mode" | |
73 | ] |
|
73 | ] | |
74 | }, |
|
74 | }, | |
75 | { |
|
75 | { | |
76 | "cell_type": "markdown", |
|
76 | "cell_type": "markdown", | |
77 | "metadata": {}, |
|
77 | "metadata": {}, | |
78 | "source": [ |
|
78 | "source": [ | |
79 | "Command mode is indicated by a grey cell border:\n", |
|
79 | "Command mode is indicated by a grey cell border:\n", | |
80 | "\n", |
|
80 | "\n", | |
81 | "<img src=\"images/command_mode.png\">\n", |
|
81 | "<img src=\"images/command_mode.png\">\n", | |
82 | "\n", |
|
82 | "\n", | |
83 | "When you are in command mode, you are able to edit the notebook as a whole, but not type into individual cells. Most importantly, in command mode, the keyboard is mapped to a set of shortcuts that let you perform notebook and cell actions efficiently. For example, if you are in command mode and you press `c`, you will copy the current cell - no modifier is needed.\n", |
|
83 | "When you are in command mode, you are able to edit the notebook as a whole, but not type into individual cells. Most importantly, in command mode, the keyboard is mapped to a set of shortcuts that let you perform notebook and cell actions efficiently. For example, if you are in command mode and you press `c`, you will copy the current cell - no modifier is needed.\n", | |
84 | "\n", |
|
84 | "\n", | |
85 | "<div class=\"alert alert-error\" style=\"margin: 10px\">\n", |
|
85 | "<div class=\"alert alert-error\" style=\"margin: 10px\">\n", | |
86 | "Don't try to type into a cell in command mode; unexpected things will happen!\n", |
|
86 | "Don't try to type into a cell in command mode; unexpected things will happen!\n", | |
87 | "</div>\n", |
|
87 | "</div>\n", | |
88 | "\n", |
|
88 | "\n", | |
89 | "<div class=\"alert alert-success\" style=\"margin: 10px\">\n", |
|
89 | "<div class=\"alert alert-success\" style=\"margin: 10px\">\n", | |
90 | "Enter command mode by pressing `esc` or using the mouse to click *outside* a cell's editor area.\n", |
|
90 | "Enter command mode by pressing `esc` or using the mouse to click *outside* a cell's editor area.\n", | |
91 | "</div>" |
|
91 | "</div>" | |
92 | ] |
|
92 | ] | |
93 | }, |
|
93 | }, | |
94 | { |
|
94 | { | |
95 | "cell_type": "heading", |
|
95 | "cell_type": "heading", | |
96 | "level": 2, |
|
96 | "level": 2, | |
97 | "metadata": {}, |
|
97 | "metadata": {}, | |
98 | "source": [ |
|
98 | "source": [ | |
99 | "Mouse navigation" |
|
99 | "Mouse navigation" | |
100 | ] |
|
100 | ] | |
101 | }, |
|
101 | }, | |
102 | { |
|
102 | { | |
103 | "cell_type": "markdown", |
|
103 | "cell_type": "markdown", | |
104 | "metadata": {}, |
|
104 | "metadata": {}, | |
105 | "source": [ |
|
105 | "source": [ | |
106 | "All navigation and actions in the Notebook are available using the mouse through the menubar and toolbar, which are both above the main Notebook area:\n", |
|
106 | "All navigation and actions in the Notebook are available using the mouse through the menubar and toolbar, which are both above the main Notebook area:\n", | |
107 | "\n", |
|
107 | "\n", | |
108 | "<img src=\"images/menubar_toolbar.png\">" |
|
108 | "<img src=\"images/menubar_toolbar.png\">" | |
109 | ] |
|
109 | ] | |
110 | }, |
|
110 | }, | |
111 | { |
|
111 | { | |
112 | "cell_type": "markdown", |
|
112 | "cell_type": "markdown", | |
113 | "metadata": {}, |
|
113 | "metadata": {}, | |
114 | "source": [ |
|
114 | "source": [ | |
115 | "The first idea of mouse based navigation is that **cells can be selected by clicking on them.** The currently selected cell gets a grey or green border depending on whether the notebook is in edit or command mode. If you click inside a cell's editor area, you will enter edit mode. If you click on the prompt or output area of a cell you will enter command mode.\n", |
|
115 | "The first idea of mouse based navigation is that **cells can be selected by clicking on them.** The currently selected cell gets a grey or green border depending on whether the notebook is in edit or command mode. If you click inside a cell's editor area, you will enter edit mode. If you click on the prompt or output area of a cell you will enter command mode.\n", | |
116 | "\n", |
|
116 | "\n", | |
117 | "If you are running this notebook in a live session (not on http://nbviewer.ipython.org) try selecting different cells and going between edit and command mode. Try typing into a cell." |
|
117 | "If you are running this notebook in a live session (not on http://nbviewer.ipython.org) try selecting different cells and going between edit and command mode. Try typing into a cell." | |
118 | ] |
|
118 | ] | |
119 | }, |
|
119 | }, | |
120 | { |
|
120 | { | |
121 | "cell_type": "markdown", |
|
121 | "cell_type": "markdown", | |
122 | "metadata": {}, |
|
122 | "metadata": {}, | |
123 | "source": [ |
|
123 | "source": [ | |
124 | "The second idea of mouse based navigation is that **cell actions usually apply to the currently selected cell**. Thus if you want to run the code in a cell, you would select it and click the \"Play\" button in the toolbar or the \"Cell:Run\" menu item. Similarly, to copy a cell you would select it and click the \"Copy\" button in the toolbar or the \"Edit:Copy\" menu item. With this simple pattern, you should be able to do most everything you need with the mouse.\n", |
|
124 | "The second idea of mouse based navigation is that **cell actions usually apply to the currently selected cell**. Thus if you want to run the code in a cell, you would select it and click the \"Play\" button in the toolbar or the \"Cell:Run\" menu item. Similarly, to copy a cell you would select it and click the \"Copy\" button in the toolbar or the \"Edit:Copy\" menu item. With this simple pattern, you should be able to do most everything you need with the mouse.\n", | |
125 | "\n", |
|
125 | "\n", | |
126 | "Markdown and heading cells have one other state that can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, you will see a nice formatted representation of the cell's contents. When they are unrendered, you will see the raw text source of the cell. To render the selected cell with the mouse, click the \"Play\" button in the toolbar or the \"Cell:Run\" menu item. To unrender the selected cell, double click on the cell." |
|
126 | "Markdown and heading cells have one other state that can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, you will see a nice formatted representation of the cell's contents. When they are unrendered, you will see the raw text source of the cell. To render the selected cell with the mouse, click the \"Play\" button in the toolbar or the \"Cell:Run\" menu item. To unrender the selected cell, double click on the cell." | |
127 | ] |
|
127 | ] | |
128 | }, |
|
128 | }, | |
129 | { |
|
129 | { | |
130 | "cell_type": "heading", |
|
130 | "cell_type": "heading", | |
131 | "level": 2, |
|
131 | "level": 2, | |
132 | "metadata": {}, |
|
132 | "metadata": {}, | |
133 | "source": [ |
|
133 | "source": [ | |
134 | "Keyboard Navigation" |
|
134 | "Keyboard Navigation" | |
135 | ] |
|
135 | ] | |
136 | }, |
|
136 | }, | |
137 | { |
|
137 | { | |
138 | "cell_type": "markdown", |
|
138 | "cell_type": "markdown", | |
139 | "metadata": {}, |
|
139 | "metadata": {}, | |
140 | "source": [ |
|
140 | "source": [ | |
141 |
"The modal user |
|
141 | "The modal user interface of the IPython Notebook has been optimized for efficient keyboard usage. This is made possible by having two different sets of keyboard shortcuts: one set that is active in edit mode and another in command mode.\n", | |
142 | "\n", |
|
142 | "\n", | |
143 | "The most important keyboard shortcuts are `enter`, which enters edit mode, and `esc`, which enters command mode.\n", |
|
143 | "The most important keyboard shortcuts are `enter`, which enters edit mode, and `esc`, which enters command mode.\n", | |
144 | "\n", |
|
144 | "\n", | |
145 | "In edit mode, most of the keyboard is dedicated to typing into the cell's editor. Thus, in edit mode there are relatively few shortcuts:" |
|
145 | "In edit mode, most of the keyboard is dedicated to typing into the cell's editor. Thus, in edit mode there are relatively few shortcuts:" | |
146 | ] |
|
146 | ] | |
147 | }, |
|
147 | }, | |
148 | { |
|
148 | { | |
|
149 | "cell_type": "markdown", | |||
|
150 | "metadata": {}, | |||
|
151 | "source": [ | |||
|
152 | "The `display_edit_shortcuts()` function used here is defined in the [Utilities section](#Utilities) at the bottom of this notebook." | |||
|
153 | ] | |||
|
154 | }, | |||
|
155 | { | |||
149 | "cell_type": "code", |
|
156 | "cell_type": "code", | |
150 | "collapsed": false, |
|
157 | "collapsed": false, | |
151 | "input": [ |
|
158 | "input": [ | |
152 | "display_edit_shortcuts()" |
|
159 | "display_edit_shortcuts()" | |
153 | ], |
|
160 | ], | |
154 | "language": "python", |
|
161 | "language": "python", | |
155 | "metadata": {}, |
|
162 | "metadata": {}, | |
156 | "outputs": [ |
|
163 | "outputs": [ | |
157 | { |
|
164 | { | |
158 | "html": [ |
|
165 | "html": [ | |
159 | "<div class=\"hbox\"><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">esc</span><span class=\"shortcut_descr\"> : command mode</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+m</span><span class=\"shortcut_descr\"> : command mode</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+enter</span><span class=\"shortcut_descr\"> : run cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+enter</span><span class=\"shortcut_descr\"> : run cell, select below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">alt+enter</span><span class=\"shortcut_descr\"> : run cell, insert below</span></div></div><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">up</span><span class=\"shortcut_descr\"> : select previous cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">down</span><span class=\"shortcut_descr\"> : select next cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">alt+-</span><span class=\"shortcut_descr\"> : split cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">meta+s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+s</span><span class=\"shortcut_descr\"> : save notebook</span></div></div></div>" |
|
166 | "<div class=\"hbox\"><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">esc</span><span class=\"shortcut_descr\"> : command mode</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+m</span><span class=\"shortcut_descr\"> : command mode</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+enter</span><span class=\"shortcut_descr\"> : run cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+enter</span><span class=\"shortcut_descr\"> : run cell, select below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">alt+enter</span><span class=\"shortcut_descr\"> : run cell, insert below</span></div></div><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">up</span><span class=\"shortcut_descr\"> : select previous cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">down</span><span class=\"shortcut_descr\"> : select next cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">alt+-</span><span class=\"shortcut_descr\"> : split cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">meta+s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+s</span><span class=\"shortcut_descr\"> : save notebook</span></div></div></div>" | |
160 | ], |
|
167 | ], | |
161 | "output_type": "display_data" |
|
168 | "output_type": "display_data" | |
162 | }, |
|
169 | }, | |
163 | { |
|
170 | { | |
164 | "javascript": [ |
|
171 | "javascript": [ | |
165 | "var help = IPython.quick_help.build_edit_help();\n", |
|
172 | "var help = IPython.quick_help.build_edit_help();\n", | |
166 | "help.children().first().remove();\n", |
|
173 | "help.children().first().remove();\n", | |
167 | "this.append_output({output_type: 'display_data', html: help.html()});" |
|
174 | "this.append_output({output_type: 'display_data', html: help.html()});" | |
168 | ], |
|
175 | ], | |
169 | "metadata": {}, |
|
176 | "metadata": {}, | |
170 | "output_type": "display_data", |
|
177 | "output_type": "display_data", | |
171 | "text": [ |
|
178 | "text": [ | |
172 | "<IPython.core.display.Javascript at 0x10e441250>" |
|
179 | "<IPython.core.display.Javascript at 0x10e441250>" | |
173 | ] |
|
180 | ] | |
174 | } |
|
181 | } | |
175 | ], |
|
182 | ], | |
176 | "prompt_number": 14 |
|
183 | "prompt_number": 14 | |
177 | }, |
|
184 | }, | |
178 | { |
|
185 | { | |
179 | "cell_type": "markdown", |
|
186 | "cell_type": "markdown", | |
180 | "metadata": {}, |
|
187 | "metadata": {}, | |
181 | "source": [ |
|
188 | "source": [ | |
182 | "There are two other keyboard shortcuts in edit mode that are not listed here:\n", |
|
189 | "There are two other keyboard shortcuts in edit mode that are not listed here:\n", | |
183 | "\n", |
|
190 | "\n", | |
184 | "* `tab`: trigger \"tab\" completion\n", |
|
191 | "* `tab`: trigger \"tab\" completion\n", | |
185 | "* `shift+tab`: open the tooltip" |
|
192 | "* `shift+tab`: open the tooltip" | |
186 | ] |
|
193 | ] | |
187 | }, |
|
194 | }, | |
188 | { |
|
195 | { | |
189 | "cell_type": "markdown", |
|
196 | "cell_type": "markdown", | |
190 | "metadata": {}, |
|
197 | "metadata": {}, | |
191 | "source": [ |
|
198 | "source": [ | |
192 | "In command mode, the entire keyboard is available for shortcuts:" |
|
199 | "In command mode, the entire keyboard is available for shortcuts:" | |
193 | ] |
|
200 | ] | |
194 | }, |
|
201 | }, | |
195 | { |
|
202 | { | |
196 | "cell_type": "code", |
|
203 | "cell_type": "code", | |
197 | "collapsed": false, |
|
204 | "collapsed": false, | |
198 | "input": [ |
|
205 | "input": [ | |
199 | "display_command_shortcuts()" |
|
206 | "display_command_shortcuts()" | |
200 | ], |
|
207 | ], | |
201 | "language": "python", |
|
208 | "language": "python", | |
202 | "metadata": {}, |
|
209 | "metadata": {}, | |
203 | "outputs": [ |
|
210 | "outputs": [ | |
204 | { |
|
211 | { | |
205 | "html": [ |
|
212 | "html": [ | |
206 | "<div class=\"hbox\"><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">enter</span><span class=\"shortcut_descr\"> : edit mode</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+enter</span><span class=\"shortcut_descr\"> : run cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+enter</span><span class=\"shortcut_descr\"> : run cell, select below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">alt+enter</span><span class=\"shortcut_descr\"> : run cell, insert below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">y</span><span class=\"shortcut_descr\"> : to code</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">m</span><span class=\"shortcut_descr\"> : to markdown</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">t</span><span class=\"shortcut_descr\"> : to raw</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">1</span><span class=\"shortcut_descr\"> : to heading 1</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">2</span><span class=\"shortcut_descr\"> : to heading 2</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">3</span><span class=\"shortcut_descr\"> : to heading 3</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">4</span><span class=\"shortcut_descr\"> : to heading 4</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">5</span><span class=\"shortcut_descr\"> : to heading 5</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">6</span><span class=\"shortcut_descr\"> : to heading 6</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">up</span><span class=\"shortcut_descr\"> : select previous cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">down</span><span class=\"shortcut_descr\"> : select next cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">k</span><span class=\"shortcut_descr\"> : select previous cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">j</span><span class=\"shortcut_descr\"> : select next cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+k</span><span class=\"shortcut_descr\"> : move cell up</span></div></div><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+j</span><span class=\"shortcut_descr\"> : move cell down</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">a</span><span class=\"shortcut_descr\"> : insert cell above</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">b</span><span class=\"shortcut_descr\"> : insert cell below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">x</span><span class=\"shortcut_descr\"> : cut cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">c</span><span class=\"shortcut_descr\"> : copy cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">v</span><span class=\"shortcut_descr\"> : paste cell below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">z</span><span class=\"shortcut_descr\"> : undo last delete</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">d</span><span class=\"shortcut_descr\"> : delete cell (press twice)</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+=</span><span class=\"shortcut_descr\"> : merge cell below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">meta+s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">l</span><span class=\"shortcut_descr\"> : toggle line numbers</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">o</span><span class=\"shortcut_descr\"> : toggle output</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+o</span><span class=\"shortcut_descr\"> : toggle output</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">h</span><span class=\"shortcut_descr\"> : keyboard shortcuts</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">i</span><span class=\"shortcut_descr\"> : interrupt kernel</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">.</span><span class=\"shortcut_descr\"> : restart kernel</span></div></div></div>" |
|
213 | "<div class=\"hbox\"><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">enter</span><span class=\"shortcut_descr\"> : edit mode</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+enter</span><span class=\"shortcut_descr\"> : run cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+enter</span><span class=\"shortcut_descr\"> : run cell, select below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">alt+enter</span><span class=\"shortcut_descr\"> : run cell, insert below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">y</span><span class=\"shortcut_descr\"> : to code</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">m</span><span class=\"shortcut_descr\"> : to markdown</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">t</span><span class=\"shortcut_descr\"> : to raw</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">1</span><span class=\"shortcut_descr\"> : to heading 1</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">2</span><span class=\"shortcut_descr\"> : to heading 2</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">3</span><span class=\"shortcut_descr\"> : to heading 3</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">4</span><span class=\"shortcut_descr\"> : to heading 4</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">5</span><span class=\"shortcut_descr\"> : to heading 5</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">6</span><span class=\"shortcut_descr\"> : to heading 6</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">up</span><span class=\"shortcut_descr\"> : select previous cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">down</span><span class=\"shortcut_descr\"> : select next cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">k</span><span class=\"shortcut_descr\"> : select previous cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">j</span><span class=\"shortcut_descr\"> : select next cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+k</span><span class=\"shortcut_descr\"> : move cell up</span></div></div><div class=\"box-flex0\"><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+j</span><span class=\"shortcut_descr\"> : move cell down</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">a</span><span class=\"shortcut_descr\"> : insert cell above</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">b</span><span class=\"shortcut_descr\"> : insert cell below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">x</span><span class=\"shortcut_descr\"> : cut cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">c</span><span class=\"shortcut_descr\"> : copy cell</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">v</span><span class=\"shortcut_descr\"> : paste cell below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">z</span><span class=\"shortcut_descr\"> : undo last delete</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">d</span><span class=\"shortcut_descr\"> : delete cell (press twice)</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+=</span><span class=\"shortcut_descr\"> : merge cell below</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">meta+s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">ctrl+s</span><span class=\"shortcut_descr\"> : save notebook</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">l</span><span class=\"shortcut_descr\"> : toggle line numbers</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">o</span><span class=\"shortcut_descr\"> : toggle output</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">shift+o</span><span class=\"shortcut_descr\"> : toggle output</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">h</span><span class=\"shortcut_descr\"> : keyboard shortcuts</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">i</span><span class=\"shortcut_descr\"> : interrupt kernel</span></div><div class=\"quickhelp\"><span class=\"shortcut_key\">.</span><span class=\"shortcut_descr\"> : restart kernel</span></div></div></div>" | |
207 | ], |
|
214 | ], | |
208 | "output_type": "display_data" |
|
215 | "output_type": "display_data" | |
209 | }, |
|
216 | }, | |
210 | { |
|
217 | { | |
211 | "javascript": [ |
|
218 | "javascript": [ | |
212 | "var help = IPython.quick_help.build_command_help();\n", |
|
219 | "var help = IPython.quick_help.build_command_help();\n", | |
213 | "help.children().first().remove();\n", |
|
220 | "help.children().first().remove();\n", | |
214 | "this.append_output({output_type: 'display_data', html: help.html()});" |
|
221 | "this.append_output({output_type: 'display_data', html: help.html()});" | |
215 | ], |
|
222 | ], | |
216 | "metadata": {}, |
|
223 | "metadata": {}, | |
217 | "output_type": "display_data", |
|
224 | "output_type": "display_data", | |
218 | "text": [ |
|
225 | "text": [ | |
219 | "<IPython.core.display.Javascript at 0x10e441410>" |
|
226 | "<IPython.core.display.Javascript at 0x10e441410>" | |
220 | ] |
|
227 | ] | |
221 | } |
|
228 | } | |
222 | ], |
|
229 | ], | |
223 | "prompt_number": 15 |
|
230 | "prompt_number": 15 | |
224 | }, |
|
231 | }, | |
225 | { |
|
232 | { | |
226 | "cell_type": "markdown", |
|
233 | "cell_type": "markdown", | |
227 | "metadata": {}, |
|
234 | "metadata": {}, | |
228 | "source": [ |
|
235 | "source": [ | |
229 | "Here the rough order in which we recommend learning the command mode shortcuts:\n", |
|
236 | "Here the rough order in which we recommend learning the command mode shortcuts:\n", | |
230 | "\n", |
|
237 | "\n", | |
231 | "1. Basic navigation: `enter`, `shift-enter`, `up/k`, `down/j`\n", |
|
238 | "1. Basic navigation: `enter`, `shift-enter`, `up/k`, `down/j`\n", | |
232 | "2. Saving the notebook: `s`\n", |
|
239 | "2. Saving the notebook: `s`\n", | |
233 | "2. Cell types: `y`, `m`, `1-6`, `t`\n", |
|
240 | "2. Cell types: `y`, `m`, `1-6`, `t`\n", | |
234 | "3. Cell creation and movement: `a`, `b`, `ctrl+k`, `ctrl+j`\n", |
|
241 | "3. Cell creation and movement: `a`, `b`, `ctrl+k`, `ctrl+j`\n", | |
235 | "4. Cell editing: `x`, `c`, `v`, `d`, `z`, `shift+=`\n", |
|
242 | "4. Cell editing: `x`, `c`, `v`, `d`, `z`, `shift+=`\n", | |
236 | "5. Kernel operations: `i`, `.`" |
|
243 | "5. Kernel operations: `i`, `.`" | |
237 | ] |
|
244 | ] | |
238 | }, |
|
245 | }, | |
239 | { |
|
246 | { | |
240 | "cell_type": "heading", |
|
247 | "cell_type": "heading", | |
241 | "level": 2, |
|
248 | "level": 2, | |
242 | "metadata": {}, |
|
249 | "metadata": {}, | |
243 | "source": [ |
|
250 | "source": [ | |
244 | "Keyboard shortcut customization" |
|
251 | "Keyboard shortcut customization" | |
245 | ] |
|
252 | ] | |
246 | }, |
|
253 | }, | |
247 | { |
|
254 | { | |
248 | "cell_type": "markdown", |
|
255 | "cell_type": "markdown", | |
249 | "metadata": {}, |
|
256 | "metadata": {}, | |
250 | "source": [ |
|
257 | "source": [ | |
251 | "Starting with IPython 2.0 keyboard shortcuts in command and edit mode are fully customizable. These customizations are made using the IPython JavaScript API. Here is an example that makes the `r` key available for running a cell:" |
|
258 | "Starting with IPython 2.0 keyboard shortcuts in command and edit mode are fully customizable. These customizations are made using the IPython JavaScript API. Here is an example that makes the `r` key available for running a cell:" | |
252 | ] |
|
259 | ] | |
253 | }, |
|
260 | }, | |
254 | { |
|
261 | { | |
255 | "cell_type": "code", |
|
262 | "cell_type": "code", | |
256 | "collapsed": false, |
|
263 | "collapsed": false, | |
257 | "input": [ |
|
264 | "input": [ | |
258 | "%%javascript\n", |
|
265 | "%%javascript\n", | |
259 | "\n", |
|
266 | "\n", | |
260 | "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n", |
|
267 | "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n", | |
261 | " help : 'run cell',\n", |
|
268 | " help : 'run cell',\n", | |
262 |
" help_index : ' |
|
269 | " help_index : 'zz',\n", | |
263 | " handler : function (event) {\n", |
|
270 | " handler : function (event) {\n", | |
264 | " IPython.notebook.execute_cell();\n", |
|
271 | " IPython.notebook.execute_cell();\n", | |
265 | " return false;\n", |
|
272 | " return false;\n", | |
266 | " }}\n", |
|
273 | " }}\n", | |
267 | ");" |
|
274 | ");" | |
268 | ], |
|
275 | ], | |
269 | "language": "python", |
|
276 | "language": "python", | |
270 | "metadata": {}, |
|
277 | "metadata": {}, | |
271 | "outputs": [ |
|
278 | "outputs": [ | |
272 | { |
|
279 | { | |
273 | "javascript": [ |
|
280 | "javascript": [ | |
274 | "\n", |
|
281 | "\n", | |
275 | "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n", |
|
282 | "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n", | |
276 | " help : 'run cell',\n", |
|
283 | " help : 'run cell',\n", | |
277 |
" help_index : ' |
|
284 | " help_index : 'aa',\n", | |
278 | " handler : function (event) {\n", |
|
285 | " handler : function (event) {\n", | |
279 | " IPython.notebook.execute_cell();\n", |
|
286 | " IPython.notebook.execute_cell();\n", | |
280 | " return false;\n", |
|
287 | " return false;\n", | |
281 | " }}\n", |
|
288 | " }}\n", | |
282 | ");" |
|
289 | ");" | |
283 | ], |
|
290 | ], | |
284 | "metadata": {}, |
|
291 | "metadata": {}, | |
285 | "output_type": "display_data", |
|
292 | "output_type": "display_data", | |
286 | "text": [ |
|
293 | "text": [ | |
287 |
"<IPython.core.display.Javascript at 0x10 |
|
294 | "<IPython.core.display.Javascript at 0x1019ba990>" | |
288 | ] |
|
295 | ] | |
289 | } |
|
296 | } | |
290 | ], |
|
297 | ], | |
291 |
"prompt_number": |
|
298 | "prompt_number": 6 | |
292 | }, |
|
299 | }, | |
293 | { |
|
300 | { | |
294 | "cell_type": "markdown", |
|
301 | "cell_type": "markdown", | |
295 | "metadata": {}, |
|
302 | "metadata": {}, | |
296 | "source": [ |
|
303 | "source": [ | |
297 | "There are a couple of points to mention about this API:\n", |
|
304 | "There are a couple of points to mention about this API:\n", | |
298 | "\n", |
|
305 | "\n", | |
299 | "* The `help_index` field is used to sort the shortcuts in the Keyboard Shortcuts help dialog.\n", |
|
306 | "* The `help_index` field is used to sort the shortcuts in the Keyboard Shortcuts help dialog. It defaults to `zz`.\n", | |
300 | "* When a handler returns `false` it indicates that the event should stop propagating and the default action should not be performed. For further details about the `event` object or event handling, see the jQuery docs.\n", |
|
307 | "* When a handler returns `false` it indicates that the event should stop propagating and the default action should not be performed. For further details about the `event` object or event handling, see the jQuery docs.\n", | |
301 |
"* If you don't need a `help` or `help_index` field, you can simply pass a function as the second argument to `add_shortcut`. |
|
308 | "* If you don't need a `help` or `help_index` field, you can simply pass a function as the second argument to `add_shortcut`." | |
|
309 | ] | |||
|
310 | }, | |||
|
311 | { | |||
|
312 | "cell_type": "code", | |||
|
313 | "collapsed": false, | |||
|
314 | "input": [ | |||
|
315 | "%%javascript\n", | |||
302 | "\n", |
|
316 | "\n", | |
|
317 | "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', function (event) {\n", | |||
|
318 | " IPython.notebook.execute_cell();\n", | |||
|
319 | " return false;\n", | |||
|
320 | "});" | |||
|
321 | ], | |||
|
322 | "language": "python", | |||
|
323 | "metadata": {}, | |||
|
324 | "outputs": [ | |||
|
325 | { | |||
|
326 | "javascript": [ | |||
|
327 | "\n", | |||
|
328 | "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', function (event) {\n", | |||
|
329 | " IPython.notebook.execute_cell();\n", | |||
|
330 | " return false;\n", | |||
|
331 | "});" | |||
|
332 | ], | |||
|
333 | "metadata": {}, | |||
|
334 | "output_type": "display_data", | |||
|
335 | "text": [ | |||
|
336 | "<IPython.core.display.Javascript at 0x1019baf90>" | |||
|
337 | ] | |||
|
338 | } | |||
|
339 | ], | |||
|
340 | "prompt_number": 11 | |||
|
341 | }, | |||
|
342 | { | |||
|
343 | "cell_type": "markdown", | |||
|
344 | "metadata": {}, | |||
|
345 | "source": [ | |||
303 | "Likewise, to remove a shortcut, use `remove_shortcut`:" |
|
346 | "Likewise, to remove a shortcut, use `remove_shortcut`:" | |
304 | ] |
|
347 | ] | |
305 | }, |
|
348 | }, | |
306 | { |
|
349 | { | |
307 | "cell_type": "code", |
|
350 | "cell_type": "code", | |
308 | "collapsed": false, |
|
351 | "collapsed": false, | |
309 | "input": [ |
|
352 | "input": [ | |
310 | "%%javascript\n", |
|
353 | "%%javascript\n", | |
311 | "\n", |
|
354 | "\n", | |
312 | "IPython.keyboard_manager.command_shortcuts.remove_shortcut('r');" |
|
355 | "IPython.keyboard_manager.command_shortcuts.remove_shortcut('r');" | |
313 | ], |
|
356 | ], | |
314 | "language": "python", |
|
357 | "language": "python", | |
315 | "metadata": {}, |
|
358 | "metadata": {}, | |
316 | "outputs": [ |
|
359 | "outputs": [ | |
317 | { |
|
360 | { | |
318 | "javascript": [ |
|
361 | "javascript": [ | |
319 | "\n", |
|
362 | "\n", | |
320 | "IPython.keyboard_manager.command_shortcuts.remove_shortcut('r');" |
|
363 | "IPython.keyboard_manager.command_shortcuts.remove_shortcut('r');" | |
321 | ], |
|
364 | ], | |
322 | "metadata": {}, |
|
365 | "metadata": {}, | |
323 | "output_type": "display_data", |
|
366 | "output_type": "display_data", | |
324 | "text": [ |
|
367 | "text": [ | |
325 |
"<IPython.core.display.Javascript at 0x10 |
|
368 | "<IPython.core.display.Javascript at 0x1019ba950>" | |
326 | ] |
|
369 | ] | |
327 | } |
|
370 | } | |
328 | ], |
|
371 | ], | |
329 |
"prompt_number": |
|
372 | "prompt_number": 8 | |
330 | }, |
|
373 | }, | |
331 | { |
|
374 | { | |
332 | "cell_type": "markdown", |
|
375 | "cell_type": "markdown", | |
333 | "metadata": {}, |
|
376 | "metadata": {}, | |
334 | "source": [ |
|
377 | "source": [ | |
335 | "If you want your keyboard shortcuts to be active for all of your notebooks, put the above API calls into your `custom.js` file." |
|
378 | "If you want your keyboard shortcuts to be active for all of your notebooks, put the above API calls into your `custom.js` file." | |
336 | ] |
|
379 | ] | |
337 | }, |
|
380 | }, | |
338 | { |
|
381 | { | |
339 | "cell_type": "heading", |
|
382 | "cell_type": "heading", | |
340 | "level": 2, |
|
383 | "level": 2, | |
341 | "metadata": {}, |
|
384 | "metadata": {}, | |
342 | "source": [ |
|
385 | "source": [ | |
343 | "Utilities" |
|
386 | "Utilities" | |
344 | ] |
|
387 | ] | |
345 | }, |
|
388 | }, | |
346 | { |
|
389 | { | |
347 | "cell_type": "markdown", |
|
390 | "cell_type": "markdown", | |
348 | "metadata": {}, |
|
391 | "metadata": {}, | |
349 | "source": [ |
|
392 | "source": [ | |
350 | "We use the following functions to generate the keyboard shortcut listings above." |
|
393 | "We use the following functions to generate the keyboard shortcut listings above." | |
351 | ] |
|
394 | ] | |
352 | }, |
|
395 | }, | |
353 | { |
|
396 | { | |
354 | "cell_type": "code", |
|
397 | "cell_type": "code", | |
355 | "collapsed": false, |
|
398 | "collapsed": false, | |
356 | "input": [ |
|
399 | "input": [ | |
357 | "from IPython.display import Javascript, display\n", |
|
400 | "from IPython.display import Javascript, display\n", | |
358 | "\n", |
|
401 | "\n", | |
359 | "t = \"\"\"var help = IPython.quick_help.build_{0}_help();\n", |
|
402 | "t = \"\"\"var help = IPython.quick_help.build_{0}_help();\n", | |
360 | "help.children().first().remove();\n", |
|
403 | "help.children().first().remove();\n", | |
361 | "this.append_output({{output_type: 'display_data', html: help.html()}});\"\"\"\n", |
|
404 | "this.append_output({{output_type: 'display_data', html: help.html()}});\"\"\"\n", | |
362 | "\n", |
|
405 | "\n", | |
363 | "def display_command_shortcuts():\n", |
|
406 | "def display_command_shortcuts():\n", | |
364 | " display(Javascript(t.format('command')))\n", |
|
407 | " display(Javascript(t.format('command')))\n", | |
365 | "\n", |
|
408 | "\n", | |
366 | "def display_edit_shortcuts():\n", |
|
409 | "def display_edit_shortcuts():\n", | |
367 | " display(Javascript(t.format('edit'))) " |
|
410 | " display(Javascript(t.format('edit'))) " | |
368 | ], |
|
411 | ], | |
369 | "language": "python", |
|
412 | "language": "python", | |
370 | "metadata": {}, |
|
413 | "metadata": {}, | |
371 | "outputs": [], |
|
414 | "outputs": [], | |
372 |
"prompt_number": |
|
415 | "prompt_number": 2 | |
373 | } |
|
416 | } | |
374 | ], |
|
417 | ], | |
375 | "metadata": {} |
|
418 | "metadata": {} | |
376 | } |
|
419 | } | |
377 | ] |
|
420 | ] | |
378 | } No newline at end of file |
|
421 | } |
General Comments 0
You need to be logged in to leave comments.
Login now