def dataChanged(self, label, data):
     labels = configure.get_DB_Struct("rootNode_taskInfo")
     # print(label,labels)
     if label in labels:
         num = labels.index(label)
         if self.model_Proj_Task != None:
             self.model_Proj_Task.setDataByDetail(self.model_Proj_Task.getColumnIndex(self.currentIndex, num-4), data)
示例#2
0
    def insertRow(self, position, parent=QtCore.QModelIndex(), data=None):
        parentItem = self.getItem(parent)
        parentID = parentItem._dbId
        if data == None:
            data = configure.get_DB_Struct(
                'empty_taskInfo')  # 从配置文件获取插入的空内容(list)
            data[0] = parentID
        # print(data)
        # 数据库插入项并获取其id
        dbid = DB.insertData(configure.getProjectPath(), 'table_taskInfo',
                             configure.struct_taskInfo(), data)

        # 获取并更新父级 childrenID 数据
        childrenID = self.getChildrenIdList(parent)
        if parent != QtCore.QModelIndex():
            childrenID.insert(position, dbid)  # 插入id到childrenID
            childrenIdStr = str(childrenID)[1:-1]  # list转为文字并去掉首尾字符([])
            # 更新父级item 数据
            parentItem._itemData[3] = childrenIdStr
            # 更新父级数据库数据
            DB.updateData(configure.getProjectPath(), 'table_taskInfo',
                          'id=%d' % (parentID),
                          'childrenID="%s"' % childrenIdStr)

        data.insert(0, dbid)  # 将ID添加到插入数据中
        # print(data)
        item = BaseTreeItem(data)
        self.insertRows(position, 1, parent, [item])

        filePath = configure.getProjectPath() + '/data/Content/%s' % dbid
        if not os.path.exists(filePath):
            os.makedirs(filePath)  # 创建路径

        return self.index(position, 0, parent)  # 返回插入项的index
    def setDetailPageInfo(self, index):
        if index == QtCore.QModelIndex():
            index = self.lastSelectIndex
        if index != None: 
            currentItem = self.model_Proj_Task.getItem(index) 
            self.detailPage_Proj_Task.datas = currentItem.datas()
            self.detailPage_Proj_Task.currentIndex = index

            labels = configure.get_DB_Struct("rootNode_taskInfo")
            # ---------- 信息 -----------
            # taskName
            if u'任务' in labels:
                num = labels.index(u'任务')
                self.detailPage_Proj_Task.setTaskName(currentItem.datas()[num])
            # type
            if u'类型' in labels:
                num = labels.index(u'类型')
                self.detailPage_Proj_Task.setTaskType(currentItem.datas()[num])
            # state
            if u'状态' in labels:
                num = labels.index(u'状态')
                self.detailPage_Proj_Task.setTaskState(currentItem.datas()[num])
            # treePath
            if u'任务' in labels:
                num = labels.index(u'任务')
                treePath = [currentItem.datas()[num]]
                parentItem = currentItem.parent()
                while parentItem != None:
                    treePath.insert(0, parentItem.datas()[num])
                    parentItem = parentItem.parent()
                treePath = treePath[1:]
                self.detailPage_Proj_Task.setTreePath(treePath)
            # Detail_Img
            if u'缩略图' in labels:
                num = labels.index(u'缩略图')
                self.detailPage_Proj_Task.setDetail_Img(currentItem.datas()[num])
            # FL_Info
            labels = configure.get_DB_Struct('rootNode_taskInfo')
            datas = currentItem.datas()
            dataTypes = configure.get_DB_Struct('dataTypes')
            self.detailPage_Proj_Task.setFL_Info(labels, datas, dataTypes)

            # ---------- 文件 -----------
            # fileList_Path
            self.detailPage_Proj_Task.fileList._path = configure.getProjectPath() + '/data/Content/%s'%currentItem.datas()[0]
            self.detailPage_Proj_Task.fileList.updateList() # 更新文件列表
示例#4
0
    def setData(self, value, column):
        # self._itemData = list(self._itemData) # 将元组转换为列表
        # print(self._itemData)
        self._itemData[column + 4] = value

        # 更新数据库数据
        dbKey = configure.get_DB_Struct('struct_taskInfo')[column + 3]
        DB.updateData(configure.getProjectPath(), 'table_taskInfo',
                      'id=%d' % (self._dbId), '%s="%s"' % (dbKey, value))
    def pasteFile(self, path):
        if os.path.isfile(path):
            fpath,fname = os.path.split(path) # 分离文件名和路径
            # fname = os.path.split(s)[1] # 获取文件名带后缀

            fileInfoBy = configure.get_DB_Struct('fileInfoBy')
            
            # 获取前缀信息
            prefix = fileInfoBy['prefix'] # 前缀信息
            for pr in prefix.keys():
                label = self.datas[configure.getIndexByLabel(u'标签')].split(',')[0].strip() # 获取标签,移除空格
                if label in pr and label!= '':
                    outPrefix = prefix[pr]
                else:
                    outPrefix = prefix['default']
            # 获取后缀信息
            suffix = fileInfoBy['suffix'] # 后缀信息
            for pr in suffix.keys():
                label = self.datas[configure.getIndexByLabel(u'标签')].split(',')[0].strip() # 获取标签,移除空格
                if label in pr and label!= '':
                    outSuffix = suffix[pr]
                else:
                    outSuffix = suffix['default']
            # 获取粘贴路径
            fileType = fileInfoBy['fileType'] # 文件类型
            pathBy = fileInfoBy['pathBy'] # 路径信息
            for ft in fileType.keys():
                if os.path.splitext(path)[1] in fileType[ft]:
                    outPath = self._path + pathBy[ft]
                else:
                    outPath = self._path + pathBy['default']
            
            # 重命名
            if self.datas[configure.getIndexByLabel(u'英文简称')] != '':
                abbreviation = self.datas[configure.getIndexByLabel(u'英文简称')] # 获取英文简称
            else:
                abbreviation = os.path.splitext(fname)[0]
            newFName = outPrefix + abbreviation + outSuffix + os.path.splitext(path)[1] # 重组名字
            if fname != newFName:
                text, ok=QtWidgets.QInputDialog.getText(self, '重命名', '重命名:', QtWidgets.QLineEdit.Normal, "%s"%(newFName))
                if ok and text:
                    newFName = text
                else:
                    newFName = fname
            # 历史版本
            if os.path.isfile(outPath+'/'+newFName): # 文件是否已存在(重名文件)
                if not os.path.exists(outPath + '/Revisions'): # 历史版本文件夹
                    os.makedirs(outPath + '/Revisions') # 创建路径
                # 移动文件到历史版本文件夹,并重命名及记录版本创建时间
                ftime = time.strftime('%y%m%d%H%M%S',time.localtime(time.time()))
                shutil.move(outPath+'/'+newFName, outPath+'/Revisions/'+os.path.splitext(newFName)[0]+'_'+ftime+os.path.splitext(path)[1]) 
            # 复制文件
            if not os.path.exists(outPath):
                os.makedirs(outPath) # 创建路径
            shutil.copy(path, outPath) # 复制文件
    def setTaskState(self, data):
        comboId = 0
        TaskState = configure.get_DB_Struct('TaskState')

        if data in TaskState:
            comboId = TaskState.index(data)

            # 避免不是由用户引起的信号,因此我们使用blockSignals.
            self.comboBox_TaskState.blockSignals(True)
            # ComboBox当前项使用setCurrentIndex()来设置
            self.comboBox_TaskState.setCurrentIndex(comboId)
            self.comboBox_TaskState.blockSignals(False)
            self.datas[7] = data
            self.fileList.datas = self.datas
    def __init__(self, uiPath='', parent=None):
        super(MainWindow, self).__init__(parent)
        # PyQt5 加载ui文件方法
        self.ui = uic.loadUi(uiPath, self)
        # 检查工程目录是否存在,不存在则设置工程目录
        if not os.path.isdir(configure.getProjectPath()):
            SetProjectPath()

        # ---------------------------- 概览面板 ---------------------------- #
        self.item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
        self.item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
        self.itemWidget = loadWidgets.ListItem_General_Proj()  # itemWidget
        self.ui.listWidget_General_Proj.addItem(self.item)  # 添加item
        self.ui.listWidget_General_Proj.setItemWidget(
            self.item, self.itemWidget)  # 为item设置widget

        # -------------------------- 详细信息面板 -------------------------- #
        self.detailPage_Proj_Task = loadWidgets.DetailPage()  # Widget- DetailPage 详细信息面板

        # ---------------------------- 项目面板 ---------------------------- #
        ## ------------------ 任务面板 ------------------ #
        ### --------------- 任务树 --------------- #
        self.rootItemData_Proj_Task = configure.get_DB_Struct(
            'rootNode_taskInfo')
        self.rootNode_Proj_Task = BaseTreeItem(self.rootItemData_Proj_Task)

        print(self.rootNode_Proj_Task)
        self.ui.treeView_Proj_Task.setColumnWidth(0,200) # 不起作用!!!?

        # 设置 Model
        self.model_Proj_Task = TreeModel_Proj_Task(self.rootNode_Proj_Task)
        self.model_Proj_Task.func = self.currentIndexDataChanged # 数据更新时调用的函数
        self.ui.treeView_Proj_Task.setModel(self.model_Proj_Task)
        self.detailPage_Proj_Task.model_Proj_Task = self.model_Proj_Task # 把树model传入detailPage

        # treeView_Proj_Task item 点击事件
        self.ui.treeView_Proj_Task.clicked.connect(self.taskTreeItemClicked)
        # treeView_Proj_Task item 双击事件
        self.ui.treeView_Proj_Task.doubleClicked.connect(self.taskTreeItemDoubleClicked)
        # 右键菜单(treeView_Proj_Task)
        self.createRightMenu_treeView_Proj_Task()

        # 设置 Item 部件
        self.delegate = range(10)
        self.setDelegate()
        self.lastSelectIndex = None
    def setTaskType(self, data):
        comboId = 5
        taskType = configure.get_DB_Struct('TaskType')

        if data in taskType:
            comboId = taskType.index(data)

            # 避免不是由用户引起的信号,因此我们使用blockSignals.
            self.comboBox_TaskType.blockSignals(True)
            # ComboBox当前项使用setCurrentIndex()来设置
            self.comboBox_TaskType.setCurrentIndex(comboId)
            self.comboBox_TaskType.blockSignals(False)

            self.setTypeIcon() # 设置 Type 图标

            self.datas[6] = data
            self.fileList.datas = self.datas
 def setDelegate(self):
     dataTypes = configure.get_DB_Struct('dataTypes')
     # print(dataTypes)
     dataTypes = dataTypes[4:]
     # print(dataTypes)
     self.delegate = range(len(dataTypes))
     for i in range(len(dataTypes)):
         # print(dataTypes[i])
         if dataTypes[i] == 'int':
             self.delegate[i] = SpinBoxDelegate()
             self.ui.treeView_Proj_Task.setItemDelegateForColumn(i, self.delegate[i])
         elif dataTypes[i] == 'float':
             self.delegate[i] = DoubleSpinBoxDelegate()
             self.ui.treeView_Proj_Task.setItemDelegateForColumn(i, self.delegate[i])
         elif dataTypes[i] == 'date':
             self.delegate[i] = DateEditDelegate()
             self.ui.treeView_Proj_Task.setItemDelegateForColumn(i, self.delegate[i])
         elif dataTypes[i] == 'string':
             self.delegate[i] = StringLineEditDelegate()
             self.ui.treeView_Proj_Task.setItemDelegateForColumn(i, self.delegate[i])
         elif dataTypes[i].split(':')[0] == 'combo':
             self.delegate[i] = ComboBoxDelegate(dataTypes[i].split(':')[1], dataTypes[i].split(':')[2])
             self.ui.treeView_Proj_Task.setItemDelegateForColumn(i, self.delegate[i])
示例#10
0
    def setAllDatasByDetail(self, index, datas, role=QtCore.Qt.EditRole):
        if index.isValid():
            item = index.internalPointer()  # 获取item

            if role == QtCore.Qt.EditRole:
                # if index.column() == 1:
                # item._itemData = datas
                datas = datas[8:]
                x = 3
                for i in datas:
                    x += 1
                    # 获取数据库的数据
                    dbKey = configure.get_DB_Struct('struct_taskInfo')[x + 3]
                    dbData = DB.findData(configure.getProjectPath(),
                                         'table_taskInfo',
                                         'id=%d' % (item._dbId),
                                         '%s' % (dbKey))
                    if i != dbData:  # 判断数据是否有修改
                        # 更新树列表及数据库数据
                        item.setData(i, x)
                        index_X = self.index(index.row(), x, index.parent())
                        self.dataChanged.emit(index_X, index_X)  # 更新Model的数据
                        return True
        return False
示例#11
0
 def __init__(self, combos, defaultComboId=0):
     QtWidgets.QItemDelegate.__init__(self)
     self.combos = configure.get_DB_Struct(combos)
     self.defaultComboId = int(defaultComboId)
     self.func = None
    def __init__(self, uiPath='', parent=None):
        super(DetailPage, self).__init__(parent)

        if uiPath == '':
            uiPath = './UI/Widget_DetailPage.ui'
        # PyQt5 加载ui文件方法
        self.ui = uic.loadUi(uiPath, self)

        self.datas = [] # Item 数据
        self.thread_imgBtn = None # 按钮计时器线程
        self.model_Proj_Task = None # 任务面板 树列表 对应的 Model
        self.currentIndex = None # 当前选择的 Index

        # 关闭按钮 点击事件
        self.closeButton = self.ui.pushButton_Detail_Close
        self.closeButton.setToolTip('关闭详细面板')
        self.closeButton.clicked.connect(self.closeEvent)
        self.ui.pushButton_V_Detail_Close.clicked.connect(self.closeEvent) # 侧边关闭按钮

        # name
        # self.ui.lineEdit_TaskName.textChanged.connect(self.nameChanged) # 当内容改变时触发事件
        self.ui.lineEdit_TaskName.editingFinished.connect(lambda: self.lineEditFinished(self.ui.lineEdit_TaskName, u'任务')) # 当内容修改完成时触发事件

        # Type
        self.comboBox_TaskType = self.ui.comboBox_TaskType
        taskType = configure.get_DB_Struct('TaskType')
        # 添加多个添加条目
        self.comboBox_TaskType.addItems(taskType)
        # 当下拉索引发生改变时发射信号触发绑定的事件
        self.comboBox_TaskType.currentIndexChanged.connect(
            lambda: self.comboBoxSelectionChanged(self.comboBox_TaskType, u'类型'))

        # State
        self.comboBox_TaskState = self.ui.comboBox_TaskState
        TaskState = configure.get_DB_Struct('TaskState')
        # 添加多个添加条目
        self.comboBox_TaskState.addItems(TaskState)
        # # 当下拉索引发生改变时发射信号触发绑定的事件
        self.comboBox_TaskState.currentIndexChanged.connect(
            lambda: self.comboBoxSelectionChanged(self.comboBox_TaskState, u'状态'))

        # TreePath
        self.HL_Detail_TreePath = self.ui.horizontalLayout_Detail_TreePath

        # TypeIcon
        self.label_TypeIcon = self.ui.label_TypeIcon

        # Detail_Img
        # QtWidgets.QHBoxLayout.replaceWidget()
        self.Detail_Img = self.ui.pushButton_Detail_Img
        self.imgPath = os.path.abspath('./UI/img_loss.png')
        self.Detail_Img.clicked.connect(self.on_Detail_Img_clicked) 
        self.BtnTime = 0 # 用于防止过快的重复点击
        # 重设右键并绑定信号槽
        self.Detail_Img.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.Detail_Img.customContextMenuRequested[QtCore.QPoint].connect(self.Detail_ImgContext)

        # -------- Info ---------
        self.FL_Info = self.ui.formLayout_Detail_Info
        self.widght = [] # 用于存储动态添加的部件

        # -------- fileList ---------
        self.fileList = DropListWidget()
        self.ui.verticalLayout_file.addWidget(self.fileList)
        self.fileList.datas = self.datas # 更新文件列表对应的items数据
        self.changeFileShow()

        self.ui.checkBox_source.stateChanged.connect(self.changeFileShow)
        self.ui.checkBox_mesh.stateChanged.connect(self.changeFileShow)
        self.ui.checkBox_tex.stateChanged.connect(self.changeFileShow)
        self.ui.checkBox_Revisions.stateChanged.connect(self.changeFileShow)
    def updateList(self):
        fileInfoBy = configure.get_DB_Struct('fileInfoBy')
        pathBy = fileInfoBy['pathBy'] # 路径信息

        sourceFilePath = self._path + pathBy['source']
        meshPath = self._path + pathBy['mesh']
        texPath = self._path + pathBy['texture']

        # # 设置自定义item
        # item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
        # item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
        # itemWidget = ListItem_fileItem()  # itemWidget
        # self.addItem(item)  # 添加item
        # self.setItemWidget(item, itemWidget)  # 为item设置widget

        self.clear()
        if self.showSource:
            if os.path.exists(sourceFilePath):
                for data in os.listdir(sourceFilePath): # 获取当前路径下的文件
                    # self.addItem(data)
                    # 设置自定义item
                    item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
                    item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
                    itemWidget = ListItem_fileItem(data, sourceFilePath)  # itemWidget
                    self.addItem(item)  # 添加item
                    self.setItemWidget(item, itemWidget)  # 为item设置widget
        if self.showMesh:
            if os.path.exists(meshPath):
                for data in os.listdir(meshPath): # 获取当前路径下的文件
                    # self.addItem(data)
                    # 设置自定义item
                    item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
                    item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
                    itemWidget = ListItem_fileItem(data, meshPath)  # itemWidget
                    self.addItem(item)  # 添加item
                    self.setItemWidget(item, itemWidget)  # 为item设置widg
        if self.showTex:
            if os.path.exists(texPath):
                for data in os.listdir(texPath): # 获取当前路径下的文件
                    # self.addItem(data)
                    # 设置自定义item
                    item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
                    item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
                    itemWidget = ListItem_fileItem(data, texPath)  # itemWidget
                    self.addItem(item)  # 添加item
                    self.setItemWidget(item, itemWidget)  # 为item设置widg
        # 历史文件
        if self.showRevisions:
            if self.showSource:
                if os.path.exists(sourceFilePath + '/Revisions'):
                    for data in os.listdir(sourceFilePath + '/Revisions'): 
                        # 设置自定义item
                        item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
                        item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
                        itemWidget = ListItem_fileItem(data, sourceFilePath + '/Revisions')  # itemWidget
                        self.addItem(item)  # 添加item
                        self.setItemWidget(item, itemWidget)  # 为item设置widget
            if self.showMesh:
                if os.path.exists(meshPath + '/Revisions'):
                    for data in os.listdir(meshPath + '/Revisions'): 
                        # 设置自定义item
                        item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
                        item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
                        itemWidget = ListItem_fileItem(data, meshPath + '/Revisions')  # itemWidget
                        self.addItem(item)  # 添加item
                        self.setItemWidget(item, itemWidget)  # 为item设置widget
            if self.showTex:
                if os.path.exists(texPath + '/Revisions'):
                    for data in os.listdir(texPath + '/Revisions'): 
                        # 设置自定义item
                        item = QtWidgets.QListWidgetItem()  # 创建QListWidgetItem对象
                        item.setSizeHint(QtCore.QSize(200, 50))  # 设置QListWidgetItem大小
                        itemWidget = ListItem_fileItem(data, texPath + '/Revisions')  # itemWidget
                        self.addItem(item)  # 添加item
                        self.setItemWidget(item, itemWidget)  # 为item设置widget
    def setFL_Info(self, labels=[], datas=[], dataTypes=[]):
        labels = labels[8:]
        datas = datas[8:]
        dataTypes = dataTypes[8:]

        self.widght = range(len(dataTypes))
        
        fromlayout = self.FL_Info
        # 清理FL_Info
        for i in range(fromlayout.count()): 
            # fromlayout.itemAt(i).widget().delete()
            widgetItem = fromlayout.itemAt(0)
            if widgetItem != None:
                widget = widgetItem.widget()
                fromlayout.removeWidget(widget)
                widget.setParent(None)
                sip.delete(widget)
        # 添加控件
        for i in range(len(dataTypes)):
            label = QtWidgets.QLabel(labels[i])
            if dataTypes[i] == 'text' or dataTypes[i] == 'personnel':
                self.widght[i] = QtWidgets.QLineEdit()
                # self.widght[i].setMinimumWidth(180)
                self.widght[i].setText(datas[i])
                # 当内容修改完成时触发事件
                self.widght[i].editingFinished.connect(self.dataChangedAll)
            elif dataTypes[i] == 'string':
                self.widght[i] = QtWidgets.QLineEdit()
                # self.widght[i].setMinimumWidth(180)
                self._mask = QtCore.QRegExp("[0-9A-Za-z_-]{0,49}") # 为给定的模式字符串构造一个正则表达式对象。(字符只能是字母或者数字或下划线,长度不能超过50位)
                validator = QtGui.QRegExpValidator(self._mask, self) # 构造一个验证器,该父对象接受与正则表达式匹配的所有字符串。这里的父对象就是QLineEdit对象了。
                self.widght[i].setValidator(validator) #将输入框设置为仅接受符合验证器条件的输入。 这允许您对可能输入的文本设置任何约束条件。
                self.widght[i].setText(datas[i])
                # 当内容修改完成时触发事件
                self.widght[i].editingFinished.connect(self.dataChangedAll)
            elif dataTypes[i] == 'int':
                self.widght[i] = QtWidgets.QSpinBox()
                self.widght[i].setFrame(False)
                self.widght[i].setFrame(False)
                self.widght[i].setMinimum(0)
                self.widght[i].setMaximum(1000)
                if datas[i] != '':
                    try:
                        self.widght[i].setValue(int(datas[i]))
                    except Exception as e:
                        self.widght[i].setValue(0)
                        print('setFL_Info error:%s' % (e))
                else:
                    self.widght[i].setValue(0)
                # 当内容修改完成时触发事件
                self.widght[i].editingFinished.connect(self.dataChangedAll)
            elif dataTypes[i] == 'float':
                self.widght[i] = QtWidgets.QDoubleSpinBox()
                self.widght[i].setFrame(False)
                self.widght[i].setFrame(False)
                self.widght[i].setMinimum(0)
                self.widght[i].setMaximum(1000)
                if datas[i] != '':
                    try:
                        self.widght[i].setValue(float(datas[i]))
                    except Exception as e:
                        self.widght[i].setValue(0)
                        print('setFL_Info error:%s' % (e))
                else:
                    self.widght[i].setValue(0)
                # 当内容修改完成时触发事件
                self.widght[i].editingFinished.connect(self.dataChangedAll)
            elif dataTypes[i] == 'date':
                self.widght[i] = QtWidgets.QDateEdit()
                self.widght[i].setDisplayFormat('yyyy-MM-dd')
                self.widght[i].setCalendarPopup(True)
                # self.widght[i].setMinimumWidth(180)
                if QtCore.QDate.fromString(datas[i], 'yyyy-MM-dd'):
                    self.widght[i].setDate(QtCore.QDate.fromString(datas[i], 'yyyy-MM-dd'))
                else:
                    now = QtCore.QDate.currentDate()  # 获取当前日期
                    self.widght[i].setDate(now)
                # 当内容修改完成时触发事件
                self.widght[i].editingFinished.connect(self.dataChangedAll)
            elif dataTypes[i] == 'longText':
                self.widght[i] = CustomTextEdit()
                sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) 
                sizePolicy.setHorizontalStretch(0) 
                sizePolicy.setVerticalStretch(0) 
                self.widght[i].setSizePolicy(sizePolicy)
                self.widght[i].setMinimumSize(180, 50)
                self.widght[i].setMaximumHeight(85)
                self.widght[i].setText(datas[i])
                # 当内容修改完成时触发事件
                # self.widght[i].focus_out(self.textEditFinished(self.widght[i], labels[i]))
                self.widght[i].focus_out.connect(self.dataChangedAll)
            elif dataTypes[i].split(':')[0] == 'combo':
                combos = configure.get_DB_Struct(dataTypes[i].split(':')[1])
                self.widght[i] = QtWidgets.QComboBox()
                # self.widght[i].setMinimumWidth(180)
                # 多个添加条目
                self.widght[i].addItems(combos)
                defaultComboId = int(dataTypes[i].split(':')[2])
                if datas[i] in combos:
                    defaultComboId = combos.index(datas[i])
                # 避免不是由用户引起的信号,因此我们使用blockSignals.
                self.widght[i].blockSignals(True)
                # ComboBox当前项使用setCurrentIndex()来设置
                self.widght[i].setCurrentIndex(defaultComboId)
                self.widght[i].blockSignals(False)
                # 当内容修改完成时触发事件
                self.widght[i].currentIndexChanged.connect(self.dataChangedAll)
            fromlayout.addRow(label, self.widght[i])