WeChatMsg/main.py

81 lines
2.3 KiB
Python
Raw Normal View History

import ctypes
2023-01-11 13:04:19 +08:00
import sys
2023-11-07 22:36:52 +08:00
import time
import traceback
2023-03-31 11:15:44 +08:00
from PyQt5.QtGui import QFont
2023-03-31 11:15:44 +08:00
from PyQt5.QtWidgets import *
2023-12-19 20:54:43 +08:00
from PyQt5.QtCore import Qt
2023-03-31 11:15:44 +08:00
from app.DataBase import close_db
from app.log import logger
from app.ui import mainview
from app.ui.tool.pc_decrypt import pc_decrypt
from app.config import version
2023-12-20 22:23:13 +08:00
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("WeChatReport")
2023-12-20 22:23:13 +08:00
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
2023-01-11 13:04:19 +08:00
class ViewController(QWidget):
def __init__(self):
super().__init__()
self.viewMainWindow = None
self.viewDecrypt = None
2023-11-12 21:51:33 +08:00
def loadPCDecryptView(self):
2023-01-11 13:04:19 +08:00
"""
2023-11-12 21:51:33 +08:00
登录界面
2023-01-11 13:04:19 +08:00
:return:
"""
2023-11-12 21:51:33 +08:00
self.viewDecrypt = pc_decrypt.DecryptControl()
self.viewDecrypt.DecryptSignal.connect(self.show_success)
2023-11-12 21:51:33 +08:00
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 = ''
2023-11-07 22:36:52 +08:00
start = time.time()
self.viewMainWindow = mainview.MainWinController(username=username)
self.viewMainWindow.exitSignal.connect(self.close)
try:
self.viewMainWindow.setWindowTitle(f"留痕-{version}")
self.viewMainWindow.show()
end = time.time()
print('ok', '本次加载用了', end - start, 's')
self.viewMainWindow.init_ui()
except Exception as e:
print(f"Exception: {e}")
logger.error(traceback.print_exc())
def show_success(self):
QMessageBox.about(self, "解密成功", "数据库文件存储在\napp/DataBase/Msg\n文件夹下")
2023-01-11 13:04:19 +08:00
def close(self) -> bool:
close_db()
super().close()
2023-12-20 22:23:13 +08:00
2023-01-11 13:04:19 +08:00
if __name__ == '__main__':
2023-12-23 19:07:15 +08:00
import cgitb
cgitb.enable(format='text')
2023-01-11 13:04:19 +08:00
app = QApplication(sys.argv)
2023-12-14 22:59:48 +08:00
font = QFont('微软雅黑', 12) # 使用 Times New Roman 字体,字体大小为 14
app.setFont(font)
2023-01-11 13:04:19 +08:00
view = ViewController()
try:
# view.loadPCDecryptView()
view.loadMainWinView()
# view.show()
# view.show_success()
sys.exit(app.exec_())
except Exception as e:
print(f"Exception: {e}")
logger.error(traceback.print_exc())