Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import functools
  2. from gi.repository import GObject
  3. from gi.repository import Gio
  4. from gi.repository import GLib
  5.  
  6.  
  7. def runloop(func):
  8. @functools.wraps(func)
  9. def wrapped(*pargs, **kwargs):
  10. func(None)
  11.  
  12. mc = GLib.main_context_default()
  13. print(mc)
  14. ml = GLib.MainLoop.new(mc, True)
  15. print(ml)
  16.  
  17. print("run")
  18. ml.run()
  19. return wrapped
  20.  
  21.  
  22. @runloop
  23. def main(loop):
  24. print("main")
  25. vm = Gio.VolumeMonitor.get()
  26. for sig in GObject.signal_list_names(Gio.VolumeMonitor):
  27. print(sig)
  28. vm.connect(sig, functools.partial(print, sig))
  29.  
  30.  
  31. if __name__ == '__main__':
  32. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement