Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
71
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 gi # pylint: disable=import-error
  4. gi.require_version('NM', '1.0') # NOQA: F402
  5. from gi.repository import Gio, GLib, NM # pylint: disable=import-error
  6.  
  7. nmclient = NM.Client.new()
  8.  
  9. cp_flag = ( NM.CheckpointCreateFlags.DESTROY_ALL |
  10. NM.CheckpointCreateFlags.DELETE_NEW_CONNECTIONS |
  11. NM.CheckpointCreateFlags.DISCONNECT_NEW_DEVICES)
  12.  
  13. cp = None
  14.  
  15. main_loop = GLib.MainLoop()
  16.  
  17. def create_cb(client, result, data):
  18. try:
  19. data = nmclient.checkpoint_create_finish(result)
  20. print("%s" % data.get_path())
  21. except Exception as e:
  22. sys.stderr.write("Failed: %s\n" % e.message)
  23. main_loop.quit()
  24.  
  25.  
  26. nmclient.checkpoint_create([], 0, cp_flag, None, create_cb, cp)
  27. nmclient.checkpoint_create([], 0, cp_flag, None, create_cb, cp)
  28.  
  29. main_loop.run()
  30.  
  31. main_loop.quit()
  32.  
  33. nmclient.checkpoint_create([], 0, cp_flag, None, create_cb, cp)
  34. main_loop.run()
  35. main_loop.quit()
  36.  
  37. print("HAHA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement