Show More
@@ -18,7 +18,7 b' class EventManager(object):' | |||||
18 | """Manage a collection of events and a sequence of callbacks for each. |
|
18 | """Manage a collection of events and a sequence of callbacks for each. | |
19 |
|
19 | |||
20 | This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` |
|
20 | This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell` | |
21 |
instances as a |
|
21 | instances as an ``events`` attribute. | |
22 |
|
22 | |||
23 | .. note:: |
|
23 | .. note:: | |
24 |
|
24 | |||
@@ -38,7 +38,7 b' class EventManager(object):' | |||||
38 | self.callbacks = {n:[] for n in available_events} |
|
38 | self.callbacks = {n:[] for n in available_events} | |
39 |
|
39 | |||
40 | def register(self, event, function): |
|
40 | def register(self, event, function): | |
41 | """Register a new callback |
|
41 | """Register a new event callback | |
42 |
|
42 | |||
43 | Parameters |
|
43 | Parameters | |
44 | ---------- |
|
44 | ---------- | |
@@ -87,7 +87,7 b' class EventManager(object):' | |||||
87 | # event_name -> prototype mapping |
|
87 | # event_name -> prototype mapping | |
88 | available_events = {} |
|
88 | available_events = {} | |
89 |
|
89 | |||
90 |
def _ |
|
90 | def _define_event(callback_proto): | |
91 | available_events[callback_proto.__name__] = callback_proto |
|
91 | available_events[callback_proto.__name__] = callback_proto | |
92 | return callback_proto |
|
92 | return callback_proto | |
93 |
|
93 | |||
@@ -98,31 +98,31 b' def _collect(callback_proto):' | |||||
98 | # signatures of callbacks for those events. |
|
98 | # signatures of callbacks for those events. | |
99 | # ------------------------------------------------------------------------------ |
|
99 | # ------------------------------------------------------------------------------ | |
100 |
|
100 | |||
101 | @_collect |
|
101 | @_define_event | |
102 | def pre_execute(): |
|
102 | def pre_execute(): | |
103 | """Fires before code is executed in response to user/frontend action. |
|
103 | """Fires before code is executed in response to user/frontend action. | |
104 |
|
104 | |||
105 | This includes comm and widget messages as well as user code cells.""" |
|
105 | This includes comm and widget messages as well as user code cells.""" | |
106 | pass |
|
106 | pass | |
107 |
|
107 | |||
108 | @_collect |
|
108 | @_define_event | |
109 | def pre_run_cell(): |
|
109 | def pre_run_cell(): | |
110 | """Fires before user-entered code runs.""" |
|
110 | """Fires before user-entered code runs.""" | |
111 | pass |
|
111 | pass | |
112 |
|
112 | |||
113 | @_collect |
|
113 | @_define_event | |
114 | def post_execute(): |
|
114 | def post_execute(): | |
115 | """Fires after code is executed in response to user/frontend action. |
|
115 | """Fires after code is executed in response to user/frontend action. | |
116 |
|
116 | |||
117 | This includes comm and widget messages as well as user code cells.""" |
|
117 | This includes comm and widget messages as well as user code cells.""" | |
118 | pass |
|
118 | pass | |
119 |
|
119 | |||
120 | @_collect |
|
120 | @_define_event | |
121 | def post_run_cell(): |
|
121 | def post_run_cell(): | |
122 | """Fires after user-entered code runs.""" |
|
122 | """Fires after user-entered code runs.""" | |
123 | pass |
|
123 | pass | |
124 |
|
124 | |||
125 | @_collect |
|
125 | @_define_event | |
126 | def shell_inited(ip): |
|
126 | def shell_inited(ip): | |
127 | """Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`. |
|
127 | """Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`. | |
128 |
|
128 |
General Comments 0
You need to be logged in to leave comments.
Login now