示例#1
0
def log_in_or_out(login):
   
   MainLoop,DBusGMainLoop,CredentialsManagementTool = import_globals()

   global _login_success
   _login_success = False

   DBusGMainLoop(set_as_default=True)
   loop = MainLoop()
   
   def quit(result):
      global _login_success
      loop.quit()
      if result:
         _login_success = True

   cd = CredentialsManagementTool()
   if login:
      d = cd.login()
   else:
      d = cd.clear_credentials()
   d.addCallbacks(quit)
   loop.run()
   if not _login_success and login:
      sys.exit(1)
示例#2
0
    def login(self):
	    from gobject import MainLoop
	    from dbus.mainloop.glib import DBusGMainLoop
	    from ubuntuone.platform.credentials import CredentialsManagementTool

	    self.login_success = False

	    DBusGMainLoop(set_as_default=True)
	    loop = MainLoop()

	    def quit(result):
		    loop.quit()
		    if result:
			    self.login_success = True

	    cd = CredentialsManagementTool()
	    d = cd.login()
	    d.addCallbacks(quit)
	    loop.run()
	    return self.login_success
示例#3
0
def login():
    from gobject import MainLoop
    from dbus.mainloop.glib import DBusGMainLoop
    from ubuntuone.platform.credentials import CredentialsManagementTool

    global _login_success
    _login_success = False

    DBusGMainLoop(set_as_default=True)
    loop = MainLoop()

    def quit(result):
        global _login_success
        loop.quit()
        if result:
            _login_success = True

    cd = CredentialsManagementTool()
    d = cd.login()
    d.addCallbacks(quit)
    loop.run()
    if not _login_success:
        sys.exit(1)
示例#4
0
 def get_ubuntuone_credentials(self):
     cmt = CredentialsManagementTool()
     return cmt.find_credentials()