Python and CCTray Again

So after creating a python script that would use my tux droid to notify me when a build failed I decided to extend the script a little further. I decoupled it from the tux droid code and added in a status menu. It still requires that CruiseControl.NET has the webdashboard installed. This is my first venture into using GTK with python, as well as threads.

One of the problems that I encountered when trying to use thread was that they were not behaving correctly. The Thread would appear to start however it would not run. This was easy to fix but adding the following line to initialize the threading.

gtk.gdk.threads_init()

In addition to this the class that was running the thread not only had to inherit from the threading.Thread object but had to explicitly call the init on the threads base class

class ccnetworker(threading.Thread):

	# init
	def __init__(self,xmlPath,pycctray):
		threading.Thread.__init__(self)
		self.xmlPath = xmlPath
		self.pycctray = pycctray

Below is a screen shot of the system tray menu, listing the projects that are available to be force built.

pycctray screenshot

# example usage
python pycctray.py http://localhost/ccnet/XmlServerReport.aspx

You can get the latest source from the bazaar repository

bzr branch http://bzr.yeticode.co.uk/pycctray

Alternatively you can download the source files on their own: pycctray.tar.gz

Related Posts:

This entry was posted in Development Log and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>