I took a quick look at lp:upstart and it shouldn't be too hard to fix this. There are several classic approaches to doing this, but I think the easiest way is to simply move UpstartEventsGui into a separate module which only gets imported in the `else` clause at the bottom of main(). That's the only reference to this class, and by then you know you have Gtk. Yes, it's perfectly fine to embed an import right there:
...
else:
from .upstart_gui import UpstartEventsGui
win = UpstartEventsGui()
(then you'd move UpstartEventsGui to upstart_gui.py in that directory.)
I took a quick look at lp:upstart and it shouldn't be too hard to fix this. There are several classic approaches to doing this, but I think the easiest way is to simply move UpstartEventsGui into a separate module which only gets imported in the `else` clause at the bottom of main(). That's the only reference to this class, and by then you know you have Gtk. Yes, it's perfectly fine to embed an import right there:
...
else:
from .upstart_gui import UpstartEventsGui
win = UpstartEventsGui()
(then you'd move UpstartEventsGui to upstart_gui.py in that directory.)