Remove unused imports

I don't think this really change anything worth backward compatibility,
and anyway it's a 2009 change, we broke the Palettes API a lot with gtk3.
Remove various unused bits
Silence pyflake
Run pyflakes on make check