#!D:\IDE\Anaconda3\envs\Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName   : AppWebSlot.py
@Account    : Administrator
@Time       : 2025/9/1 17:35
@Author     : xsh
@Description: 
"""
from PyQt5 import Qt
from AppInterfaces.SingletonInterface import SingletonInterface
from AppInterfaces.GlobalInterface import GlobalInterface
from AppSettings.Settings import SIGNAL_CONNECTION_TYPE

class AppWebSlot(Qt.QObject, GlobalInterface, SingletonInterface):
    Locker                      : Qt.QMutex = Qt.QMutex()
    StartScanningSignal         : Qt.pyqtSignal = Qt.pyqtSignal(object)
    WebServerReceivedSignal     : Qt.pyqtSignal = Qt.pyqtSignal(object)
    AppSignal                   : Qt.pyqtSignal = Qt.pyqtSignal(object, object, object)
    ApplicationSignal           : Qt.pyqtSignal = Qt.pyqtSignal(object, object)
    WebServerReadSignal         : Qt.pyqtSignal = Qt.pyqtSignal(object, object)
    WebServerSendSignal         : Qt.pyqtSignal = Qt.pyqtSignal(object, object)


    def __init__(self, parent: Qt.QObject = None):
        super(AppWebSlot, self).__init__(parent=parent)
        self.Initialization("AppWebSlot", self, parent)


    @classmethod
    def GetInstance(cls, *args, **kwargs) -> 'AppWebSlot':
        return super(AppWebSlot, cls).GetInstance(*args, **kwargs)

    def initValue(self):
        super(AppWebSlot, self).initValue()





    def slot_ApplicationSignal(self):

        import sys
        self.ApplicationSignal.emit("aboutToQuit", "aboutToQuit")
        Qt.QCoreApplication.processEvents(Qt.QEventLoop.AllEvents, 1000)
        sys.exit(0)




WebSlot: AppWebSlot = AppWebSlot.GetInstance()