from twisted.internet import reactor
from twisted.spread import pb
-import sys, gtk, gnomeapplet, pynotify
+import sys, os, gtk, gnomeapplet, pynotify
from bbclient import BuildbotClient, CommandLineOptions
class BuildbotApplet(pb.Referenceable):
def remote_buildFinished(self, buildername, build, result):
- n = pynotify.Notification('Build finished', buildername)
+ urgency = pynotify.URGENCY_LOW
+ message = 'Build succeeded'
+ expiry = pynotify.EXPIRES_DEFAULT
+ image = None
+
+ if result > 0:
+
+ urgency = pynotify.URGENCY_CRITICAL
+ message = 'Build failed!'
+ expiry = pynotify.EXPIRES_NEVER
+ image = 'file://' + os.path.abspath(os.path.curdir) + \
+ '/applet-critical.png'
+
+ n = pynotify.Notification(message, buildername, image)
+
+ n.set_urgency(urgency)
+ n.set_timeout(expiry)
- n.set_urgency(pynotify.URGENCY_LOW)
- n.set_category('eep')
n.attach_to_widget(self.applet)
n.show()