개정판 5550ec23
issue #587: set item attr individually and fix db
Change-Id: Iaec9e3e29bb3ca05e2746283dfd1dd06f225e6ef
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
201 | 201 |
""" get attributes of item from database """ |
202 | 202 |
docData = AppDocData.instance() |
203 | 203 |
symbolAttrs = docData.getSymbolAttribute(self.type) if type(self) is not QEngineeringLineItem else docData.getSymbolAttribute('Line') |
204 |
targetAttrs = [] |
|
205 |
if type(self) is not QEngineeringLineItem: |
|
206 |
for attr in symbolAttrs: |
|
207 |
if attr.Target is None or attr.Target == 'ALL' or [target for target in attr.Target.split(',') if self.dbUid is int(target)]: |
|
208 |
targetAttrs.append(attr) |
|
204 | 209 |
|
205 | 210 |
_texts = self.texts() |
206 | 211 |
_symbols = self.symbols() |
207 |
for attr in symbolAttrs:
|
|
212 |
for attr in targetAttrs:
|
|
208 | 213 |
matches = [_attr for _attr,_ in self.attrs.items() if _attr.UID == attr.UID] |
209 | 214 |
if matches: |
210 | 215 |
attr.Freeze = matches[0].Freeze ### update freeze value |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
212 | 212 |
|
213 | 213 |
self.ui.tableWidgetAttr.setCellWidget(rows, 3, attrTypeComboBox) |
214 | 214 |
|
215 |
item = QTableWidgetItem('ALL') |
|
216 |
item.tag = 'ALL' |
|
217 |
item.setTextAlignment(Qt.AlignHCenter) |
|
218 |
item.setFlags(Qt.ItemIsEnabled) |
|
219 |
self.ui.tableWidgetAttr.setItem(rows, 6, item) |
|
220 |
|
|
215 | 221 |
import uuid |
216 | 222 |
self.ui.tableWidgetAttr.setItem(rows, 0, QTableWidgetItem(str(uuid.uuid4()))) |
217 | 223 |
|
... | ... | |
298 | 304 |
attrTypeComboBox.addItem('Int') |
299 | 305 |
attrTypeComboBox.addItem('String') |
300 | 306 |
self.ui.tableWidgetAttr.setCellWidget(rows, 3, attrTypeComboBox) |
301 |
|
|
307 |
|
|
302 | 308 |
import uuid |
303 | 309 |
self.ui.tableWidgetAttr.setItem(rows, 0, QTableWidgetItem(str(uuid.uuid4()))) |
304 | 310 |
|
DTI_PID/DTI_PID/SymbolAttrTargetDialog.py | ||
---|---|---|
55 | 55 |
self.isAccepted = False |
56 | 56 |
|
57 | 57 |
self.ui.tableWidget.resizeColumnsToContents() |
58 |
self.ui.checkBox.stateChanged.connect(self.checkBoxChanged) |
|
59 |
self.ui.checkBox.stateChanged.emit(self.ui.checkBox.checkState()) |
|
60 |
|
|
61 |
def checkBoxChanged(self, checkState): |
|
62 |
if checkState is int(Qt.Checked): |
|
63 |
for row in range(self.ui.tableWidget.rowCount()): |
|
64 |
self.ui.tableWidget.item(row, 1).setCheckState(Qt.Checked) |
|
65 |
self.ui.tableWidget.setEnabled(False) |
|
66 |
elif checkState is int(Qt.Unchecked): |
|
67 |
for row in range(self.ui.tableWidget.rowCount()): |
|
68 |
self.ui.tableWidget.item(row, 1).setCheckState(Qt.Unchecked) |
|
69 |
self.ui.tableWidget.setEnabled(True) |
|
58 | 70 |
|
59 | 71 |
''' |
60 | 72 |
@brief accept dialog |
내보내기 Unified diff