def __action_login(self, widget):
        """ Login action. """
        # create the login dialog
        dialog = LoginDialog()
        response = dialog.run()

        if response == Gtk.ResponseType.OK:
            username = dialog.username_entry.get_text().strip()
            password = dialog.password_entry.get_text().strip()
            if username and password:
                try:
                    self.client.login(username, password)
                    # setup the username and the password
                    self.settings["username"] = username
                    self.settings["password"] = password

                    self.collect_source.load()
                    self.__set_playlists()

                    widget.set_label(_("Logout"))
                    widget.set_tooltip(_("Sign out the baidu music."))
                except Exception as e:
                    print e
        elif response == Gtk.ResponseType.CANCEL:
            pass
        dialog.destroy()
예제 #2
0
 def addUsers(self, master):
     login = LoginDialog(master)
     if login.result == 1:
         adminPage = admin.AdminPage(master, self)
예제 #3
0
def login():
    dialog = LoginDialog()
    if dialog.exec_():
         return True