개정판 95bd7003
dev issue #640: 심볼이 가지는 속성을 편집하는 창 개발, (이름, 표기 이름, 타입)으로 구성함, #567 소스도 포함
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1472 | 1472 |
# Get a cursor object |
1473 | 1473 |
cursor = conn.cursor() |
1474 | 1474 |
|
1475 |
sql = 'select attribute from SymbolAttribute where Attribute = ?'
|
|
1475 |
sql = 'select UID from SymbolAttribute where UID = ?'
|
|
1476 | 1476 |
param = (attr,) |
1477 | 1477 |
cursor.execute(sql, param) |
1478 | 1478 |
rows = cursor.fetchall() |
... | ... | |
1506 | 1506 |
# Get a cursor object |
1507 | 1507 |
cursor = conn.cursor() |
1508 | 1508 |
|
1509 |
sql = 'select a.DisplayAttribute, a.Attribute, a.AttributeType from SymbolAttribute a inner join SymbolType t on a.SymbolType = t.id and t.type = ? order by attribute'
|
|
1509 |
sql = 'select a.UID, a.Attribute, a.DisplayAttribute, a.AttributeType, a.[index] from SymbolAttribute a inner join SymbolType t on a.SymbolType = t.id and t.type = ? order by a.[index]'
|
|
1510 | 1510 |
param = (_type,) |
1511 | 1511 |
cursor.execute(sql, param) |
1512 | 1512 |
rows = cursor.fetchall() |
1513 | 1513 |
for row in rows: |
1514 |
result.append((row[0], row[1], row[2])) |
|
1514 |
result.append((row[0], row[1], row[2], row[3])) |
|
1515 |
# Catch the exception |
|
1516 |
except Exception as ex: |
|
1517 |
# Roll back any change if something goes wrong |
|
1518 |
conn.rollback() |
|
1519 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
1520 |
finally: |
|
1521 |
# Close the db connection |
|
1522 |
conn.close() |
|
1523 |
|
|
1524 |
return result |
|
1525 |
|
|
1526 |
''' |
|
1527 |
@brief get Symbol Attribute by UID |
|
1528 |
@author kyouho |
|
1529 |
@date 2018.08.17 |
|
1530 |
''' |
|
1531 |
def getSymbolAttributeByUID(self, UID): |
|
1532 |
result = None |
|
1533 |
|
|
1534 |
try: |
|
1535 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
1536 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db') |
|
1537 |
conn = sqlite3.connect(dbPath) |
|
1538 |
# Get a cursor object |
|
1539 |
cursor = conn.cursor() |
|
1540 |
|
|
1541 |
sql = 'select Attribute, DisplayAttribute, AttributeType from SymbolAttribute where uid = "{}"'.format(UID) |
|
1542 |
cursor.execute(sql) |
|
1543 |
rows = cursor.fetchall() |
|
1544 |
if len(rows): |
|
1545 |
result = (rows[0][0], rows[0][1], rows[0][2]) |
|
1515 | 1546 |
# Catch the exception |
1516 | 1547 |
except Exception as ex: |
1517 | 1548 |
# Roll back any change if something goes wrong |
... | ... | |
1541 | 1572 |
cursor.execute(sql, param) |
1542 | 1573 |
|
1543 | 1574 |
for attr in attrs: |
1544 |
sql = 'insert into SymbolAttribute(SymbolType, Attribute) values(?,?)' |
|
1545 |
param = (type, attr) |
|
1575 |
sql = 'insert into SymbolAttribute(UID, SymbolType, Attribute, DisplayAttribute, AttributeType, [index]) values(?, ?, ?, ?, ?, ?)' |
|
1576 |
attr.insert(1, type) |
|
1577 |
param = tuple(attr) |
|
1546 | 1578 |
cursor.execute(sql, param) |
1547 | 1579 |
|
1548 | 1580 |
conn.commit() |
... | ... | |
1559 | 1591 |
conn.close() |
1560 | 1592 |
|
1561 | 1593 |
''' |
1594 |
@brief get symbol type id |
|
1595 |
@author kyouho |
|
1596 |
@date 2018.08.17 |
|
1597 |
''' |
|
1598 |
def getSymbolTypeId(self, symbolType): |
|
1599 |
result = [] |
|
1600 |
|
|
1601 |
try: |
|
1602 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
1603 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db') |
|
1604 |
conn = sqlite3.connect(dbPath) |
|
1605 |
# Get a cursor object |
|
1606 |
cursor = conn.cursor() |
|
1607 |
|
|
1608 |
sql = 'select id from SymbolType where type = ?' |
|
1609 |
param = (symbolType,) |
|
1610 |
cursor.execute(sql, param) |
|
1611 |
rows = cursor.fetchall() |
|
1612 |
|
|
1613 |
if len(rows): |
|
1614 |
result = rows[0][0] |
|
1615 |
else: |
|
1616 |
result = -1 |
|
1617 |
# Catch the exception |
|
1618 |
except Exception as ex: |
|
1619 |
# Roll back any change if something goes wrong |
|
1620 |
conn.rollback() |
|
1621 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
1622 |
finally: |
|
1623 |
# Close the db connection |
|
1624 |
conn.close() |
|
1625 |
|
|
1626 |
return result |
|
1627 |
|
|
1628 |
''' |
|
1562 | 1629 |
@brief get Code Table Data |
1563 | 1630 |
@author kyouho |
1564 | 1631 |
@date 2018.07.10 |
DTI_PID/DTI_PID/ItemDataExportDialog.py | ||
---|---|---|
199 | 199 |
for line in self.sceneLineData.keys(): |
200 | 200 |
# 중복 (어떻게 할지) |
201 | 201 |
if lineNo.count(line) >= 1: |
202 |
rowIndex = lineNo.index(line) |
|
202 | 203 |
continue |
203 | 204 |
# 신규 |
204 | 205 |
else: |
... | ... | |
243 | 244 |
uidList.append(equipTable.item(row, 0).text()) |
244 | 245 |
|
245 | 246 |
for uid in self.sceneEquipData.keys(): |
247 |
equipData = self.sceneEquipData[uid] |
|
246 | 248 |
# 중복 (어떻게 할지) |
247 | 249 |
if uidList.count(uid) >= 1: |
248 |
continue |
|
250 |
rowIndex = uidList.index(uid) |
|
251 |
|
|
252 |
for index in range(len(equipData)): |
|
253 |
if str(equipData[index]): |
|
254 |
oldData = equipTable.item(rowIndex, index).text() |
|
255 |
if oldData != equipData[index]: |
|
256 |
equipTable.item(rowIndex, index).setText(equipData[index]) |
|
257 |
equipTable.item(rowIndex, index).setBackground(QColor(int(134), int(229), int(127))) |
|
249 | 258 |
# 신규 |
250 | 259 |
else: |
251 | 260 |
rowCount += 1 |
252 | 261 |
equipTable.setRowCount(rowCount) |
253 |
equipData = self.sceneEquipData[uid] |
|
254 | 262 |
|
255 | 263 |
for index in range(len(equipData)): |
256 | 264 |
widgetItem = QTableWidgetItem(str(equipData[index]) if equipData[index] is not None else '') |
... | ... | |
288 | 296 |
uidList.append(instTable.item(row, 0).text()) |
289 | 297 |
|
290 | 298 |
for uid in self.sceneInstData.keys(): |
299 |
instData = self.sceneInstData[uid] |
|
291 | 300 |
# 중복 (어떻게 할지) |
292 | 301 |
if uidList.count(uid) >= 1: |
293 |
continue |
|
302 |
rowIndex = uidList.index(uid) |
|
303 |
|
|
304 |
for index in range(len(instData)): |
|
305 |
if str(instData[index]): |
|
306 |
oldData = instTable.item(rowIndex, index).text() |
|
307 |
if oldData != instData[index]: |
|
308 |
instTable.item(rowIndex, index).setText(instData[index]) |
|
309 |
instTable.item(rowIndex, index).setBackground(QColor(int(134), int(229), int(127))) |
|
310 |
|
|
294 | 311 |
# 신규 |
295 | 312 |
else: |
296 | 313 |
rowCount += 1 |
297 | 314 |
instTable.setRowCount(rowCount) |
298 |
instData = self.sceneInstData[uid] |
|
299 | 315 |
|
300 | 316 |
for index in range(len(instData)): |
301 | 317 |
widgetItem = QTableWidgetItem(str(instData[index]) if instData[index] is not None else '') |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
40 | 40 |
self.initResultPropertyTableWidget() |
41 | 41 |
self.mainWindow = mainWindow |
42 | 42 |
|
43 |
self.attrValueList = [] |
|
43 | 44 |
''' |
44 | 45 |
@brief show item's property |
45 | 46 |
@author humkyung |
... | ... | |
252 | 253 |
def initContentsCell(self): |
253 | 254 |
from QEngineeringInstrumentItem import QEngineeringInstrumentItem |
254 | 255 |
|
256 |
self.attrValueList = [] |
|
257 |
|
|
255 | 258 |
if self.symData is not None: |
256 | 259 |
|
257 | 260 |
self.setItem(0, 1, QTableWidgetItem(str(self.symData.uid))) |
... | ... | |
275 | 278 |
docData = AppDocData.instance() |
276 | 279 |
valueItem = QTableWidgetItem(value) |
277 | 280 |
if docData.checkAttribute(key): |
278 |
from PyQt5 import QtGui |
|
279 |
icon = QtGui.QIcon() |
|
280 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
281 |
valueItem.setIcon(icon) |
|
282 |
self.setItem(row, 0, keyItem) |
|
281 |
attrType = docData.getSymbolAttributeByUID(key) |
|
282 |
if attrType[2] == 'Text Item': |
|
283 |
from PyQt5 import QtGui |
|
284 |
icon = QtGui.QIcon() |
|
285 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
286 |
valueItem.setIcon(icon) |
|
287 |
|
|
288 |
self.attrValueList.append((valueItem, key)) |
|
289 |
keyText = docData.getSymbolAttributeByUID(key) |
|
290 |
if keyText is not None: |
|
291 |
keyItem.setText(keyText[1]) |
|
292 |
self.setItem(row, 0, keyItem) |
|
293 |
else: |
|
294 |
self.setItem(row, 0, keyItem) |
|
295 |
|
|
283 | 296 |
self.setItem(row, 1, valueItem) |
284 | 297 |
row = row + 1 |
285 | 298 |
# up to here |
... | ... | |
394 | 407 |
if selectedIndexes[0].column() == 1: |
395 | 408 |
attributeStr = self.item(selectedIndexes[0].row(), 0).text() |
396 | 409 |
items[0].removeSelfAttr(attributeStr) |
397 |
self.mainWindow.refreshResultPropertyTableWidget() |
|
410 |
self.mainWindow.refreshResultPropertyTableWidget() |
|
411 |
|
|
412 |
''' |
|
413 |
''' |
|
414 |
def cellChangedEvent(self, row, column): |
|
415 |
|
|
416 |
pass |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
235 | 235 |
''' |
236 | 236 |
def cellDoubleClickedEvent(self, row, column): |
237 | 237 |
if column == 1: |
238 |
cell = self.resultPropertyTableWidget.item(row, 0) |
|
239 |
if cell is not None and self.resultPropertyTableWidget.item(row, 0).text(): |
|
240 |
cellText = self.resultPropertyTableWidget.item(row, 0).text() |
|
238 |
cell = self.resultPropertyTableWidget.item(row, column) |
|
239 |
|
|
240 |
uid = None |
|
241 |
for data in self.resultPropertyTableWidget.attrValueList: |
|
242 |
if data[0] == cell: |
|
243 |
uid = data[1] |
|
244 |
break |
|
245 |
|
|
246 |
if uid is not None: |
|
241 | 247 |
docData = AppDocData.instance() |
242 |
if docData.checkAttribute(cellText): |
|
248 |
attrType = docData.getSymbolAttributeByUID(uid) |
|
249 |
if attrType[2] == 'Text Item': |
|
243 | 250 |
items = self.graphicsView.scene.selectedItems() |
244 | 251 |
if items is not None and len(items) == 1: |
245 | 252 |
self.graphicsView.command = SelectAttributeCommand.SelectAttributeCommand(self.graphicsView) |
246 | 253 |
cursor = QCursor(Qt.PointingHandCursor) |
247 | 254 |
QApplication.instance().setOverrideCursor(cursor) |
248 |
self.graphicsView.currentAttribute = cellText
|
|
255 |
self.graphicsView.currentAttribute = uid
|
|
249 | 256 |
|
250 | 257 |
# 기존 cellText를 가진 attrs 삭제 |
251 |
items[0].removeSelfAttr(cellText)
|
|
258 |
items[0].removeSelfAttr(uid)
|
|
252 | 259 |
|
253 | 260 |
from PyQt5 import QtGui |
254 | 261 |
cellItem = QTableWidgetItem('') |
... | ... | |
256 | 263 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
257 | 264 |
cellItem.setIcon(icon) |
258 | 265 |
self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
266 |
|
|
267 |
else: |
|
268 |
self.resultPropertyTableWidget.editItem(cell) |
|
269 |
|
|
270 |
|
|
271 |
#cell = self.resultPropertyTableWidget.item(row, 0) |
|
272 |
#if cell is not None and self.resultPropertyTableWidget.item(row, 0).text(): |
|
273 |
# cellText = self.resultPropertyTableWidget.item(row, 0).text() |
|
274 |
# docData = AppDocData.instance() |
|
275 |
|
|
276 |
|
|
277 |
# if docData.checkAttribute(cellText): |
|
278 |
# items = self.graphicsView.scene.selectedItems() |
|
279 |
# if items is not None and len(items) == 1: |
|
280 |
# self.graphicsView.command = SelectAttributeCommand.SelectAttributeCommand(self.graphicsView) |
|
281 |
# cursor = QCursor(Qt.PointingHandCursor) |
|
282 |
# QApplication.instance().setOverrideCursor(cursor) |
|
283 |
# self.graphicsView.currentAttribute = cellText |
|
284 |
|
|
285 |
# # 기존 cellText를 가진 attrs 삭제 |
|
286 |
# items[0].removeSelfAttr(cellText) |
|
287 |
|
|
288 |
# from PyQt5 import QtGui |
|
289 |
# cellItem = QTableWidgetItem('') |
|
290 |
# icon = QtGui.QIcon() |
|
291 |
# icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
292 |
# cellItem.setIcon(icon) |
|
293 |
# self.resultPropertyTableWidget.setItem(row, 1, cellItem) |
|
259 | 294 |
|
260 | 295 |
''' |
261 | 296 |
@brief add message listwidget |
DTI_PID/DTI_PID/Scripts/SymbolAttribute.sql | ||
---|---|---|
1 | 1 |
CREATE TABLE IF NOT EXISTS SymbolAttribute ( |
2 |
UID TEXT NOT NULL, |
|
2 | 3 |
SymbolType TEXT NOT NULL, |
3 | 4 |
"Attribute" TEXT NOT NULL, |
4 | 5 |
"DisplayAttribute" TEXT NOT NULL, |
5 | 6 |
"AttributeType" TEXT NOT NULL, |
6 |
CONSTRAINT SymbolAttribute_SymbolType_FK FOREIGN KEY (SymbolType) REFERENCES SymbolType(id) |
|
7 |
"index" INTEGER NOT NULL, |
|
8 |
PRIMARY KEY([SymbolType], [Attribute]) |
|
7 | 9 |
); |
10 |
|
|
11 |
--CONSTRAINT SymbolAttribute_SymbolType_FK FOREIGN KEY (SymbolType) REFERENCES SymbolType(id) |
DTI_PID/DTI_PID/SelectAttributeDialog.py | ||
---|---|---|
13 | 13 |
def __init__(self, parent, symbolType): |
14 | 14 |
QDialog.__init__(self, parent) |
15 | 15 |
|
16 |
self.attrList = [] |
|
16 | 17 |
self.removeUID = {} |
17 | 18 |
self.currentCode = {} |
18 | 19 |
|
... | ... | |
24 | 25 |
|
25 | 26 |
self.settingComboBoxAttribute(symbolType) |
26 | 27 |
|
28 |
|
|
29 |
|
|
27 | 30 |
''' |
28 | 31 |
@brief setting comboboxAttribute |
29 | 32 |
@author kyouho |
... | ... | |
33 | 36 |
docData = AppDocData.instance() |
34 | 37 |
symbolAttrs = docData.getSymbolAttribute(symbolType) |
35 | 38 |
for attr in symbolAttrs: |
36 |
self.ui.comboBoxAttribute.addItem(attr[0]) |
|
39 |
self.attrList.append((attr[0], attr[1], attr[2])) |
|
40 |
self.ui.comboBoxAttribute.addItem(attr[2]) |
|
37 | 41 |
|
38 | 42 |
''' |
39 | 43 |
@brief accept |
... | ... | |
43 | 47 |
def accept(self): |
44 | 48 |
self.dialogResult = True |
45 | 49 |
index = self.ui.comboBoxAttribute.currentIndex() |
46 |
self.selectedAttribute = self.ui.comboBoxAttribute.itemText(index)
|
|
50 |
self.selectedAttribute = self.attrList[index][0]
|
|
47 | 51 |
QDialog.accept(self) |
DTI_PID/DTI_PID/Shapes/QEngineeringEquipmentItem.py | ||
---|---|---|
118 | 118 |
dataList[0] = str(self.uid) |
119 | 119 |
dataList[14] = docData.imgName |
120 | 120 |
|
121 |
childItems = [item for item in self.childItems() if issubclass(type(item), QEngineeringTextItem)] |
|
122 |
if len(childItems): |
|
123 |
dataList[1] = childItems[0].text() |
|
124 |
|
|
125 | 121 |
for attr in attrs: |
126 |
pass |
|
122 |
attrInfo = docData.getSymbolAttributeByUID(attr.attribute) |
|
123 |
attrName = attrInfo[0] |
|
124 |
if instColumnList.count(attrName): |
|
125 |
colIndex = instColumnList.index(attrName) |
|
126 |
dataList[colIndex] = attr.text() |
|
127 | 127 |
|
128 | 128 |
except Exception as ex: |
129 | 129 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
DTI_PID/DTI_PID/Shapes/QEngineeringInstrumentItem.py | ||
---|---|---|
153 | 153 |
@date 2018.06.14 |
154 | 154 |
''' |
155 | 155 |
def getAttributes(self): |
156 |
res = {} |
|
157 |
|
|
156 |
attrs = {} |
|
158 | 157 |
try: |
159 |
res['Measured Variable Code'] = self.measuredVariableCode |
|
160 |
res['Type Modifier'] = self.typeModifier |
|
161 |
res['Tag Seq No'] = self.tagSeqNo |
|
162 |
res['Tag Suffix'] = self.tagSuffix |
|
158 |
from AppDocData import AppDocData |
|
159 |
from EngineeringTextItem import QEngineeringTextItem |
|
160 |
|
|
161 |
attrs['Measured Variable Code'] = self.measuredVariableCode |
|
162 |
attrs['Type Modifier'] = self.typeModifier |
|
163 |
attrs['Tag Seq No'] = self.tagSeqNo |
|
164 |
attrs['Tag Suffix'] = self.tagSuffix |
|
165 |
|
|
166 |
# 해당 Type의 attribute setting |
|
167 |
docData = AppDocData.instance() |
|
168 |
symbolAttrs = docData.getSymbolAttribute(self.type) |
|
169 |
for attr in symbolAttrs: |
|
170 |
attrs[attr[0]] = '' |
|
171 |
|
|
172 |
for attr in self.attrs: |
|
173 |
if type(attr) is QEngineeringTextItem: |
|
174 |
attrs[attr.attribute] = attr.text() |
|
163 | 175 |
except Exception as ex: |
164 | 176 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
165 | 177 |
|
166 |
return res
|
|
178 |
return attrs
|
|
167 | 179 |
|
168 | 180 |
''' |
169 | 181 |
@brief generate xml code for attribute |
... | ... | |
285 | 297 |
dataList[0] = str(self.uid) |
286 | 298 |
dataList[13] = docData.imgName |
287 | 299 |
|
288 |
childItems = [item for item in self.childItems() if issubclass(type(item), QEngineeringTextItem)] |
|
289 |
if len(childItems): |
|
290 |
dataList[1] = childItems[0].text() |
|
291 |
|
|
292 | 300 |
for attr in attrs: |
293 |
pass |
|
301 |
attrInfo = docData.getSymbolAttributeByUID(attr.attribute) |
|
302 |
attrName = attrInfo[0] |
|
303 |
if instColumnList.count(attrName): |
|
304 |
colIndex = instColumnList.index(attrName) |
|
305 |
dataList[colIndex] = attr.text() |
|
294 | 306 |
|
295 | 307 |
except Exception as ex: |
296 | 308 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
16 | 16 |
QDialog.__init__(self, parent) |
17 | 17 |
|
18 | 18 |
self._symbolType = symbolType |
19 |
self.currentTypeId = 0 |
|
19 | 20 |
|
20 | 21 |
self.ui = AttrEditor_UI.Ui_AttrEditorDialog() |
21 | 22 |
self.ui.setupUi(self) |
22 | 23 |
## insert QTableWidgetEx |
23 | 24 |
self.ui.tableWidgetAttr = QTableWidgetEx(self.ui.groupBox) |
24 |
self.ui.tableWidgetAttr.setColumnCount(3)
|
|
25 |
self.ui.tableWidgetAttr.setColumnCount(4)
|
|
25 | 26 |
self.ui.tableWidgetAttr.setObjectName("tableWidgetAttr") |
26 | 27 |
self.ui.tableWidgetAttr.setRowCount(0) |
27 | 28 |
self.ui.tableWidgetAttr.verticalHeader().setVisible(False) |
... | ... | |
38 | 39 |
self.ui.pushButtonAddAttr.clicked.connect(self.onAddAttr) |
39 | 40 |
self.ui.pushButtonDelAttr.clicked.connect(self.onDelAttr) |
40 | 41 |
|
41 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['Name', 'Display Name', 'Type']) |
|
42 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['UID', 'Name', 'Display Name', 'Type'])
|
|
42 | 43 |
self.ui.tableWidgetAttr.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
43 | 44 |
|
44 | 45 |
|
... | ... | |
80 | 81 |
def loadData(self, symbolType): |
81 | 82 |
appDocData = AppDocData.instance() |
82 | 83 |
|
84 |
self.currentTypeId = appDocData.getSymbolTypeId(symbolType) |
|
85 |
|
|
83 | 86 |
attrs = appDocData.getSymbolAttribute(symbolType) |
84 | 87 |
self.ui.tableWidgetAttr.setRowCount(len(attrs)) |
85 | 88 |
|
86 | 89 |
row = 0 |
87 | 90 |
for attr in attrs: |
88 | 91 |
item = QTableWidgetItem(attr[0]) |
89 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
|
90 |
item = QTableWidgetItem(attr[1]) |
|
91 | 92 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
93 |
item = QTableWidgetItem(attr[1]) |
|
94 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
|
95 |
item = QTableWidgetItem(attr[2]) |
|
96 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
|
92 | 97 |
|
93 | 98 |
attrTypeComboBox = QComboBox() |
94 | 99 |
attrTypeComboBox.addItem('Symbol Item') |
95 | 100 |
attrTypeComboBox.addItem('Text Item') |
96 | 101 |
attrTypeComboBox.addItem('Int') |
97 | 102 |
attrTypeComboBox.addItem('String') |
98 |
self.ui.tableWidgetAttr.setCellWidget(row, 2, attrTypeComboBox)
|
|
103 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox)
|
|
99 | 104 |
|
100 |
result = attrTypeComboBox.findText(attr[2])
|
|
105 |
result = attrTypeComboBox.findText(attr[3])
|
|
101 | 106 |
attrTypeComboBox.setCurrentIndex(result) |
102 | 107 |
|
103 | 108 |
row = row + 1 |
... | ... | |
110 | 115 |
def saveData(self): |
111 | 116 |
appDocData = AppDocData.instance() |
112 | 117 |
|
113 |
#appDocData.saveSymbolAttributes(self._symbolType[0], ) |
|
118 |
attrs = [] |
|
119 |
table = self.ui.tableWidgetAttr |
|
120 |
|
|
121 |
for index in range(table.rowCount()): |
|
122 |
attr = [] |
|
123 |
attr.append(table.item(index, 0).text() if table.item(index, 0) is not None else '') |
|
124 |
attr.append(table.item(index, 1).text() if table.item(index, 1) is not None else '') |
|
125 |
attr.append(table.item(index, 2).text() if table.item(index, 2) is not None else '') |
|
126 |
attr.append(table.cellWidget(index, 3).currentText()) |
|
127 |
attr.append(index) |
|
128 |
attrs.append(attr) |
|
129 |
|
|
130 |
appDocData.saveSymbolAttributes(self.currentTypeId, attrs) |
|
114 | 131 |
|
115 | 132 |
''' |
116 | 133 |
@brief add a attribute |
... | ... | |
126 | 143 |
attrTypeComboBox.addItem('Text Item') |
127 | 144 |
attrTypeComboBox.addItem('Int') |
128 | 145 |
attrTypeComboBox.addItem('String') |
129 |
self.ui.tableWidgetAttr.setCellWidget(rows, 2, attrTypeComboBox) |
|
146 |
self.ui.tableWidgetAttr.setCellWidget(rows, 3, attrTypeComboBox) |
|
147 |
|
|
148 |
import uuid |
|
149 |
self.ui.tableWidgetAttr.setItem(rows, 0, QTableWidgetItem(str(uuid.uuid4()))) |
|
130 | 150 |
|
131 | 151 |
''' |
132 | 152 |
@brief delete selected attribute |
내보내기 Unified diff