##// END OF EJS Templates
Work on shortcuts and examples notebook.
Brian E. Granger -
Show More
@@ -550,8 +550,10 b' var IPython = (function (IPython) {'
550 550 if (typeof(data) === 'function') {
551 551 data = {help: '', help_index: '', handler: data}
552 552 }
553 data.help_index = data.help_index || '';
554 data.help = data.help || '';
553 555 if (data.help_index === '') {
554 data.help_index = 'zz',
556 data.help_index = 'zz';
555 557 }
556 558 shortcut = this.normalize_shortcut(shortcut);
557 559 this._shortcuts[shortcut] = data;
@@ -12,17 +12,17 b''
12 12 "level": 1,
13 13 "metadata": {},
14 14 "source": [
15 "User Experience"
15 "User Interface"
16 16 ]
17 17 },
18 18 {
19 19 "cell_type": "markdown",
20 20 "metadata": {},
21 21 "source": [
22 "This notebook describes the user experience of the IPython Notebook. This includes both mouse and keyboard based navigation and interaction.\n",
22 "This notebook describes the user interface of the IPython Notebook. This includes both mouse and keyboard based navigation and interaction.\n",
23 23 "\n",
24 24 "<div class=\"alert\" style=\"margin: 10px\">\n",
25 "As of IPython 2.0, the user experience 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",
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 26 "</div>"
27 27 ]
28 28 },
@@ -38,7 +38,7 b''
38 38 "cell_type": "markdown",
39 39 "metadata": {},
40 40 "source": [
41 "Starting with IPython 2.0, the IPython Notebook has a modal user experience. 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."
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 {
@@ -138,7 +138,7 b''
138 138 "cell_type": "markdown",
139 139 "metadata": {},
140 140 "source": [
141 "The modal user experience 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",
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 142 "\n",
143 143 "The most important keyboard shortcuts are `enter`, which enters edit mode, and `esc`, which enters command mode.\n",
144 144 "\n",
@@ -146,6 +146,13 b''
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 156 "cell_type": "code",
150 157 "collapsed": false,
151 158 "input": [
@@ -259,7 +266,7 b''
259 266 "\n",
260 267 "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n",
261 268 " help : 'run cell',\n",
262 " help_index : 'bd',\n",
269 " help_index : 'zz',\n",
263 270 " handler : function (event) {\n",
264 271 " IPython.notebook.execute_cell();\n",
265 272 " return false;\n",
@@ -274,7 +281,7 b''
274 281 "\n",
275 282 "IPython.keyboard_manager.command_shortcuts.add_shortcut('r', {\n",
276 283 " help : 'run cell',\n",
277 " help_index : 'bd',\n",
284 " help_index : 'aa',\n",
278 285 " handler : function (event) {\n",
279 286 " IPython.notebook.execute_cell();\n",
280 287 " return false;\n",
@@ -284,11 +291,11 b''
284 291 "metadata": {},
285 292 "output_type": "display_data",
286 293 "text": [
287 "<IPython.core.display.Javascript at 0x10e441390>"
294 "<IPython.core.display.Javascript at 0x1019ba990>"
288 295 ]
289 296 }
290 297 ],
291 "prompt_number": 17
298 "prompt_number": 6
292 299 },
293 300 {
294 301 "cell_type": "markdown",
@@ -296,10 +303,46 b''
296 303 "source": [
297 304 "There are a couple of points to mention about this API:\n",
298 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 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`.\n",
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 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 346 "Likewise, to remove a shortcut, use `remove_shortcut`:"
304 347 ]
305 348 },
@@ -322,11 +365,11 b''
322 365 "metadata": {},
323 366 "output_type": "display_data",
324 367 "text": [
325 "<IPython.core.display.Javascript at 0x10e441250>"
368 "<IPython.core.display.Javascript at 0x1019ba950>"
326 369 ]
327 370 }
328 371 ],
329 "prompt_number": 18
372 "prompt_number": 8
330 373 },
331 374 {
332 375 "cell_type": "markdown",
@@ -369,7 +412,7 b''
369 412 "language": "python",
370 413 "metadata": {},
371 414 "outputs": [],
372 "prompt_number": 12
415 "prompt_number": 2
373 416 }
374 417 ],
375 418 "metadata": {}
General Comments 0
You need to be logged in to leave comments. Login now