Show More
@@ -147,7 +147,7 b' var IPython = (function (IPython) {' | |||||
147 | return false; |
|
147 | return false; | |
148 | } else if (event.which === 72 && that.control_key_active) { |
|
148 | } else if (event.which === 72 && that.control_key_active) { | |
149 | // Show keyboard shortcuts = h |
|
149 | // Show keyboard shortcuts = h | |
150 |
that. |
|
150 | that.toggle_keyboard_shortcuts(); | |
151 | that.control_key_active = false; |
|
151 | that.control_key_active = false; | |
152 | return false; |
|
152 | return false; | |
153 | } else if (that.control_key_active) { |
|
153 | } else if (that.control_key_active) { | |
@@ -196,8 +196,17 b' var IPython = (function (IPython) {' | |||||
196 | }; |
|
196 | }; | |
197 |
|
197 | |||
198 |
|
198 | |||
199 |
Notebook.prototype. |
|
199 | Notebook.prototype.toggle_keyboard_shortcuts = function () { | |
|
200 | // toggles display of keyboard shortcut dialog | |||
|
201 | var that = this; | |||
|
202 | if ( this.shortcut_dialog ){ | |||
|
203 | // if dialog is already shown, close it | |||
|
204 | this.shortcut_dialog.dialog("close"); | |||
|
205 | this.shortcut_dialog = null; | |||
|
206 | return; | |||
|
207 | } | |||
200 | var dialog = $('<div/>'); |
|
208 | var dialog = $('<div/>'); | |
|
209 | this.shortcut_dialog = dialog; | |||
201 | var shortcuts = [ |
|
210 | var shortcuts = [ | |
202 | {key: 'Shift-Enter', help: 'run cell'}, |
|
211 | {key: 'Shift-Enter', help: 'run cell'}, | |
203 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, |
|
212 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, | |
@@ -223,6 +232,10 b' var IPython = (function (IPython) {' | |||||
223 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) |
|
232 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) | |
224 | ); |
|
233 | ); | |
225 | }; |
|
234 | }; | |
|
235 | dialog.bind('dialogclose', function(event) { | |||
|
236 | // dialog has been closed, allow it to be drawn again. | |||
|
237 | that.shortcut_dialog = null; | |||
|
238 | }); | |||
226 | dialog.dialog({title: 'Keyboard shortcuts'}); |
|
239 | dialog.dialog({title: 'Keyboard shortcuts'}); | |
227 | }; |
|
240 | }; | |
228 |
|
241 |
@@ -27,7 +27,7 b' var IPython = (function (IPython) {' | |||||
27 | QuickHelp.prototype.bind_events = function () { |
|
27 | QuickHelp.prototype.bind_events = function () { | |
28 | var that = this; |
|
28 | var that = this; | |
29 | this.element.find("button#quick_help").click(function () { |
|
29 | this.element.find("button#quick_help").click(function () { | |
30 |
IPython.notebook. |
|
30 | IPython.notebook.toggle_keyboard_shortcuts(); | |
31 | }); |
|
31 | }); | |
32 | }; |
|
32 | }; | |
33 |
|
33 |
General Comments 0
You need to be logged in to leave comments.
Login now