From 4d773bd76970fccbcc1abda62b534bc27385bc16 Mon Sep 17 00:00:00 2001 From: warner Date: Wed, 7 Feb 2007 08:31:15 +0100 Subject: [PATCH] update bb_applet.py, adding prefs and connect/disconnect controls --- ChangeLog | 8 ++++++++ contrib/bb_applet.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c93cde6..269c87b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-02-06 Brian Warner + * contrib/bb_applet.py (MyApplet.filled): add a small prefs + dialog, to allow you to reset the buildmaster and force + connect/disconnect. Correctly handle losing the buildmaster + connection (by switching the display to the hexnut, at which point + you can use the 'Connect' menu item to reconnect). + +2007-02-06 Brian Warner + * buildbot/steps/source.py (Source.start): if we're using a patch, add it as a LogFile to the checkout/update step. This will turn into a link on the waterfall page. diff --git a/contrib/bb_applet.py b/contrib/bb_applet.py index 4562073..1abdc3d 100644 --- a/contrib/bb_applet.py +++ b/contrib/bb_applet.py @@ -41,8 +41,12 @@ import gnomeapplet # preferences are not yet implemented MENU = """ - + + + """ @@ -145,6 +149,8 @@ class MyApplet(pb.Referenceable): container.set_size_request(self.size, self.size) self.fill_nut() verbs = [ ("Props", self.menu_preferences), + ("Connect", self.menu_connect), + ("Disconnect", self.menu_disconnect), ] container.setup_menu(MENU, verbs) self.boxes = {} @@ -184,7 +190,10 @@ class MyApplet(pb.Referenceable): self.tips = gtk.Tooltips() self.tips.enable() - def disconnected(self): + def disconnect(self): + self.remote.broker.transport.loseConnection() + + def disconnected(self, *args): print "disconnected" self.fill_nut() @@ -238,9 +247,50 @@ class MyApplet(pb.Referenceable): def remote_stepFinished(self, buildername, build, stepname, step, results): pass - def menu_preferences(self, event, data=None): print "prefs!" + p = Prefs(self) + p.create() + + def set_buildmaster(self, buildmaster): + host, port = buildmaster.split(":") + self.buildmaster = host, int(port) + self.disconnect() + reactor.callLater(0.5, self.connect) + + def menu_connect(self, event, data=None): + self.connect() + + def menu_disconnect(self, event, data=None): + self.disconnect() + + +class Prefs: + def __init__(self, parent): + self.parent = parent + + def create(self): + self.w = w = gtk.Window() + v = gtk.VBox() + h = gtk.HBox() + h.pack_start(gtk.Label("buildmaster (host:port) : ")) + self.buildmaster_entry = b = gtk.Entry() + if self.parent.buildmaster: + host, port = self.parent.buildmaster + b.set_text("%s:%d" % (host, port)) + h.pack_start(b) + v.add(h) + + b = gtk.Button("Ok") + b.connect("clicked", self.done) + v.add(b) + + w.add(v) + w.show_all() + def done(self, widget): + buildmaster = self.buildmaster_entry.get_text() + self.parent.set_buildmaster(buildmaster) + self.w.unmap() -- 2.11.4.GIT