
from PyQt5.QtWidgets import  QLineEdit,  QVBoxLayout

class ObjectTypeEditlayout(QVBoxLayout):
    def __init__(self, objectType, dataType):
            super().__init__()
            self.objectType = objectType
            self.dataType = dataType
            self.editlineList = []
            self.initUI()


    def initUI(self):
        self.editline1 = QLineEdit()
        self.editline2 = QLineEdit()
        self.editline3 = QLineEdit()
        self.editline4 = QLineEdit()
        self.editline1.setObjectName('parameEditline')
        self.editline2.setObjectName('parameEditline')
        self.editline3.setObjectName('parameEditline')
        self.editline4.setObjectName('parameEditline')
    
        if self.objectType in ['SCALE_IN', 'SCALE_OUT', 'PV_SCALE']:
            self.editline1.setPlaceholderText('高标标度值')
            self.editline2.setPlaceholderText('低标标度值')
            self.addWidget(self.editline1)
            self.addWidget(self.editline2)
            self.editlineList.extend([self.editline1, self.editline2])
    
        if self.dataType == 'DS-36':
            # layout1 = QHBoxLayout()
            # layout2 = QHBoxLayout()
            self.editline1.setPlaceholderText('EU_at_lOO %')
            self.editline2.setPlaceholderText('EU_at 0%')
            self.editline3.setPlaceholderText('单位索引')
            self.editline4.setPlaceholderText('有效小数点')
            # layout1.addWidget()

            self.addWidget(self.editline1)
            self.addWidget(self.editline2)
            self.addWidget(self.editline3)
            self.addWidget(self.editline4)
            self.editlineList.extend([self.editline1, self.editline2, self.editline3, self.editline4])  

        if self.dataType == 'DS-50':
            self.editline1.setPlaceholderText('仿真转换块值状况')
            self.editline2.setPlaceholderText('仿真转换块值')
            self.editline3.setPlaceholderText('启用或者禁用仿真转换块(0:禁用, <>0:启用)')

            self.addWidget(self.editline1)
            self.addWidget(self.editline2)
            self.addWidget(self.editline3)
            self.editlineList.extend([self.editline1, self.editline2, self.editline3])  

        if self.dataType == '101':
            self.editline1.setPlaceholderText('请输入值')
            self.editline2.setPlaceholderText('请输入状态码')
            self.addWidget(self.editline1)
            self.addWidget(self.editline2)
            self.editlineList.extend([self.editline1, self.editline2])  
        
        else:
            self.editline1.setPlaceholderText('请输入值')
            self.addWidget(self.editline1)
            self.editlineList.append(self.editline1)  
        self.setContentsMargins(0,0,0,0)
        
    def getEditlineValue(self):

        valueList = []
        for editline in self.editlineList:
            value = editline.text()
            valueList.append(value)
        return valueList