#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：ImageConfigure.py
@Description：
@Author：XSH
@Time：2025/11/11 17:17
@Department：研发部
@Copyright：©2025 乐辰生物
"""
from PyQt5 import Qt
from AppInterfaces.ConfigureInterfaces import ImageConfigInterface
from AppCore.Levels import ObjectiveLevel
class ImageConfigure(ImageConfigInterface):
    IOLocker    : Qt.QReadWriteLock     = Qt.QReadWriteLock ()


    def __init__(self, *args, **kwargs):
        super(ImageConfigure, self).__init__()
        self.initialization("ImageConfigure")


    def initValue(self):
        super(ImageConfigure, self).initValue()
        self.ID                   = None
        self.VideoStream_W        = 400    
        self.VideoStream_H        = 400    
        self.PreviewImage_W       = 800    
        self.PreviewImage_H       = 800    
        self.MVideoStream_W       = 400    
        self.MVideoStream_H       = 300    
        self.MPreviewImage_W      = 800    
        self.MPreviewImage_H      = 600    
        self.SlideAreaImage_W     = 7      
        self.SlideAreaImage_H     = 11     
        self.ImageList_W          = 256    
        self.ImageList_H          = 256    
        self.DrawImage_W          = 640
        self.DrawImage_H          = 640

    def UpdateMaxLocation(self):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        self.as_field(ImageConfigModel.first().to_field())
        
    def VideoStreamSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.VideoStream_W, self.VideoStream_H

    
    def PreviewImageSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.PreviewImage_W, self.PreviewImage_H
    
    def MVideoStreamSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.MVideoStream_W, self.MVideoStream_H
    
    def MPreviewImageSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.MPreviewImage_W, self.MPreviewImage_H
    
    def ImageListSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.ImageList_W, self.ImageList_H
    
    def SlideAreaImageSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.SlideAreaImage_W, self.SlideAreaImage_H
    
    def DrawImageSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.DrawImage_W, self.DrawImage_H
    
    def CaseImageSize(self) -> (int, int):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        return self.CaseImage_W, self.CaseImage_H
    
    def setVideoStream_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.VideoStream_W = int(value)
            ImageConfigModel.setVideoStream_W(self.VideoStream_W)
    
    def setVideoStream_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.VideoStream_W = int(value)
            ImageConfigModel.setVideoStream_H(self.VideoStream_H)
    
    def setPreviewImage_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.PreviewImage_W = int(value)
            ImageConfigModel.setPreviewImage_W(self.PreviewImage_W)
    
    def setPreviewImage_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.PreviewImage_H = int(value)
            ImageConfigModel.setPreviewImage_H(self.PreviewImage_H)
    
    def setMVideoStream_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.MVideoStream_W = int(value)
            ImageConfigModel.setMVideoStream_W(self.MVideoStream_W)
    
    def setMVideoStream_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.MVideoStream_H = int(value)
            ImageConfigModel.setMVideoStream_H(self.MVideoStream_H)
    
    def setMPreviewImage_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.MPreviewImage_W = int(value)
            ImageConfigModel.setMPreviewImage_W(self.MPreviewImage_W)
    
    def setMPreviewImage_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.MPreviewImage_H = int(value)
            ImageConfigModel.setMPreviewImage_H(self.MPreviewImage_H)
    
    def setSlideAreaImage_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.SlideAreaImage_W = int(value)
            ImageConfigModel.setSlideAreaImage_W(self.SlideAreaImage_W)
    
    def setSlideAreaImage_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.SlideAreaImage_H = int(value)
            ImageConfigModel.setSlideAreaImage_H(self.SlideAreaImage_H)
    
    def setImageList_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.ImageList_W = int(value)
            ImageConfigModel.setImageList_W(self.ImageList_W)
    
    def setImageList_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.ImageList_H = int(value)
            ImageConfigModel.setImageList_H(self.ImageList_H)
    
    def setDrawImage_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.DrawImage_W = int(value)
            ImageConfigModel.setDrawImage_W(self.DrawImage_W)
    
    def setDrawImage_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.DrawImage_H = int(value)
            ImageConfigModel.setDrawImage_H(self.DrawImage_H)
    
    def setCaseImage_W(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.CaseImage_W = int(value)
            ImageConfigModel.setCaseImage_W(self.CaseImage_W)
    
    def setCaseImage_H(self, value: (int, float)):
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QWriteLocker = Qt.QWriteLocker(self.IOLocker)
        if isinstance(value, (int, float)):
            self.CaseImage_W = int(value)
            ImageConfigModel.setCaseImage_W(self.CaseImage_W)
    
    def getVideoStream_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.VideoStream_W = ImageConfigModel.getVideoStream_W()
        return self.VideoStream_W
    
    def getVideoStream_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.VideoStream_H = ImageConfigModel.getVideoStream_H()
        return self.VideoStream_H
    
    def getPreviewImage_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.PreviewImage_W = ImageConfigModel.getPreviewImage_W()
        return self.PreviewImage_W
    
    def getPreviewImage_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.PreviewImage_H = ImageConfigModel.getPreviewImage_H()
        return self.PreviewImage_H
    
    def getMVideoStream_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.MVideoStream_W = ImageConfigModel.getMVideoStream_W()
        return self.MVideoStream_W

    
    def getMVideoStream_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.MVideoStream_H = ImageConfigModel.getMVideoStream_H()
        return self.MVideoStream_H
    
    def getMPreviewImage_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.MPreviewImage_W = ImageConfigModel.getMPreviewImage_W()
        return self.MPreviewImage_W
    
    def getMPreviewImage_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.MPreviewImage_H = ImageConfigModel.getMPreviewImage_H()
        return self.MPreviewImage_H
    
    def getSlideAreaImage_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.SlideAreaImage_W = ImageConfigModel.getSlideAreaImage_W()
        return self.SlideAreaImage_W
    
    def getSlideAreaImage_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.SlideAreaImage_H = ImageConfigModel.getSlideAreaImage_H()
        return self.SlideAreaImage_H
    
    def getImageList_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.ImageList_W = ImageConfigModel.getImageList_W()
        return self.ImageList_W
    
    def getImageList_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.ImageList_H = ImageConfigModel.getImageList_H()
        return self.ImageList_H
    
    def getDrawImage_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.DrawImage_W = ImageConfigModel.getDrawImage_W()
        return self.DrawImage_W
    
    def getDrawImage_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.DrawImage_H = ImageConfigModel.getDrawImage_H()
        return self.DrawImage_H
    
    def getCaseImage_W(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.CaseImage_W = ImageConfigModel.getCaseImage_W()
        return self.CaseImage_W
    
    def getCaseImage_H(self) -> int:
        from AppCore.AppDBModels.ConfigModels.ImageConfigModel import ImageConfigModel
        Locker: Qt.QReadLocker = Qt.QReadLocker(self.IOLocker)
        self.CaseImage_H = ImageConfigModel.getCaseImage_H()
        return self.CaseImage_H