#!D:\IDE\Anaconda3\envs\Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
 @Author: Administrator
 @FileName: ManipulatorSetting.py
 @DateTime: 2025/5/22 14:22
 @SoftWare: PyCharm
 @Author  ：xsh
"""
from PyQt5 import Qt
from AppInterfaces.ModelInterface import ContextModelInterface, ConvertUtils
from AppContexts.Contexts import (AxisRegisterContext, AxisContext, ModBusRegister, DetectionContext, ModBusContext,
                                  DetectionRegisterContext, HookRegisterContext)
from AppCore.Requests import ModBusRequest

from AppCore.Levels import AxisLevel, ModBusLevel
from AppInterfaces.AppConfigInterfaces.ManipulatorConfigureInterface import ManipulatorConfigureInterface
class ManipulatorSetting(ManipulatorConfigureInterface):

    def __init__(self):
        super(ManipulatorSetting, self).__init__()
        self.initialization('ManipulatorSetting')

    def initValue(self):
        super(ManipulatorSetting, self).initValue()
        self.initModBusConfig    ()
        self.initAxisXConfig     ()
        self.initAxisYConfig     ()
        self.initAxisZConfig     ()
        self.initAxisHConfig     ()
        self.initScanXConfig     ()
        self.initScanYConfig     ()
        self.initSlowXConfig     ()
        self.initSlowYConfig     ()
        self.initDropXConfig     ()
        self.initDropYConfig     ()
        self.initDetectionConfig ()



    def initModBusConfig    (self):
        if not self.hasModBusConfig   :
            self.ModBusConfig    = ModBusContext    ()

    def initAxisXConfig     (self):
        if not self.hasAxisXConfig    :
            self.AxisXConfig     = AxisRegisterContext      ()
            self.AxisXConfig.initAxisX()

    def initAxisYConfig     (self):
        if not self.hasAxisYConfig    :
            self.AxisYConfig     = AxisRegisterContext      ()
            self.AxisYConfig.initAxisY()

    def initAxisZConfig     (self):
        if not self.hasAxisZConfig    :
            self.AxisZConfig     = AxisRegisterContext      ()
            self.AxisZConfig.initAxisZ()

    def initAxisHConfig     (self):
        if not self.hasAxisHConfig    :
            self.AxisHConfig     = HookRegisterContext      ()
            self.AxisHConfig.initAxisH()

    def initScanXConfig     (self):
        if not self.hasScanXConfig    :
            self.ScanXConfig     = AxisRegisterContext      ()
            self.ScanXConfig.initScanX()

    def initScanYConfig     (self):
        if not self.hasScanYConfig    :
            self.ScanYConfig     = AxisRegisterContext      ()
            self.ScanYConfig.initScanY()

    def initSlowXConfig     (self):
        if not self.hasSlowXConfig    :
            self.SlowXConfig     = AxisRegisterContext      ()
            self.SlowXConfig.initSlowX()


    def initSlowYConfig     (self):
        if not self.hasSlowYConfig    :
            self.SlowYConfig     = AxisRegisterContext      ()
            self.SlowYConfig.initSlowY()

    def initDropXConfig     (self):
        if not self.hasDropXConfig    :
            self.DropXConfig     = AxisRegisterContext      ()
            self.DropXConfig.initDropX()

    def initDropYConfig     (self):
        if not self.hasDropYConfig    :
            self.DropYConfig     = AxisRegisterContext      ()
            self.DropYConfig.initDropY()

    def initDetectionConfig (self):
        if not self.hasDetectionConfig:
            self.DetectionConfig = DetectionRegisterContext ()
            self.DetectionConfig.initDetection()





