[PyKDE] KSystemTray issues

Shahar Weiss sweiss4 at gmx.net
Tue Jun 21 14:34:16 BST 2005


Hello everyone.
I have a little problem with a python script of mine, using the KSystemTray 
widget.

This is the code below (dirty I know), and here's a link to a screenshot: 
http://members.lycos.co.uk/sweiss3/extra/menu.png

The problem is the "unknown" caption which appears on top of the system tray 
icon's menu. Can you please tell me what I'm doing wrong?

Here's the code:

from qt import *
from kdecore import *
from kdeui import *
from updateform import *
import sys
if __name__ == "__main__":
	def processUpdateFile(fileString, ListView):
		updateFile = open(fileString, 'r')
		packageList = updateFile.readlines()
		updateFile.close()
		for i in range(len(packageList)):
			packageString=packageList[i].split(' ')
			package = QListViewItem(ListView, packageString[0], packageString[1], 
packageString[2])

	app = KApplication(sys.argv, "Updater")
	form = UpdateForm()
	trayicon = KSystemTray(form, "System Updater")
	trayicon.setPixmap( QPixmap("konsole.png") )
	trayicon.setCaption("New updates are available")
	trayicon.contextMenu().insertTitle("System Update")
#	b=KPopupMenu()
#	b.insertTitle("Testing")
#	trayicon.contextMenuAboutToShow(b)
	trayicon.show()
	form.show()
	processUpdateFile('/home/sweiss/testpac.txt',form.packageListView)
	app.setMainWidget(form)
	app.exec_loop()
	trayicon.hide()


Thanks in advance,
Shahar.




More information about the PyQt mailing list