[PyKDE] KSystemTray issues

Shahar Weiss sweiss4 at gmx.net
Tue Jun 21 17:47:31 BST 2005


Thank you, this way I was able to set the application's name, thanks a lot.

Still I wasn't able to find a way of replacing the icon beside it. I looked at 
KDE's reference regarding KAboutData which had a setProgramLogo() method. 
This method however wasn't present in the python object.

Can you please help me with that?

Thanks again,
Shahar.

On Tuesday 21 June 2005 15:04, you wrote:
> Your application doesn't seems to have a name.
> I had the same problem when using KStdAction to generate the help menu.
>
> To give a name to your application, you must use KAboutData
>
> This is a modified example of an application I'm developping :
>
> from xxx import version
>
> def getAboutData():
>     # Adding informations about the program
>     aboutData = KAboutData(version.__program__, version.__program__,
>                            version.__version__, version.__description__,
>                            KAboutData.License_GPL_V2,
> version.__copyright__) for author in version.__authors__:
>         aboutData.addAuthor(author["name"], "", author["email"])
>     aboutData.setBugAddress(version.__bugs__)
>
>     return aboutData
>
> if __name__ == "__main__":
>     # Adding some parameters to the application
>     sys.argv.extend(['--icon', 'source_py', '--caption',
>                      version.__description__ + ' v' + version.__version__])
>     aboutData = getAboutData()
>
>     # Initialisation with KCmdLineArgs to use KAboutData
>     KCmdLineArgs.init(sys.argv, aboutData)
>     # Adding command line options
>     KCmdLineArgs.addCmdLineOptions([("+file", "xxx file to open", "")])
>
>     # KApplication with empty arguments, as the application
>     # instance is already created
>     kapp = KApplication()
>
> Shahar Weiss wrote:
> >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.
> >
> >_______________________________________________
> >PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> >http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list