Gui cleanup: pyflakes fixes, py3 compatibility