Split non-GUI bits into separate modules

Tests now run without PyGTK/PyGObject installed.
Add a tox.ini
PEP-8