개정판 bbd8020c
issue #640:
- Expression 항목 추가
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1509 | 1509 |
@brief get Symbol Attribute |
1510 | 1510 |
@author kyouho |
1511 | 1511 |
@date 2018.07.18 |
1512 |
@history humkyung 2018.10.13 load expression |
|
1512 | 1513 |
''' |
1513 | 1514 |
def getSymbolAttribute(self, _type): |
1514 | 1515 |
result = [] |
... | ... | |
1520 | 1521 |
# Get a cursor object |
1521 | 1522 |
cursor = conn.cursor() |
1522 | 1523 |
|
1523 |
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]' |
|
1524 |
sql = 'select a.UID, a.Attribute, a.DisplayAttribute, a.AttributeType, a.[index], a.[Expression] from SymbolAttribute a inner join SymbolType t on a.SymbolType = t.id and t.type = ? order by a.[index]'
|
|
1524 | 1525 |
param = (_type,) |
1525 | 1526 |
cursor.execute(sql, param) |
1526 | 1527 |
rows = cursor.fetchall() |
1527 | 1528 |
for row in rows: |
1528 |
result.append((row[0], row[1], row[2], row[3])) |
|
1529 |
result.append((row[0], row[1], row[2], row[3], row[4]))
|
|
1529 | 1530 |
# Catch the exception |
1530 | 1531 |
except Exception as ex: |
1531 | 1532 |
from App import App |
... | ... | |
1545 | 1546 |
@brief get Symbol Attribute by UID |
1546 | 1547 |
@author kyouho |
1547 | 1548 |
@date 2018.08.17 |
1549 |
@history humkyung 2018.10.13 load expression |
|
1548 | 1550 |
''' |
1549 | 1551 |
def getSymbolAttributeByUID(self, UID): |
1550 | 1552 |
result = None |
... | ... | |
1556 | 1558 |
# Get a cursor object |
1557 | 1559 |
cursor = conn.cursor() |
1558 | 1560 |
|
1559 |
sql = 'select Attribute, DisplayAttribute, AttributeType from SymbolAttribute where uid = "{}"'.format(UID) |
|
1561 |
sql = 'select Attribute, DisplayAttribute, AttributeType, Expression from SymbolAttribute where uid = "{}"'.format(UID)
|
|
1560 | 1562 |
cursor.execute(sql) |
1561 | 1563 |
rows = cursor.fetchall() |
1562 | 1564 |
if len(rows): |
1563 |
result = (rows[0][0], rows[0][1], rows[0][2]) |
|
1565 |
result = (rows[0][0], rows[0][1], rows[0][2], rows[0][3])
|
|
1564 | 1566 |
# Catch the exception |
1565 | 1567 |
except Exception as ex: |
1566 | 1568 |
from App import App |
... | ... | |
1580 | 1582 |
@brief save symbol attributes |
1581 | 1583 |
@author humkyung |
1582 | 1584 |
@date 2018.08.14 |
1585 |
@history humkyung 2018.10.13 save expression |
|
1583 | 1586 |
''' |
1584 | 1587 |
def saveSymbolAttributes(self, type, attrs): |
1585 | 1588 |
try: |
... | ... | |
1594 | 1597 |
cursor.execute(sql, param) |
1595 | 1598 |
|
1596 | 1599 |
for attr in attrs: |
1597 |
sql = 'insert into SymbolAttribute(UID, SymbolType, Attribute, DisplayAttribute, AttributeType, [index]) values(?, ?, ?, ?, ?, ?)'
|
|
1600 |
sql = 'insert into SymbolAttribute(UID, SymbolType, Attribute, DisplayAttribute, AttributeType, [index], Expression) values(?, ?, ?, ?, ?, ?, ?)'
|
|
1598 | 1601 |
attr.insert(1, type) |
1599 | 1602 |
param = tuple(attr) |
1600 | 1603 |
cursor.execute(sql, param) |
DTI_PID/DTI_PID/Scripts/SymbolAttribute.sql | ||
---|---|---|
4 | 4 |
"Attribute" TEXT NOT NULL, |
5 | 5 |
"DisplayAttribute" TEXT NOT NULL, |
6 | 6 |
"AttributeType" TEXT NOT NULL, |
7 |
"Expression" TEXT, |
|
7 | 8 |
"index" INTEGER NOT NULL, |
8 | 9 |
PRIMARY KEY([SymbolType], [Attribute]) |
9 | 10 |
); |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
1 | 1 |
# coding: utf-8 |
2 |
""" |
|
3 |
This is SymbolAttrEditor module |
|
4 |
""" |
|
2 | 5 |
import os |
3 | 6 |
import sys |
4 | 7 |
import re |
... | ... | |
26 | 29 |
self.currentTypeId = 0 |
27 | 30 |
## insert QTableWidgetEx |
28 | 31 |
self.ui.tableWidgetAttr = QTableWidgetEx(self.ui.groupBox) |
29 |
self.ui.tableWidgetAttr.setColumnCount(4)
|
|
32 |
self.ui.tableWidgetAttr.setColumnCount(5)
|
|
30 | 33 |
self.ui.tableWidgetAttr.setObjectName("tableWidgetAttr") |
31 | 34 |
self.ui.tableWidgetAttr.setRowCount(0) |
32 | 35 |
self.ui.tableWidgetAttr.verticalHeader().setVisible(False) |
... | ... | |
38 | 41 |
## up to here |
39 | 42 |
self.ui.pushButtonAddAttr.clicked.connect(self.onAddAttr) |
40 | 43 |
self.ui.pushButtonDelAttr.clicked.connect(self.onDelAttr) |
41 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['UID', 'Name', 'Display Name', 'Type']) |
|
44 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['UID', 'Name', 'Display Name', 'Type', 'Expression'])
|
|
42 | 45 |
self.ui.tableWidgetAttr.horizontalHeaderItem(1).setSizeHint(QSize(25, 25)) |
43 | 46 |
self.ui.tableWidgetAttr.hideColumn(0) |
44 | 47 |
else: |
... | ... | |
89 | 92 |
symbolType = self.ui.comboBoxSymbolType.currentText() |
90 | 93 |
self.loadData(symbolType) |
91 | 94 |
|
92 |
''' |
|
95 |
def loadData(self, symbolType): |
|
96 |
""" |
|
93 | 97 |
@brief load data |
94 | 98 |
@author humkyung |
95 | 99 |
@date 2018.08.14 |
96 |
''' |
|
97 |
def loadData(self, symbolType): |
|
100 |
@history humkyung 2018.10.13 add expression |
|
101 |
""" |
|
102 |
|
|
98 | 103 |
appDocData = AppDocData.instance() |
99 | 104 |
|
100 | 105 |
self.currentTypeId = appDocData.getSymbolTypeId(symbolType) |
... | ... | |
104 | 109 |
|
105 | 110 |
row = 0 |
106 | 111 |
for attr in attrs: |
107 |
item = QTableWidgetItem(attr[0]) |
|
112 |
item = QTableWidgetItem(attr[0]) # UID
|
|
108 | 113 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
109 |
item = QTableWidgetItem(attr[1]) |
|
114 |
item = QTableWidgetItem(attr[1]) # Name
|
|
110 | 115 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
111 |
item = QTableWidgetItem(attr[2]) |
|
116 |
item = QTableWidgetItem(attr[2]) # Display Name
|
|
112 | 117 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
113 | 118 |
|
114 | 119 |
attrTypeComboBox = QComboBox() |
... | ... | |
118 | 123 |
attrTypeComboBox.addItem('String') |
119 | 124 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox) |
120 | 125 |
|
121 |
result = attrTypeComboBox.findText(attr[3]) |
|
126 |
result = attrTypeComboBox.findText(attr[3]) # Type
|
|
122 | 127 |
attrTypeComboBox.setCurrentIndex(result) |
123 | 128 |
|
129 |
item = QTableWidgetItem(attr[4]) # Expression |
|
130 |
self.ui.tableWidgetAttr.setItem(row, 4, item) |
|
131 |
|
|
124 | 132 |
row = row + 1 |
125 | 133 |
|
126 |
''' |
|
134 |
def saveData(self): |
|
135 |
""" |
|
127 | 136 |
@brief save data |
128 | 137 |
@author humkyung |
129 | 138 |
@date 2018.08.14 |
130 |
''' |
|
131 |
def saveData(self): |
|
139 |
@history humkyung 2018.10.13 save expression |
|
140 |
""" |
|
141 |
|
|
132 | 142 |
appDocData = AppDocData.instance() |
133 | 143 |
|
134 | 144 |
attrs = [] |
... | ... | |
140 | 150 |
attr.append(table.item(index, 1).text() if table.item(index, 1) is not None else '') |
141 | 151 |
attr.append(table.item(index, 2).text() if table.item(index, 2) is not None else '') |
142 | 152 |
attr.append(table.cellWidget(index, 3).currentText()) |
153 |
attr.append(table.item(index, 4).text() if table.item(index, 4) is not None else '') # Expression |
|
143 | 154 |
attr.append(index) |
144 | 155 |
attrs.append(attr) |
145 | 156 |
|
내보내기 Unified diff