From pykde Thu Feb 19 10:58:29 2009 From: Philippe Fremy Date: Thu, 19 Feb 2009 10:58:29 +0000 To: pykde Subject: [PyQt] Problems with QSystemTrayIcon Message-Id: <499D3B55.4010709 () freehackers ! org> X-MARC-Message: https://marc.info/?l=pykde&m=123504170325021 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------090204010800030206060906" This is a multi-part message in MIME format. --------------090204010800030206060906 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, I am having problem to get QSystemTrayIcon to work. I am running on windows XP and I never see any notification messages. My setup: windows XP, PyQt 4.3.3, python 2.5 See my attached simplified code, that runs standalone. Any idea what I could be doing wrong ? cheers, Philippe --------------090204010800030206060906 Content-Type: image/png; name="croquemonster.png" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="croquemonster.png" iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAmElEQVR4nJVSuQ2AMAw8I9ag gAIGYD1KJBiOCWgZA5ApLBnH5lGsFIlzdz47IV565ESRhQZQunM1ti6zDSsAZhABAKmlCI20 29I32gKKNxsq6Ti+B4uTvZMrI9oipJTN/EypGltnL3mH/WBnXWvK8hWaubN6x8kAffWgloRT Tx1CJJZUWw0gnVtCkIvHHh6ajuN/S1Lu974A60tXe5TFuuoAAAAASUVORK5CYII= --------------090204010800030206060906 Content-Type: text/plain; name="example_qsystemtray.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="example_qsystemtray.py" # -*- coding: latin1 -*- # vim: set fileencoding=latin1 # # PyTiCroque - Copyright Philippe Fremy 2009 # # This file is released under the BSD License, see the accompanying file LICENSE.txt # import locale, sys locale.setlocale( locale.LC_ALL, '' ) from PyQt4 import QtGui, QtCore def dbg( s ): print (u'PTCrWindow: %s' % s).encode( locale.getlocale()[1] ) class PTCrWindow( QtGui.QTextEdit ): def __init__( self ): QtGui.QTextEdit.__init__( self ) self.initAppIcon() self.initSystray() self.timer = QtCore.QTimer() self.timer.start( 2 * 1000 ) QtCore.QObject.connect( self.timer, QtCore.SIGNAL('timeout()'), self.addMsg ) self.appendEvent( 'QPyTiCroque is alive !' ) def initAppIcon( self ): pixmap = QtGui.QPixmap( 'croquemonster.png' ) dbg( 'pixmap size: %dx%d' % (pixmap.width(), pixmap.height()) ) self.appIcon = QtGui.QIcon( pixmap ) self.setWindowIcon( self.appIcon ) def initSystray( self ): self.systray = QtGui.QSystemTrayIcon( self.appIcon , self ) self.systray.setToolTip( 'PyTiCroque' ) self.systray.show() dbg( 'SystemTray available: %s' % str( bool ( QtGui.QSystemTrayIcon.isSystemTrayAvailable() ) ) ) dbg( 'SystemTray supports messages: %s' % str( bool ( self.systray.supportsMessages() ) ) ) def addMsg( self ): self.appendEvent( 'timer event!' ) def appendEvent( self, s ): dbg( s ) self.append( s ) self.systray.showMessage( QtCore.QString(u'Evenement PyTiCroque'), QtCore.QString(s), QtGui.QSystemTrayIcon.Information, 100 * 1000 ) DEBUG_FLAG=False def main(): app = QtGui.QApplication([]) w = PTCrWindow() w.show() app.exec_() w.systray.hide() app.processEvents() if __name__ == '__main__': main() --------------090204010800030206060906 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt --------------090204010800030206060906--