"""
@文件    :EmvUpper.py
@时间    :2021/12/08 16:32:57
@作者    :None
@版本    :1.0
@说明    :EmvUpper程序主入口
"""


from sys import exit
from controller.emv_ctl import EmvControll
from utils.globalvar import SD
from utils.qt import QApplication, QCoreApplication, Qt, QStyleFactory


def emv_start():

    # 适配分辨率
    if hasattr(Qt, 'AA_EnableHighDpiScaling'):
        QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)

    if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
        QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
        SD.HIGH_DPI = 0
    else:
        SD.HIGH_DPI = 1
    main_connrtoller = EmvControll()

    QApplication.setStyle(QStyleFactory.create("windows"))

    exit(main_connrtoller.run())


if __name__ == "__main__":
    emv_start()
