2023-01-11 13:04:19 +08:00
|
|
|
|
import sys
|
2023-03-31 11:15:44 +08:00
|
|
|
|
|
|
|
|
|
from PyQt5.QtWidgets import *
|
|
|
|
|
|
2023-10-29 23:15:46 +08:00
|
|
|
|
import app.DataBase.data as DB
|
2023-01-11 13:04:19 +08:00
|
|
|
|
from app.Ui import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ViewController:
|
2023-04-02 21:23:20 +08:00
|
|
|
|
def __init__(self):
|
|
|
|
|
self.viewMainWIn = None
|
|
|
|
|
self.viewDecrypt = None
|
|
|
|
|
|
2023-01-11 13:04:19 +08:00
|
|
|
|
def loadDecryptView(self):
|
|
|
|
|
"""
|
|
|
|
|
登录界面
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
2023-10-29 23:15:46 +08:00
|
|
|
|
if DB.is_db_exist():
|
|
|
|
|
self.loadMainWinView()
|
|
|
|
|
else:
|
|
|
|
|
self.viewDecrypt = decrypt.DecryptControl() # 需要将view login设为成员变量
|
|
|
|
|
self.viewDecrypt.DecryptSignal.connect(self.loadMainWinView)
|
|
|
|
|
self.viewDecrypt.registerSignal.connect(self.loadRegisterView)
|
|
|
|
|
self.viewDecrypt.show()
|
|
|
|
|
self.viewDecrypt.db_exist()
|
2023-01-11 13:04:19 +08:00
|
|
|
|
|
|
|
|
|
def loadRegisterView(self):
|
|
|
|
|
"""
|
|
|
|
|
注册界面
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
2023-03-31 11:15:44 +08:00
|
|
|
|
pass
|
2023-04-02 21:23:20 +08:00
|
|
|
|
# self.viewDecrypt = register.registerControl() # 需要将view login设为成员变量
|
2023-03-31 11:15:44 +08:00
|
|
|
|
# self.viewDecrypt.DecryptSignal.connect(self.loadDecryptView)
|
|
|
|
|
# self.viewDecrypt.show()
|
2023-01-11 13:04:19 +08:00
|
|
|
|
|
2023-10-29 23:15:46 +08:00
|
|
|
|
def loadMainWinView(self, username=None):
|
2023-01-11 13:04:19 +08:00
|
|
|
|
"""
|
|
|
|
|
聊天界面
|
|
|
|
|
:param username: 账号
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
|
|
|
|
username = ''
|
|
|
|
|
self.viewMainWIn = mainview.MainWinController(username=username)
|
|
|
|
|
self.viewMainWIn.setWindowTitle("Chat")
|
|
|
|
|
# print(username)
|
|
|
|
|
self.viewMainWIn.username = username
|
|
|
|
|
# self.viewMainWIn.exitSignal.connect(self.loadDecryptView) # 不需要回到登录界面可以省略
|
|
|
|
|
self.viewMainWIn.show()
|
|
|
|
|
# self.viewMainWIn.signUp()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
app = QApplication(sys.argv)
|
|
|
|
|
view = ViewController()
|
2023-05-21 00:19:25 +08:00
|
|
|
|
view.loadDecryptView() # 进入登录界面,如果view login不是成员变量,则离开作用域后失效。
|
|
|
|
|
# view.loadMainWinView('102')
|
2023-01-11 13:04:19 +08:00
|
|
|
|
sys.exit(app.exec_())
|