#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@文件    :start.py
@时间    :2023/11/26 15:57:45
@作者    :樊春春
@版本    :1.0
@邮箱    :fanchcho@gmail.com
@说明    :
'''


from sys import exit
from controller.bms_login_ctl import BmsLoginControll
from utils.globalvar import SD
from utils.qt import QApplication, QCoreApplication, Qt, QStyleFactory
import locale



def bms_start():
    # 主版本号
    SD.MAJOR_VERSION_NUMBER = 1
    # 子版本号
    SD.MINOR_VERSION_NUMBER = 0
    # 修正版本号
    SD.REVISION_NUMBER = "0-build_test"

    local_tuple = locale.getdefaultlocale()

    if local_tuple[0].startswith("zh"):
        SD.SYSTEM_LANGUAGE = 0

    if local_tuple[0].startswith("en"):
        SD.SYSTEM_LANGUAGE = 1

    # 适配分辨率
    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 = BmsLoginControll()

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

    exit(main_connrtoller.run())


if __name__ == "__main__":
    bms_start()
