Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import functools
- from gi.repository import GObject
- from gi.repository import Gio
- from gi.repository import GLib
- def runloop(func):
- @functools.wraps(func)
- def wrapped(*pargs, **kwargs):
- func(None)
- mc = GLib.main_context_default()
- print(mc)
- ml = GLib.MainLoop.new(mc, True)
- print(ml)
- print("run")
- ml.run()
- return wrapped
- @runloop
- def main(loop):
- print("main")
- vm = Gio.VolumeMonitor.get()
- for sig in GObject.signal_list_names(Gio.VolumeMonitor):
- print(sig)
- vm.connect(sig, functools.partial(print, sig))
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement