def openLoginDialog(self): self.login_dialog = LoginDialog(self.main_window) self.login_dialog.exec_() if self.login_dialog.result(): username = str(self.login_dialog.username_line.text()) password = str(self.login_dialog.password_line.text()) if username and password: remember = self.login_dialog.remember_checkbox.isChecked() self.handleLoginData(username, password, remember)
def init_menu(parent): parent.login = LoginDialog(parent) parent.add_player.triggered.connect(parent.login.exec_) parent.start_game.triggered.connect(parent.init_game) parent.start_game.setDisabled(True) parent.new_game.triggered.connect(lambda: new_game_func(parent)) parent.new_game.setDisabled(True) parent.exit_game.triggered.connect(QApplication.exit) parent.roll_dice.setDisabled(True)
def do_selected(self): if not self.activated: self.activated = True self.shell = self.props.shell self.plugin = self.props.plugin self.player = self.shell.props.shell_player self.db = self.shell.props.db self.entry_type = self.props.entry_type if self.doubanfm == None: if self.login_dialog == None: self.login_dialog = LoginDialog(self.shell) self.login_dialog.connect('login-completed', self.on_login_completed) self.login_dialog.login() self.plugin.show_sidebar(True)
def main(): #you can change databasename at models.__init__ #status = False #if SqlHandler.usesLite(): status = True #os.path.exists(getDBName()) app = QtGui.QApplication(sys.argv) #try: if not SqlHandler.initialize(): print(g_error_msg_dict['database_init']) return if LoginDialog().exec_() == QtGui.QDialog.Accepted: vet_app = MainWindow() Tabmanager.openTab(tabCreator=MainMenuTab) vet_app.showMaximized() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) if len(sys.argv) > 1: config.app_dir = sys.argv[1] if os.path.exists(config.config_path): # User is already registered config.load() dialog = LoginDialog() if dialog.exec() != 1: print("Error: failed to login user\n" "Will exit the program!", file=sys.stderr) sys.exit(1) # Get registered client client = dialog.client else: # User needs to register first # Present the user with the register dialog dialog = RegisterDialog() if dialog.exec() != 1: print("Error: failed to register user\n" "Will exit the program!", file=sys.stderr) sys.exit(1) # Get registered client client = dialog.client window = MainWindow(client) window.refresh() window.adjustSize() window.show() sys.exit(app.exec_())
# -*- coding: utf-8 -*- # python的gui编程 # 主程序,先出现登录界面,登录成功则跳转到主界面 if __name__ == '__main__': import sys from login_dialog import LoginDialog try: from PyQt5.QtWidgets import QApplication except ModuleNotFoundError as e: # 执行时引入 pyqt5库失败时,则使用 pip指令安装 import os print('本机未安装pyqt,正在安装 PyQt5 ...') os.system( 'pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn pyqt5' ) app = QApplication(sys.argv) login_dia = LoginDialog() # 实例化登录窗口 login_dia.show() app.exec_()
from PyQt5.QtWidgets import QApplication from login_dialog import LoginDialog from main_window import MainWindow import sip import sys sip.setapi("QString", 1) if __name__ == "__main__": a = QApplication(sys.argv) a.setStyle("fusion") loginDialog = LoginDialog() isAuth = False result = -1 # while not isAuth: loginDialog.exec_() # if result == loginDialog.Success or result == loginDialog.Rejected: # isAuth = True # else: # isAuth = False isAuth = loginDialog.Success if isAuth == True: w = MainWindow() w.show() a.exec_() # exit(0)
import sys from PyQt5.QtWidgets import QApplication from login_dialog import LoginDialog if __name__ == "__main__": app = QApplication([]) login_dialog = LoginDialog() login_dialog.show() sys.exit(app.exec_())