Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys, os
  4. from PyQt4 import QtGui, QtCore
  5.  
  6. class MediaFeed(QtGui.QSystemTrayIcon):
  7.  
  8. def __init__(self, icon, parent=None):
  9. QtGui.QSystemTrayIcon.__init__(self, icon, parent)
  10.  
  11. menu = QtGui.QMenu()
  12.  
  13. aboutAction = menu.addAction("About")
  14. aboutAction.triggered.connect(self.aboutMenu)
  15.  
  16. exitAction = menu.addAction("Exit")
  17. exitAction.triggered.connect(QtGui.qApp.quit)
  18.  
  19. self.setContextMenu(menu)
  20. self.activated.connect(self.systemIcon)
  21.  
  22. def aboutMenu(self):
  23. print "This should be some information."
  24.  
  25. def systemIcon(self, reason):
  26. w = QtGui.QWidget()
  27. if reason == QtGui.QSystemTrayIcon.Trigger:
  28. print "Clicked."
  29. w.show()
  30.  
  31.  
  32. def main():
  33.  
  34. app = QtGui.QApplication(sys.argv)
  35. mediaFeed = MediaFeed(QtGui.QIcon("mediaIcon.png"), None)
  36.  
  37. mediaFeed.show()
  38. sys.exit(app.exec_())
  39.  
  40.  
  41. if __name__ == '__main__':
  42. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement