ipython/ipython — pull request #5666 by takluyver (2014-04-18 19:13:01+00:00)
Title: Refactor inputhook to allow easy extension

Not ready for merge

Prompted by #5645, @minrk suggested that we should provide an extension mechanism for input hooks, so that that code (which we don't use, test or maintain very much) can be maintained outside IPython. This is a prototype of that.

To define a new GUI integration, you register a class like this:

```python
from IPython.lib.inputhook import register, InputHookBase

@register('clutter')
class ClutterInputHook(InputHookBase):
def enable(self, app=None):
self.manager.set_inputhook(inputhook_clutter)
```

It can also define a `disable()` method, but only one of the 7 we include needs that. Once this code has run (e.g. by importing a module or using `%load_ext`), the user should be able to do `%gui clutter`.