Initial version of buildbot GNOME applet.
authorTim Potter <tpot@hp.com>
Tue, 8 Apr 2008 06:43:13 +0000 (16:43 +1000)
committerTim Potter <tpot@hp.com>
Tue, 8 Apr 2008 06:43:13 +0000 (16:43 +1000)
Currently only displays notifications for start and stop builds.

bbapplet

index b60ada4..313cb4b 100755 (executable)
--- a/bbapplet
+++ b/bbapplet
@@ -7,14 +7,61 @@ from twisted.internet import gtk2reactor
 gtk2reactor.install()
 
 from twisted.internet import reactor
+from twisted.spread import pb
 
 import sys, gtk, gnomeapplet, pynotify
+from bbclient import BuildbotClient
 
-class BuildbotApplet:
+HOST = 'localhost'
+PORT = 1234
+USER = 'statusClient'
+PASS = 'clientpw'
+
+class BuildbotApplet(pb.Referenceable):
       
-      def __init__(self, applet, icon):
-        applet.add(icon)
-        applet.show_all()
+    def __init__(self, applet, icon):
+
+        self.applet = applet
+
+        self.applet.add(icon)
+        self.applet.show_all()
+
+        client = BuildbotClient()
+
+        d = client.connect(HOST, PORT, USER, PASS)
+
+        d.addCallback(lambda arg: client.subscribe('builds', 5, self))
+
+    # Callbacks for subscription mode >= MODE_BUILDERS
+
+    def remote_builderAdded(self, buildername, builder):
+        pass
+
+    def remote_builderRemoved(self, buildername):
+        pass
+
+    def remote_builderChangedState(self, buildername, statename, eta):
+        pass
+
+    # Callbacks for subscription mode >= MODE_BUILDS
+
+    def remote_buildStarted(self, buildername, build):
+        
+        n = pynotify.Notification('Build started', buildername)
+
+        n.set_urgency(pynotify.URGENCY_LOW)
+        n.set_category('eep')
+        n.attach_to_widget(self.applet)
+        n.show()
+
+    def remote_buildFinished(self, buildername, build, result):
+
+        n = pynotify.Notification('Build finished', buildername)
+
+        n.set_urgency(pynotify.URGENCY_LOW)
+        n.set_category('eep')
+        n.attach_to_widget(self.applet)
+        n.show()
 
 def BuildbotApplet_factory(applet, iid):