# -*- coding: utf-8 -*-

import sys
from ctypes import windll

from PySide6 import QtGui
from PySide6.QtWidgets import (QApplication, QMessageBox, QWidget)

from controller.controller import ControllerMain
from utils.utils import get_specific_process

try:
    myapp_id = 'company.product.sub_product.version'
    windll.shell32.SetCurrentProcessExplicitAppUserModelID(myapp_id)
except ImportError:
    pass

if __name__ == "__main__":
    app = QApplication()
    # æ›¿æ�¢æˆ�ä½ çš„ç»�å¯¹è·¯å¾„, ç”¨æˆ·æŒ‡å®šä»»åŠ¡æ �å›¾æ ‡
    app.setWindowIcon(QtGui.QIcon(r'.\resources\icon\icon.ico'))
    wechat_process = get_specific_process()
    if wechat_process:
        controller = ControllerMain()
        controller.view.show()
        sys.exit(app.exec())
    else:
        # å¦‚æ�œå¾®ä¿¡æ²¡å�¯åŠ¨, åˆ™ä¸�å�‘ä¸‹è¿�è¡Œ!
        QMessageBox.critical(QWidget(), 'ä¸¥é‡�é”™è¯¯ğŸ†˜', "å¾®ä¿¡æœªå�¯åŠ¨!")
        sys.exit()  # é€€å‡ºç¨‹åº�
