개정판 33cff95d
dev issue #640: add display attribute
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1506 | 1506 |
# Get a cursor object |
1507 | 1507 |
cursor = conn.cursor() |
1508 | 1508 |
|
1509 |
sql = 'select a.attribute from SymbolAttribute a inner join SymbolType t on a.SymbolType = t.id and t.type = ? order by attribute'
|
|
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'
|
|
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])
|
|
1514 |
result.append((row[0], row[1], row[2]))
|
|
1515 | 1515 |
# Catch the exception |
1516 | 1516 |
except Exception as ex: |
1517 | 1517 |
# Roll back any change if something goes wrong |
DTI_PID/DTI_PID/ItemDataExportDialog.py | ||
---|---|---|
117 | 117 |
''' |
118 | 118 |
def initComboBox(self): |
119 | 119 |
self.ui.comboBoxDoc.addItem('ALL') |
120 |
self.ui.comboBoxDoc |
|
121 | 120 |
docData = AppDocData.instance() |
122 | 121 |
|
123 | 122 |
documentNameList = [] |
DTI_PID/DTI_PID/Scripts/INSTRUMENT_DATA_LIST.sql | ||
---|---|---|
1 |
CREATE TABLE IF NOT EXISTS INSTRUMENT_DATA_LIST ( |
|
2 |
UID TEXT, |
|
3 |
ITEM_NO TEXT, |
|
4 |
SERVICE TEXT, |
|
5 |
FLOW_RATE TEXT, |
|
6 |
PRESSURE TEXT, |
|
7 |
TEMPERATURE TEXT, |
|
8 |
TPYE TEXT, |
|
9 |
RANGE TEXT, |
|
10 |
NOR_LEVEL_MM TEXT, |
|
11 |
NOR_LEVEL_PERCENT TEXT, |
|
12 |
DEL_PRESS TEXT, |
|
13 |
SHUT_OFF TEXT, |
|
14 |
LOCATION TEXT, |
|
15 |
PNID_NO TEXT, |
|
16 |
REV TEXT, |
|
17 |
CONSTRAINT EQUIPMENT_DATA_LIST_PK PRIMARY KEY (UID) |
|
18 |
); |
|
19 |
CREATE UNIQUE INDEX IF NOT EXISTS INSTRUMENT_DATA_LIST_TAG_NO_IDX ON INSTRUMENT_DATA_LIST (UID); |
DTI_PID/DTI_PID/Scripts/SymbolAttribute.sql | ||
---|---|---|
1 | 1 |
CREATE TABLE IF NOT EXISTS SymbolAttribute ( |
2 | 2 |
SymbolType TEXT NOT NULL, |
3 | 3 |
"Attribute" TEXT NOT NULL, |
4 |
"DisplayAttribute" TEXT NOT NULL, |
|
5 |
"AttributeType" TEXT NOT NULL, |
|
4 | 6 |
CONSTRAINT SymbolAttribute_SymbolType_FK FOREIGN KEY (SymbolType) REFERENCES SymbolType(id) |
5 | 7 |
); |
DTI_PID/DTI_PID/SelectAttributeDialog.py | ||
---|---|---|
33 | 33 |
docData = AppDocData.instance() |
34 | 34 |
symbolAttrs = docData.getSymbolAttribute(symbolType) |
35 | 35 |
for attr in symbolAttrs: |
36 |
self.ui.comboBoxAttribute.addItem(attr) |
|
36 |
self.ui.comboBoxAttribute.addItem(attr[0])
|
|
37 | 37 |
|
38 | 38 |
''' |
39 | 39 |
@brief accept |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
520 | 520 |
docData = AppDocData.instance() |
521 | 521 |
symbolAttrs = docData.getSymbolAttribute(self.type) |
522 | 522 |
for attr in symbolAttrs: |
523 |
attrs[attr] = '' |
|
523 |
attrs[attr[0]] = ''
|
|
524 | 524 |
|
525 | 525 |
for attr in self.attrs: |
526 | 526 |
if type(attr) is QEngineeringTextItem: |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
21 | 21 |
self.ui.setupUi(self) |
22 | 22 |
## insert QTableWidgetEx |
23 | 23 |
self.ui.tableWidgetAttr = QTableWidgetEx(self.ui.groupBox) |
24 |
self.ui.tableWidgetAttr.setColumnCount(2)
|
|
24 |
self.ui.tableWidgetAttr.setColumnCount(3)
|
|
25 | 25 |
self.ui.tableWidgetAttr.setObjectName("tableWidgetAttr") |
26 | 26 |
self.ui.tableWidgetAttr.setRowCount(0) |
27 | 27 |
self.ui.tableWidgetAttr.verticalHeader().setVisible(False) |
28 | 28 |
self.ui.horizontalLayout_2.addWidget(self.ui.tableWidgetAttr) |
29 | 29 |
## up to here |
30 | 30 |
|
31 |
# |
|
31 |
## combobox logic
|
|
32 | 32 |
self.settingComboBoxSymbolType(symbolType[2]) |
33 |
# |
|
33 |
self.ui.comboBoxSymbolType.currentTextChanged.connect(self.changeSymbolType) |
|
34 |
## up to here |
|
34 | 35 |
|
35 | 36 |
#self.ui.labelSelectedSymbolType.setText(symbolType[2]) |
36 | 37 |
|
37 | 38 |
self.ui.pushButtonAddAttr.clicked.connect(self.onAddAttr) |
38 | 39 |
self.ui.pushButtonDelAttr.clicked.connect(self.onDelAttr) |
39 | 40 |
|
40 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['Name', 'Type']) |
|
41 |
self.ui.tableWidgetAttr.setHorizontalHeaderLabels(['Name', 'Display Name', 'Type'])
|
|
41 | 42 |
self.ui.tableWidgetAttr.horizontalHeaderItem(0).setSizeHint(QSize(25, 25)) |
42 | 43 |
|
43 |
self.loadData() |
|
44 |
|
|
44 |
|
|
45 | 45 |
|
46 | 46 |
''' |
47 | 47 |
@brief setting combobox symbolType |
... | ... | |
60 | 60 |
if result != -1: |
61 | 61 |
comboBox.setCurrentIndex(result) |
62 | 62 |
|
63 |
self.changeSymbolType() |
|
63 | 64 |
|
65 |
''' |
|
66 |
@brief combobox symbolType change logic |
|
67 |
@author kyouho |
|
68 |
@date 2018.08.16 |
|
69 |
''' |
|
70 |
def changeSymbolType(self): |
|
71 |
symbolType = self.ui.comboBoxSymbolType.currentText() |
|
72 |
self.loadData(symbolType) |
|
64 | 73 |
|
65 | 74 |
|
66 | 75 |
''' |
... | ... | |
68 | 77 |
@author humkyung |
69 | 78 |
@date 2018.08.14 |
70 | 79 |
''' |
71 |
def loadData(self): |
|
80 |
def loadData(self, symbolType):
|
|
72 | 81 |
appDocData = AppDocData.instance() |
73 | 82 |
|
74 |
attrs = appDocData.getSymbolAttribute(self._symbolType[2])
|
|
83 |
attrs = appDocData.getSymbolAttribute(symbolType)
|
|
75 | 84 |
self.ui.tableWidgetAttr.setRowCount(len(attrs)) |
76 | 85 |
|
77 | 86 |
row = 0 |
78 | 87 |
for attr in attrs: |
79 |
item = QTableWidgetItem(attr) |
|
88 |
item = QTableWidgetItem(attr[0]) |
|
89 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
|
90 |
item = QTableWidgetItem(attr[1]) |
|
80 | 91 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
81 | 92 |
|
82 | 93 |
attrTypeComboBox = QComboBox() |
... | ... | |
84 | 95 |
attrTypeComboBox.addItem('Text Item') |
85 | 96 |
attrTypeComboBox.addItem('Int') |
86 | 97 |
attrTypeComboBox.addItem('String') |
87 |
self.ui.tableWidgetAttr.setCellWidget(row, 1, attrTypeComboBox) |
|
98 |
self.ui.tableWidgetAttr.setCellWidget(row, 2, attrTypeComboBox) |
|
99 |
|
|
100 |
result = attrTypeComboBox.findText(attr[2]) |
|
101 |
attrTypeComboBox.setCurrentIndex(result) |
|
88 | 102 |
|
89 | 103 |
row = row + 1 |
90 | 104 |
|
... | ... | |
112 | 126 |
attrTypeComboBox.addItem('Text Item') |
113 | 127 |
attrTypeComboBox.addItem('Int') |
114 | 128 |
attrTypeComboBox.addItem('String') |
115 |
self.ui.tableWidgetAttr.setCellWidget(rows, 1, attrTypeComboBox)
|
|
129 |
self.ui.tableWidgetAttr.setCellWidget(rows, 2, attrTypeComboBox)
|
|
116 | 130 |
|
117 | 131 |
''' |
118 | 132 |
@brief delete selected attribute |
내보내기 Unified diff