Modernization of Codetools code

This PR adds a couple of small but useful features:
* a switch to let multicontexts choose whether to veto subcontext events,
* a context manager for defer_events so that you can defer events in a with statement.
Also, this replaces the adaptation mechanism with the new traits adaptation mechanism throughout.

Finally there is general code-clean-up, adding copyrights, using absolute imports, etc.

These changes should be API backwards-compatible.

This doesn't fix Blocks to use the AST module, though :)