setup: Only import sys when needed

We only need it when an exception is raised, which should
hopefully never happen.

As such, let's avoid importing a module we should never use.
setup: Properly set the WM_CLASS property

Before this commit, the settings window for Quick would be called
"Cangjie settings" in GNOME Shell.

That's because the WM_CLASS property was incorrectly set automatically
to the program name: ibus-setup-cangjie

We need to set it (based on the engine specified as an argument), and
that must happen before importing Gtk.