프로젝트

일반

사용자정보

개정판 7c794c4c

ID7c794c4c270edfbc1e7363c7a88a60a06321cdca
상위 ddaeb58c
하위 654f3ac2

함의성이(가) 약 5년 전에 추가함

issue #640: code table setting on going

Change-Id: I62eb8884d82a1055d194e9979cb6767ba3a6230d

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
2158 2158
        @history    humkyung 2018.10.13 save expression
2159 2159
    '''
2160 2160

  
2161
    def saveSymbolAttributes(self, type, attrs):
2161
    def saveSymbolAttributes(self, type, attrs, type_str):
2162 2162
        conn = self.project.database.connect()
2163 2163
        with conn:
2164 2164
            try:
2165 2165
                # Get a cursor object
2166 2166
                cursor = conn.cursor()
2167 2167

  
2168
                # delete symbol attribute code table data for deleted symbol attribute
2169
                origin_attrs = self.getSymbolAttribute(type_str)
2170
                for origin_attr in origin_attrs:
2171
                    remain = False
2172
                    for attr in attrs:
2173
                        if str(origin_attr.UID) == attr[0]:
2174
                            remain = True
2175
                            break
2176
                    if not remain:
2177
                        sql = "delete from SymbolAttributeCodeTable where SymbolAttribute_UID = '{}'".format(origin_attr.UID)
2178
                        cursor.execute(sql)
2179
                # up to here
2180

  
2181
                # update symbol attribute
2168 2182
                sql = self.project.database.to_sql('delete from SymbolAttribute where SymbolType_UID = ?')
2169 2183
                param = (type,)
2170 2184
                cursor.execute(sql, param)
......
2174 2188
                        'insert into SymbolAttribute(UID, SymbolType_UID, Attribute, DisplayAttribute, AttributeType, '
2175 2189
                        'AttrAt, Expression, Target, [index], [Property]) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
2176 2190
                    attr.insert(1, type)
2177
                    cursor.execute(sql, tuple(attr))
2191
                    cursor.execute(sql, tuple(attr[:-1]))
2192
                # up to here
2193

  
2194
                # update symbol attribute code table data
2195
                for attr in attrs:
2196
                    if attr[-1]:
2197
                        sql = "delete from SymbolAttributeCodeTable where SymbolAttribute_UID = '{}'".format(attr[0])
2198
                        cursor.execute(sql)
2199

  
2200
                        for code in attr[-1]:
2201
                            sql = self.project.database.to_sql( \
2202
                                "insert into SymbolAttributeCodeTable(UID, Code, Description, Allowables, SymbolAttribute_UID) VALUES(?,?,?,?,?)")
2203
                            param = (code[0], code[1], code[2], code[3], attr[0])
2204
                            cursor.execute(sql, param)
2205
                # up to here
2178 2206

  
2179 2207
                conn.commit()
2180 2208

  
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py
146 146
        @date       2018.08.16
147 147
    '''
148 148
    def changeSymbolType(self):
149
        symbolType = self.ui.comboBoxSymbolType.currentText()
149
        self._symbolType = self.ui.comboBoxSymbolType.currentText()
150 150
        self.ui.tableWidgetAttr.setRowCount(0)
151
        self.loadData(symbolType)
151
        self.loadData(self._symbolType)
152 152

  
153 153
    def loadData(self, symbolType):
154 154
        """
......
211 211
            self.ui.tableWidgetAttr.setItem(row, 6, item)
212 212

  
213 213
            item = QTableWidgetItem('...')
214
            item.tag = None
214
            item.tag = []
215 215
            item.setTextAlignment(Qt.AlignHCenter)
216 216
            item.setFlags(Qt.ItemIsEnabled)
217 217
            self.ui.tableWidgetAttr.setItem(row, 7, item)
......
237 237
            attr.append(table.item(index, 6).tag if table.item(index, 6).tag is not None else 'ALL') # Target
238 238
            attr.append(index)
239 239
            attr.append(table.item(index, 0).tag.IsProp) if hasattr(table.item(index, 0), 'tag') else attr.append(0)
240
            attr.append(table.item(index, 7).tag)
240 241
            attrs.append(attr)
241 242

  
242
        appDocData.saveSymbolAttributes(self.currentTypeId, attrs)
243
        appDocData.saveSymbolAttributes(self.currentTypeId, attrs, self._symbolType)
243 244

  
244 245
    '''
245 246
        @brief  add a attribute
......
265 266
        item.setFlags(Qt.ItemIsEnabled)
266 267
        self.ui.tableWidgetAttr.setItem(rows, 6, item)
267 268

  
269
        item = QTableWidgetItem('...')
270
        item.tag = []
271
        item.setTextAlignment(Qt.AlignHCenter)
272
        item.setFlags(Qt.ItemIsEnabled)
273
        self.ui.tableWidgetAttr.setItem(rows, 7, item)
274

  
268 275
        attr = SymbolAttr()
269 276
        item = QTableWidgetItem(str(attr.UID))
270 277
        item.tag = attr

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)