upstart-monitor cannot run without gtk libraries installed

Bug #1235245 reported by James Hunt on 2013-10-04
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
upstart
Undecided
Unassigned
upstart (Ubuntu)
Undecided
Unassigned

Bug Description

"upstart-monitor -n" should revert to cli operation. It attempts to do this, but then barfs on class UpstartEventsGui(Gtk.Window) since Gtk is not imported unless the required gtk libraries are installed.

Barry Warsaw (barry) wrote :

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.)

Barry Warsaw (barry) wrote :

Oh, and minor style issue while I'm here. :)

`if cli == True:` is better written just `if cli:`

We generally don't test explicit equality against True or False.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers