Exemple #1
0
    def success(self, new_conf):
        config = getConfig()
        if config:
            config.update(new_conf)
            setConfig(config)
        else:
            setConfig(new_conf)

        self.loginBtn.hide()
        self.logoutBtn.show()
Exemple #2
0
 def Logout(self):
     config = getConfig()
     if config:
         config.update(empty_conf)
         setConfig(config)
     else:
         setConfig(empty_conf)
     self.logoutBtn.hide()
     self.loginBtn.show()
     self.setUIEnabled(True)
     msg = ''
     self.setStatusL(msg)
Exemple #3
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle("Login to Kitsu")
        self.setMinimumSize(250, 175)
        layout = self.layout = QVBoxLayout()

        # setup widgets
        self.url = QLineEdit()
        self.url.setPlaceholderText('kitsu server address')
        self.username = QLineEdit()
        self.username.setPlaceholderText('email')
        self.password = QLineEdit()
        self.password.setPlaceholderText('password')
        self.password.setEchoMode(QLineEdit.Password)

        self.status = QHBoxLayout()
        self.statusL = QLabel()
        self.status.addWidget(self.statusL)
        self.status.addStretch()

        self.loginBtn = QPushButton('login')
        self.loginBtn.clicked.connect(self.Login)
        self.logoutBtn = QPushButton('log out')
        self.logoutBtn.clicked.connect(self.Logout)
        self.logoutBtn.hide()

        self.buttonBox = QHBoxLayout()
        self.buttonBox.addStretch()
        self.buttonBox.addWidget(self.loginBtn)
        self.buttonBox.addWidget(self.logoutBtn)
        self.buttonBox.addStretch()

        # Setup Layouts
        layout.addWidget(self.url)
        layout.addWidget(self.username)
        layout.addWidget(self.password)
        layout.addLayout(self.status)
        layout.addStretch()
        layout.addLayout(self.buttonBox)
        self.setLayout(layout)

        self.curr_conf = getConfig()
        if self.curr_conf:
            self.url.setText(str(self.curr_conf['kitsu_url']))
            self.username.setText(str(self.curr_conf['kitsu_email']))
            self.password.setText(str(self.curr_conf['kitsu_password']))
            self.setUIEnabled(False)
            threading.Thread(target=self.threadedAuthenticate,
                             args=(self.curr_conf, )).start()