ipython/ipython — pull request #4195 by minrk (2013-09-11 22:41:11+00:00)
Title: Add basic implementation of widget messages

Will do further writeups of the message spec in an IPEP,
but this is an initial implementation of widget messages.

It is fully symmetrical - both sides have a WidgetManager,
which contains two mappings:

1. mapping of widget_type to constructor for creating widget peers (handle widget_create)
2. mapping of widget_id to Widget instance

and Widgets on both sides have the same simple API as well:

- `create(data)`, `update(data)`, `destroy(data)` send messages, while
- `handle_create(data)`, `handle_update(data)`, `handle_destroy(data)` handle them coming from the other side.

To test this, I have implemented a few toy widgets, such as:

- **Range**, with an HTML slider, where moving the slider updates Python traits,
and changing Python traits updates the slider.
- simple **Flot** widget that lets you plot with flot
- Combine these two for plotting sin(Ωt), where Ω is linked to a Range,
and moving the slider redraws the plot
- **RPC** widget created from the Javascript side,
allowing javascript code, such as

```javascript
widget.add(5,6);
```

to actually result a Python API call with the same arguments.

It's pretty basic, but it seems to work reasonably well.

I still need to polish the documentation and tests before merge.