#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：GimbalDashboardDebug.py
@Description：
@Author：XSH
@Time：2025/12/18 11:48
@Department：研发部
@Copyright：©2025 乐辰生物
"""
import os
import sys
import asyncio
from qasync import QEventLoop, asyncSlot
from AppInterfaces.AppTimeLoop import AppTimeLoop
from PyQt5 import Qt
from AppInterfaces.AppDaemonController import AppDaemonController, DaemonController

if __name__ == "__main__":
    app = Qt.QApplication(sys.argv)
    loop = QEventLoop(app)
    asyncio.set_event_loop(loop)
    DaemonController.Manager = loop
    from AppUtils.DataBaseDeploy import DataBaseDeploy, ChamberStatusModel, TrayModel

    DataBaseDeploy.init()
    from AppSettings.SystemSetting import SystemConfig

    SystemConfig.UpdateMaxLocation()
    TrayModel.UpdateMaxLocation()
    from AppSettings.AppSetting import AppConfig

    SystemConfig.setAsyncioLoop(loop)
    AppConfig.reload()
    from AppSettings.AppStatusSetting import AppStatus, AppStatusSetting
    AppStatus.initModuleAvailable()

    from AppCore.AppManagers.HardWareManager import HardWareManager
    from AppHeadEnd.ControlWindows.MainController import MainController
    from AppBackEnd.AppScanningFlow import AppScanningFlow, AppBusinessInterface
    from AppCore.DBModels import *
    from AppHeadEnd.DBModelViews.DBModelView import DBModelView
    from AppBackEnd.AppBackEndBusiness import *
    from AppHeadEnd.Commons.OperationViews.SlideOperation import SlideOperation
    from AppHeadEnd.Commons.OperationViews.FocusingOperation import FocusingOperation
    from AppHeadEnd.ControllerFrames.FocusingController import FocusingController
    from AppHeadEnd.ControllerFrames.OperationController import OperationController, StatusOperation
    from AppHeadEnd.ControllerFrames.SlideController import SlideController
    from AppHeadEnd.DBModelViews.DBFrame import DBFrame


    AppEventBusPool.GetInstance()
    business: AppBusinessInterface = AppScanningFlow.GetInstance()
    business.initModules()
    frame: OperationController = OperationController(business=business, parent=None)

    frame.show()
    # widget: DBFrame = DBFrame(CellModel(), True, None)
    # widget.show()
    # widget: SlideController = SlideController(business=business, parent=None)
    # widget.show()
    # widget: FocusingController = FocusingController()
    # widget.show()
    DaemonController.Start(loop)
    sys.exit(app.exec())

