Monday, 13 July 2009

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

1 comment:

  1. Lenovo has three.three million individuals in around 60 countries across the company , owns a big smartphone home business . Lenovo's most generally held stocks , but about 32 % in the shares dominated by Legend Holdings .

    ReplyDelete