Show More
@@ -0,0 +1,44 | |||||
|
1 | .. _integrating: | |||
|
2 | ||||
|
3 | ===================================== | |||
|
4 | Integrating your objects with IPython | |||
|
5 | ===================================== | |||
|
6 | ||||
|
7 | Tab completion | |||
|
8 | ============== | |||
|
9 | ||||
|
10 | To change the attributes displayed by tab-completing your object, define a | |||
|
11 | ``__dir__(self)`` method for it. For more details, see the documentation of the | |||
|
12 | built-in `dir() function <http://docs.python.org/library/functions.html#dir>`_. | |||
|
13 | ||||
|
14 | Rich display | |||
|
15 | ============ | |||
|
16 | ||||
|
17 | The notebook and the Qt console can display richer representations of objects. | |||
|
18 | To use this, you can define any of a number of ``_repr_*_()`` methods. Note that | |||
|
19 | these are surrounded by single, not double underscores. | |||
|
20 | ||||
|
21 | Both the notebook and the Qt console can display ``svg``, ``png`` and ``jpeg`` | |||
|
22 | representations. The notebook can also display ``html``, ``javascript``, | |||
|
23 | ``json`` and ``latex``. If the methods don't exist, or return ``None``, it falls | |||
|
24 | back to a standard ``repr()``. | |||
|
25 | ||||
|
26 | For example:: | |||
|
27 | ||||
|
28 | class Shout(object): | |||
|
29 | def __init__(self, text): | |||
|
30 | self.text = text | |||
|
31 | ||||
|
32 | def _repr_html_(self): | |||
|
33 | return "<h1>" + self.text + "</h1>" | |||
|
34 | ||||
|
35 | Custom exception tracebacks | |||
|
36 | =========================== | |||
|
37 | ||||
|
38 | Rarely, you might want to display a different traceback with an exception - | |||
|
39 | IPython's own parallel computing framework does this to display errors from the | |||
|
40 | engines. To do this, define a ``_render_traceback_(self)`` method which returns | |||
|
41 | a list of strings, each containing one line of the traceback. | |||
|
42 | ||||
|
43 | Please be conservative in using this feature; by replacing the default traceback | |||
|
44 | you may hide important information from the user. |
@@ -1,14 +1,15 | |||||
1 | .. _config_index: |
|
1 | .. _config_index: | |
2 |
|
2 | |||
3 | =============================== |
|
3 | =============================== | |
4 | Configuration and customization |
|
4 | Configuration and customization | |
5 | =============================== |
|
5 | =============================== | |
6 |
|
6 | |||
7 | .. toctree:: |
|
7 | .. toctree:: | |
8 | :maxdepth: 2 |
|
8 | :maxdepth: 2 | |
9 |
|
9 | |||
10 | overview.txt |
|
10 | overview.txt | |
11 | extensions/index.txt |
|
11 | extensions/index.txt | |
12 | ipython.txt |
|
12 | ipython.txt | |
|
13 | integrating.txt | |||
13 | editors.txt |
|
14 | editors.txt | |
14 | old.txt |
|
15 | old.txt |
@@ -1,9 +1,13 | |||||
1 | ===================== |
|
1 | ===================== | |
2 | Development version |
|
2 | Development version | |
3 | ===================== |
|
3 | ===================== | |
4 |
|
4 | |||
5 | This document describes in-flight development work. |
|
5 | This document describes in-flight development work. | |
6 |
|
6 | |||
7 | The CodeMirror js library has been updated fron 2.23 to 2.32 |
|
7 | The CodeMirror js library has been updated fron 2.23 to 2.32 | |
8 | this might induce a few changes in behavior of keymaps in the notebook, |
|
8 | this might induce a few changes in behavior of keymaps in the notebook, | |
9 |
especially intenting/deindenting blocks that is now bound |
|
9 | especially intenting/deindenting blocks that is now bound to Ctrl+] and ctr+[ | |
|
10 | ||||
|
11 | * Exception types can now be displayed with a custom traceback, by defining a | |||
|
12 | ``_render_traceback_()`` method which returns a list of strings, each | |||
|
13 | containing one line of the traceback. |
General Comments 0
You need to be logged in to leave comments.
Login now