Advertisement
Guest User

mon 3eme prog python, O joie..

a guest
Feb 17th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.04 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: UTF8 -*-
  3.  
  4. import gobject
  5. import gtk
  6. import appindicator
  7. import pynotify
  8. import sys
  9. import time
  10. import threading
  11. import os
  12.  
  13. ico1 = "img/02.png"
  14. ico2 = "img/03.png"
  15.  
  16. def menuitem_response(w, optionName):
  17.     print "menu response:", optionName
  18.  
  19. def quitApplication(w, optionName):
  20.     sys.exit(0)
  21.  
  22.  
  23. def sauce():
  24.     ind = appindicator.Indicator("example-simple-client",
  25.                                   ico1, #"indicator-messages",
  26.                                   appindicator.CATEGORY_APPLICATION_STATUS)
  27.  
  28.     ind.set_status(appindicator.STATUS_ACTIVE)
  29.     ind.set_attention_icon(ico2)
  30.     menu = gtk.Menu()
  31.     ind.set_menu(menu)
  32.  
  33.     return ind
  34.  
  35.  
  36. """
  37.    # create a menu (ca marche mais c'est pas ce que je veux)
  38.    menu = gtk.Menu()
  39.  
  40.    # create some drop down options
  41.    optionName = "Menu Option"
  42.    menu_items = gtk.MenuItem(optionName)
  43.    menu.append(menu_items)
  44.    menu_items.connect("activate", menuitem_response, optionName)
  45.    menu_items.show()
  46.  
  47.    optionName = "Menu Option 2"
  48.    menu_items = gtk.MenuItem(optionName)
  49.    menu.append(menu_items)
  50.    menu_items.connect("activate", menuitem_response, optionName)
  51.    menu_items.show()
  52.  
  53.    optionName = "Quit"
  54.    menu_items = gtk.MenuItem(optionName)
  55.    menu.append(menu_items)
  56.    menu_items.connect("activate", quitApplication, optionName)
  57.    menu_items.show()
  58.  
  59.    ind.set_menu(menu)
  60.    return ind
  61. """
  62.  
  63.  
  64.  
  65. def thr():
  66.     pass
  67.  
  68. def thr2():
  69.     print 0. # eh ouais.. j'en suis la =)
  70.     time.sleep(3)
  71.     print 1.
  72.     ind.set_status(appindicator.STATUS_ATTENTION)
  73.     time.sleep(4)
  74.     print 2.
  75.     ind.set_status(appindicator.STATUS_ACTIVE)
  76.     time.sleep(2)
  77.     print 3.
  78. #   raw_input("::")
  79. #   print 4.
  80.     #gtk.main_quit()
  81.     #os.kill(pid, 9)
  82.     """ osd notif: ok
  83.     pynotify.init('wallch_indicator')
  84.     n = pynotify.Notification('ah que coucou', 'meuh', 'notification-message-im')
  85.     n.show()
  86.     time.sleep(4)
  87.     print 5.
  88.     """
  89.  
  90.     exit(0)
  91.  
  92. gobject.threads_init()
  93. ind = sauce()
  94. t = threading.Thread(target=thr2)
  95. t.start()
  96.  
  97. gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement