def login_action(self): # loginButton = loginapp.main_ui.loginButton loginButton.clicked.connect(self.login1) proxyButton.clicked.connect(self.chooseserver) lo_textaccount.editingFinished.connect(self.root) if loginmode == "2": login(acc, pd)
def testserver(self): try: serverversion = login('ConnectTest', 123) print(serverversion) reply = QMessageBox.information(self, "测试结果", "服务器版本:" + serverversion, QMessageBox.Yes) except: reply = QMessageBox.information(self, "测试结果", "无法连接至服务器", QMessageBox.Yes) return 0
def login1(self): loginButton.setEnabled(False) acc = lo_textaccount.text() pd = lo_textpassword.text() # 获取密码和账号 re = int(login(acc, pd)) if (re == 0): loginButton.setText("登录成功") loginapp.close() Imapp.show() Im_reload("xutongxin") elif (re == 2): loginButton.setEnabled(True) loginButton.setText("用户不存在") elif (re == 404): loginButton.setEnabled(True) loginButton.setText("服务器异常") else: loginButton.setEnabled(True) loginButton.setText("密码错误")