개정판 04271a49
issue #587: 장치의 속성 연계
Change-Id: I3c291118b6ea954b9b5bbd25beb3044b8ccbe1c8
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
2100 | 2100 |
cursor = conn.cursor() |
2101 | 2101 | |
2102 | 2102 |
for data in datas: |
2103 |
uid = data[0]
|
|
2103 |
uid,code,description,allowables = data[0],data[1],data[2],data[3]
|
|
2104 | 2104 |
if not uid: |
2105 | 2105 |
sql = "insert or replace into {}(UID, CODE, DESCRIPTION, ALLOWABLES) values(lower(hex(randomblob(16))), ?, ?, ?)".format(tableName) |
2106 | 2106 |
param = (data[1], data[2], data[3]) |
2107 |
elif uid == '-1': |
|
2108 |
sql = 'delete from {} where uid=?'.format(tableName) |
|
2109 |
param = (data[-1],) |
|
2107 | 2110 |
else: |
2108 | 2111 |
sql = "update {} SET CODE=?, DESCRIPTION=?, ALLOWABLES=? WHERE UID = ?".format(tableName) |
2109 | 2112 |
param = (data[1], data[2], data[3], data[0]) |
... | ... | |
2115 | 2118 |
except Exception as ex: |
2116 | 2119 |
# Roll back any change if something goes wrong |
2117 | 2120 |
conn.rollback() |
2118 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
|
|
2121 |
print('error occured({}:{}) in {}:{}'.format(tableName, ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
|
|
2119 | 2122 |
finally: |
2120 | 2123 |
# Close the db connection |
2121 | 2124 |
conn.close() |
DTI_PID/DTI_PID/CodeTableDialog.py | ||
---|---|---|
11 | 11 |
import CodeTable_UI |
12 | 12 | |
13 | 13 |
class QCodeTableDialog(QDialog): |
14 |
""" |
|
15 |
This code table dialog class |
|
16 |
""" |
|
17 | ||
18 |
CODE_TABLES = ('Nominal Diameter', 'Fluid Code', 'Insulation Purpose', 'PnID Number', 'Piping Materials Class', 'Unit Number', 'ValveOperCodes', 'EqpTagNames') |
|
19 | ||
14 | 20 |
def __init__(self, parent): |
15 | 21 |
QDialog.__init__(self, parent) |
16 | 22 | |
17 |
self.removeUID = {} |
|
18 | 23 |
self.currentCode = {} |
19 | 24 | |
20 | 25 |
self.ui = CodeTable_UI.Ui_CodeTableDialog() |
... | ... | |
29 | 34 |
self.ui.tableWidgetValveOperCodes.setSortingEnabled(True) |
30 | 35 | |
31 | 36 |
#DB Table명 기준으로 작성 |
32 |
self.settingTable("Nominal Diameter") |
|
33 |
self.settingTable("Fluid Code") |
|
34 |
self.settingTable("Insulation Purpose") |
|
35 |
self.settingTable("PnID Number") |
|
36 |
self.settingTable("Piping Materials Class") |
|
37 |
self.settingTable("Unit Number") |
|
38 |
self.settingTable("ValveOperCodes") |
|
37 |
for table in QCodeTableDialog.CODE_TABLES: |
|
38 |
self.settingTable(table) |
|
39 | 39 | |
40 | 40 |
''' |
41 | 41 |
@brief Setting Table |
... | ... | |
105 | 105 |
table.setRowCount(len(tableDatas)) |
106 | 106 |
row = 0 |
107 | 107 |
for tableData in tableDatas: |
108 |
table.setItem(row, 0, QTableWidgetItem(tableData[0])) |
|
109 |
table.setItem(row, 1, QTableWidgetItem(tableData[1])) |
|
110 |
table.setItem(row, 2, QTableWidgetItem(tableData[2])) |
|
111 |
table.setItem(row, 3, QTableWidgetItem(tableData[3])) |
|
108 |
table.setItem(row, 0, QTableWidgetItem(tableData[0])) # UID
|
|
109 |
table.setItem(row, 1, QTableWidgetItem(tableData[1])) # Name
|
|
110 |
table.setItem(row, 2, QTableWidgetItem(tableData[2])) # Description
|
|
111 |
table.setItem(row, 3, QTableWidgetItem(tableData[3])) # Allowables
|
|
112 | 112 |
row += 1 |
113 | 113 |
except Exception as ex: |
114 | 114 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
115 | 115 | |
116 | ||
117 | 116 |
''' |
118 | 117 |
@brief Find TableWidget with Name |
119 | 118 |
@author kyouhokyouho |
... | ... | |
150 | 149 |
|
151 | 150 |
if tabText != "NominalDiameter": |
152 | 151 |
for row in rowsIndex: |
152 |
table.hideRow(row) |
|
153 |
""" |
|
153 | 154 |
uid = table.item(row, 0).text() |
154 | 155 |
self.removeUID[uid] = tabText |
155 | 156 |
model.removeRow(row) |
157 |
""" |
|
156 | 158 | |
157 | 159 |
self.checkRowAndAddRow(tabText, table) |
158 |
|
|
159 |
|
|
160 | 160 |
except Exception as ex: |
161 | 161 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
162 | 162 | |
... | ... | |
171 | 171 |
result = True |
172 | 172 |
if tableName != "NominalDiameter": |
173 | 173 |
for row in range(rowCount): |
174 |
if table.isRowHidden(row): continue |
|
174 | 175 |
code = table.item(row, 1).text() |
175 | 176 |
if not code: |
176 | 177 |
result = False |
... | ... | |
248 | 249 |
rowCount = table.rowCount() |
249 | 250 |
codes = [] |
250 | 251 |
for row in range(rowCount): |
252 |
if table.isRowHidden(row): continue |
|
251 | 253 |
code = table.item(row, 1).text() |
252 | 254 |
codes.append(code) |
253 | 255 | |
... | ... | |
281 | 283 |
except Exception as ex: |
282 | 284 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
283 | 285 | |
284 |
|
|
285 | 286 |
''' |
286 | 287 |
@brief replaceTextForCodeTable |
287 | 288 |
@author kyouho |
... | ... | |
296 | 297 |
@date 2018.07.12 |
297 | 298 |
''' |
298 | 299 |
def accept(self): |
299 |
self.saveCommonCodeData("Fluid Code") |
|
300 |
self.saveCommonCodeData("Insulation Purpose") |
|
301 |
self.saveCommonCodeData("PnID Number") |
|
302 |
self.saveCommonCodeData("Piping Materials Class") |
|
303 |
self.saveCommonCodeData("Unit Number") |
|
304 |
self.saveCommonCodeData("ValveOperCodes") |
|
305 |
self.deleteCommonCodeData() |
|
300 |
for table in QCodeTableDialog.CODE_TABLES: |
|
301 |
if table != 'Nominal Diameter': |
|
302 |
self.saveCommonCodeData(table) |
|
306 | 303 | |
307 | 304 |
self.saveNomialPipeSize() |
308 | 305 | |
... | ... | |
320 | 317 |
table = self.findTableWidget(tableName) |
321 | 318 |
rowCount = table.rowCount() |
322 | 319 |
for row in range(rowCount): |
323 |
uid = table.item(row, 0).text() |
|
324 |
code = table.item(row, 1).text() |
|
325 |
description = table.item(row, 2).text() if table.item(row, 2) is not None else '' |
|
326 |
allowables = table.item(row, 3).text() if table.item(row, 3) is not None else '' |
|
320 |
if table.isRowHidden(row): |
|
321 |
uid, code, description, allowables = '-1',table.item(row, 1).text(),'',table.item(row, 0).text() |
|
322 |
else: |
|
323 |
uid = table.item(row, 0).text() |
|
324 |
code = table.item(row, 1).text() |
|
325 |
description = table.item(row, 2).text() if table.item(row, 2) is not None else '' |
|
326 |
allowables = table.item(row, 3).text() if table.item(row, 3) is not None else '' |
|
327 | 327 | |
328 | 328 |
if code: |
329 | 329 |
datas.append((uid, code, description, allowables)) |
... | ... | |
339 | 339 |
''' |
340 | 340 |
@brief save common code data |
341 | 341 |
@author kyouho |
342 |
@date 2018.07.12 |
|
343 |
''' |
|
344 |
def deleteCommonCodeData(self): |
|
345 |
try: |
|
346 |
datas = self.removeUID.items() |
|
347 |
docData = AppDocData.instance() |
|
348 |
docData.deleteCommonCodeData(datas) |
|
349 |
except Exception as ex: |
|
350 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
351 | ||
352 |
''' |
|
353 |
@brief save common code data |
|
354 |
@author kyouho |
|
355 | 342 |
@date 2018.07.16 |
356 | 343 |
''' |
357 | 344 |
def saveNomialPipeSize(self): |
... | ... | |
377 | 364 |
docData.insertNomialPipeSize(pipeSizes) |
378 | 365 | |
379 | 366 |
except Exception as ex: |
380 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
367 |
from App import App |
|
368 | ||
369 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
370 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
381 | 371 | |
382 | 372 |
''' |
383 | 373 |
@brief save common code data |
DTI_PID/DTI_PID/CodeTable_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 |
# Form implementation generated from reading ui file './UI/CodeTable.ui'
|
|
3 |
# Form implementation generated from reading ui file '.\UI\CodeTable.ui'
|
|
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.12
|
|
5 |
# Created by: PyQt5 UI code generator 5.11.3
|
|
6 | 6 |
# |
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 | |
9 | 9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
10 | 10 | |
11 | ||
12 | 11 |
class Ui_CodeTableDialog(object): |
13 | 12 |
def setupUi(self, CodeTableDialog): |
14 | 13 |
CodeTableDialog.setObjectName("CodeTableDialog") |
15 |
CodeTableDialog.resize(836, 589)
|
|
14 |
CodeTableDialog.resize(910, 589)
|
|
16 | 15 |
font = QtGui.QFont() |
17 | 16 |
font.setFamily("맑은 고딕") |
18 | 17 |
CodeTableDialog.setFont(font) |
... | ... | |
157 | 156 |
self.gridLayout_20.addWidget(self.tableWidgetValveOperCodes, 0, 0, 1, 1) |
158 | 157 |
self.gridLayout_19.addWidget(self.groupBox_7, 0, 0, 1, 1) |
159 | 158 |
self.tabWidget.addTab(self.tab, "") |
159 |
self.tab_2 = QtWidgets.QWidget() |
|
160 |
self.tab_2.setObjectName("tab_2") |
|
161 |
self.gridLayout_22 = QtWidgets.QGridLayout(self.tab_2) |
|
162 |
self.gridLayout_22.setObjectName("gridLayout_22") |
|
163 |
self.groupBox_8 = QtWidgets.QGroupBox(self.tab_2) |
|
164 |
self.groupBox_8.setObjectName("groupBox_8") |
|
165 |
self.gridLayout_21 = QtWidgets.QGridLayout(self.groupBox_8) |
|
166 |
self.gridLayout_21.setObjectName("gridLayout_21") |
|
167 |
self.tableWidgetEqpTagNames = QtWidgets.QTableWidget(self.groupBox_8) |
|
168 |
self.tableWidgetEqpTagNames.setColumnCount(3) |
|
169 |
self.tableWidgetEqpTagNames.setObjectName("tableWidgetEqpTagNames") |
|
170 |
self.tableWidgetEqpTagNames.setRowCount(0) |
|
171 |
self.tableWidgetEqpTagNames.verticalHeader().setVisible(False) |
|
172 |
self.gridLayout_21.addWidget(self.tableWidgetEqpTagNames, 0, 0, 1, 1) |
|
173 |
self.gridLayout_22.addWidget(self.groupBox_8, 0, 0, 1, 1) |
|
174 |
self.tabWidget.addTab(self.tab_2, "") |
|
160 | 175 |
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) |
161 | 176 | |
162 | 177 |
self.retranslateUi(CodeTableDialog) |
... | ... | |
182 | 197 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabUnitNumber), _translate("CodeTableDialog", "Unit Number")) |
183 | 198 |
self.groupBox_7.setTitle(_translate("CodeTableDialog", "Codes")) |
184 | 199 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("CodeTableDialog", "Valve Oper Codes")) |
200 |
self.groupBox_8.setTitle(_translate("CodeTableDialog", "Tag Names")) |
|
201 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("CodeTableDialog", "Eqp Tag Names")) |
|
185 | 202 | |
186 | ||
187 | ||
188 | ||
189 |
if __name__ == "__main__": |
|
190 |
import sys |
|
191 |
app = QtWidgets.QApplication(sys.argv) |
|
192 |
CodeTableDialog = QtWidgets.QDialog() |
|
193 |
ui = Ui_CodeTableDialog() |
|
194 |
ui.setupUi(CodeTableDialog) |
|
195 |
CodeTableDialog.show() |
|
196 |
sys.exit(app.exec_()) |
DTI_PID/DTI_PID/Commands/SelectAttributeCommand.py | ||
---|---|---|
43 | 43 | |
44 | 44 |
try: |
45 | 45 |
if 'mouseReleaseEvent' == param[0] and event.button() == Qt.LeftButton: |
46 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
46 | 47 |
from SymbolSvgItem import SymbolSvgItem |
47 | 48 |
from EngineeringTextItem import QEngineeringTextItem |
49 |
from QEngineeringTagNoTextItem import QEngineeringTagNoTextItem |
|
48 | 50 |
from EngineeringLineItem import QEngineeringLineItem |
49 | 51 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
50 | 52 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
51 | 53 | |
52 | 54 |
if self._attr is not None: |
53 | 55 |
item = self.imageViewer.scene.itemAt(scenePos, QTransform()) |
54 |
if item is not None and self._attr.AttributeType == 'Valve Oper Code' and type(item) is QEngineeringValveOperCodeTextItem: |
|
55 |
while len(self._item._associations[self._attr.AttributeType]) <= self._attr.AttrAt: |
|
56 |
self._item._associations[self._attr.AttributeType].append(None) |
|
57 |
self._item._associations[self._attr.AttributeType][self._attr.AttrAt] = item |
|
58 |
|
|
59 |
self.onSuccess.emit() |
|
60 |
elif item is not None and self._attr.AttributeType == 'Text Item' and issubclass(type(item), QEngineeringTextItem): |
|
61 |
#self._item.removeSelfAttr(self._attr.UID) |
|
62 |
|
|
63 |
# 기존 연결되있는 다른 SymbolItem의 Attr 제거 |
|
64 |
#self._item.removeAttr(item) |
|
65 |
|
|
66 |
# _texts 검사 |
|
67 |
while len(self._item._associations[self._attr.AttributeType]) <= self._attr.AttrAt: |
|
68 |
self._item._associations[self._attr.AttributeType].append(None) |
|
69 |
self._item._associations[self._attr.AttributeType][self._attr.AttrAt] = item |
|
70 |
|
|
71 |
self.onSuccess.emit() |
|
72 |
elif item is not None and self._attr.AttributeType == 'Symbol Item' and issubclass(type(item), SymbolSvgItem): |
|
73 |
self._item.removeSelfAttr(self._attr.UID) |
|
74 |
|
|
75 |
# 기존 연결되있는 다른 SymbolItem의 Attr 제거 |
|
76 |
self._item.removeAttr(item) |
|
77 |
|
|
78 |
# _symbols 검사 |
|
79 |
while len(self._item._associations[self._attr.AttributeType]) <= self._attr.AttrAt: |
|
80 |
self._item._associations[self._attr.AttributeType].append(None) |
|
81 |
self._item._associations[self._attr.AttributeType][self._attr.AttrAt] = item |
|
82 |
|
|
83 |
self.onSuccess.emit() |
|
84 |
elif item is not None and self._attr.AttributeType == 'Line Item' and issubclass(type(item), QEngineeringLineItem): |
|
56 |
if item is not None and self._attr.AttributeType == 'Line Item' and issubclass(type(item), QEngineeringLineItem): |
|
85 | 57 |
self._item.conns.clear() |
86 | 58 |
self._item.conns.append(item) |
87 | 59 | |
... | ... | |
94 | 66 |
self._item.attrs[self._attr] = str(item.uid) |
95 | 67 | |
96 | 68 |
self.onSuccess.emit() |
69 |
elif item is not None and self._attr.AttributeType == QEngineeringAbstractItem.assoc_type(item): |
|
70 |
""" |
|
71 |
self._item.removeSelfAttr(self._attr.UID) |
|
72 |
|
|
73 |
# 기존 연결되있는 다른 SymbolItem의 Attr 제거 |
|
74 |
self._item.removeAttr(item) |
|
75 |
""" |
|
76 |
while len(self._item._associations[self._attr.AttributeType]) <= self._attr.AttrAt: |
|
77 |
self._item._associations[self._attr.AttributeType].append(None) |
|
78 |
self._item._associations[self._attr.AttributeType][self._attr.AttrAt] = item |
|
79 |
|
|
80 |
self.onSuccess.emit() |
|
97 | 81 |
except Exception as ex: |
98 | 82 |
from App import App |
99 | 83 |
from AppDocData import MessageType |
DTI_PID/DTI_PID/Scripts/EqpTagNames.sql | ||
---|---|---|
1 |
CREATE TABLE IF NOT EXISTS [EqpTagNames]( |
|
2 |
[UID] TEXT CONSTRAINT [EqpTagNames_PK] PRIMARY KEY NOT NULL, |
|
3 |
[Code] TEXT NOT NULL UNIQUE, |
|
4 |
[Description] TEXT, |
|
5 |
[Allowables] TEXT); |
|
6 | ||
7 |
CREATE UNIQUE INDEX IF NOT EXISTS [EqpTagNames_Code_IDX] ON [EqpTagNames]([Code]); |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
122 | 122 |
""" |
123 | 123 |
pass |
124 | 124 | |
125 |
def assoc_type(self, item): |
|
125 |
@staticmethod |
|
126 |
def assoc_type(item): |
|
126 | 127 |
""" |
127 | 128 |
return association type of given item |
128 | 129 |
""" |
... | ... | |
130 | 131 |
from SymbolSvgItem import SymbolSvgItem |
131 | 132 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
132 | 133 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem |
134 |
from QEngineeringTagNoTextItem import QEngineeringTagNoTextItem |
|
133 | 135 | |
134 | 136 |
_type = None |
135 | 137 | |
... | ... | |
137 | 139 |
_type = 'Size Text Item' |
138 | 140 |
elif type(item) is QEngineeringValveOperCodeTextItem: |
139 | 141 |
_type = 'Valve Oper Code' |
142 |
elif type(item) is QEngineeringTagNoTextItem: |
|
143 |
_type = 'Tag No' |
|
140 | 144 |
elif type(item) is QEngineeringTextItem or issubclass(type(item), QEngineeringTextItem): |
141 | 145 |
_type = 'Text Item' |
142 | 146 |
elif type(item) is SymbolSvgItem or issubclass(type(item), SymbolSvgItem): |
... | ... | |
154 | 158 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
155 | 159 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem |
156 | 160 | |
157 |
_type = self.assoc_type(item)
|
|
161 |
_type = QEngineeringAbstractItem.assoc_type(item)
|
|
158 | 162 |
if _type is not None: |
159 | 163 |
if not _type in self._associations: |
160 | 164 |
self._associations[_type] = [] |
DTI_PID/DTI_PID/Shapes/EngineeringEquipmentItem.py | ||
---|---|---|
1 | 1 |
# coding: utf-8 |
2 |
""" |
|
3 |
This is engineering equipment item module |
|
4 |
""" |
|
2 | 5 | |
3 | 6 |
import sys |
4 | 7 |
import os |
... | ... | |
14 | 17 |
from UserInputAttribute import UserInputAttribute |
15 | 18 | |
16 | 19 |
class QEngineeringEquipmentItem(SymbolSvgItem): |
20 |
""" |
|
21 |
This is engineering equipment item class |
|
22 |
""" |
|
23 | ||
17 | 24 |
clicked = pyqtSignal(QGraphicsSvgItem) |
18 | 25 |
ZVALUE = 10 |
19 | 26 |
EQUIP_COLUMN_LIST = None |
... | ... | |
55 | 62 |
if rect.contains(attr.center()): |
56 | 63 |
self.add_assoc_item(attr) |
57 | 64 | |
58 |
if not 'Text Item' in self._associations or not self._associations['Text Item']: |
|
65 |
# not have equipment name which is located inside equipment |
|
66 |
if not 'Tag No' in self._associations or not self._associations['Tag No']: |
|
59 | 67 |
minDist = None |
60 | 68 |
selected = None |
61 | 69 |
# get nearest text from equipment |
... | ... | |
84 | 92 |
_attrs = {} |
85 | 93 |
try: |
86 | 94 |
from AppDocData import AppDocData |
95 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
87 | 96 |
from EngineeringTextItem import QEngineeringTextItem |
88 | 97 | |
89 | 98 |
# 해당 Type의 attribute setting |
... | ... | |
93 | 102 |
_texts = self.texts() |
94 | 103 |
_symbols = self.symbols() |
95 | 104 |
for attr in symbolAttrs: |
96 |
if attr.AttributeType == 'Size Text Item' or attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code': |
|
105 |
if attr.AttributeType == 'Tag No' or attr.AttributeType == 'Size Text Item' or attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code':
|
|
97 | 106 |
at = int(attr.AttrAt) |
98 |
items = [text for text in _texts if self.assoc_type(text) == attr.AttributeType]
|
|
107 |
items = [text for text in _texts if QEngineeringAbstractItem.assoc_type(text) == attr.AttributeType]
|
|
99 | 108 |
if len(items) > at: |
100 | 109 |
item = items[at] |
101 | 110 |
_attrs[attr] = eval(attr.Expression) if attr.Expression else '' |
DTI_PID/DTI_PID/Shapes/EngineeringInstrumentItem.py | ||
---|---|---|
153 | 153 |
_attrs = {} |
154 | 154 |
try: |
155 | 155 |
from AppDocData import AppDocData |
156 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
156 | 157 |
from EngineeringTextItem import QEngineeringTextItem |
157 | 158 | |
158 | 159 |
# 해당 Type의 attribute setting |
... | ... | |
163 | 164 |
for attr in symbolAttrs: |
164 | 165 |
if attr.AttributeType == 'Size Text Item' or attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code': |
165 | 166 |
at = int(attr.AttrAt) |
166 |
items = [text for text in _texts if self.assoc_type(text) == attr.AttributeType]
|
|
167 |
items = [text for text in _texts if QEngineringAbstractItem.assoc_type(text) == attr.AttributeType]
|
|
167 | 168 |
if len(items) > at: |
168 | 169 |
item = items[at] |
169 | 170 |
_attrs[attr] = eval(attr.Expression) if attr.Expression else '' |
DTI_PID/DTI_PID/Shapes/EngineeringReducerItem.py | ||
---|---|---|
41 | 41 |
_attrs = {} |
42 | 42 |
try: |
43 | 43 |
from AppDocData import AppDocData |
44 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
44 | 45 |
from EngineeringTextItem import QEngineeringTextItem |
45 | 46 | |
46 | 47 |
# 해당 Type의 attribute setting |
... | ... | |
51 | 52 |
for attr in symbolAttrs: |
52 | 53 |
if attr.AttributeType == 'Size Text Item' or attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code': |
53 | 54 |
at = int(attr.AttrAt) |
54 |
items = [text for text in _texts if self.assoc_type(text) == attr.AttributeType]
|
|
55 |
items = [text for text in _texts if QEngineeringAbsractItem.assoc_type(text) == attr.AttributeType]
|
|
55 | 56 |
if len(items) > at: |
56 | 57 |
item = items[at] |
57 | 58 |
_attrs[attr] = eval(attr.Expression) if attr.Expression else '' |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
697 | 697 |
_attrs = {} |
698 | 698 |
try: |
699 | 699 |
from AppDocData import AppDocData |
700 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
700 | 701 |
from EngineeringTextItem import QEngineeringTextItem |
701 | 702 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
702 | 703 | |
... | ... | |
709 | 710 |
for attr in symbolAttrs: |
710 | 711 |
if attr.AttributeType == 'Size Text Item' or attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code': |
711 | 712 |
at = int(attr.AttrAt) |
712 |
items = [text for text in _texts if self.assoc_type(text) == attr.AttributeType]
|
|
713 |
items = [text for text in _texts if QEngineeringAbsractItem.assoc_type(text) == attr.AttributeType]
|
|
713 | 714 |
if len(items) > at: |
714 | 715 |
item = items[at] |
715 | 716 |
_attrs[attr] = eval(attr.Expression) if attr.Expression else '' |
... | ... | |
753 | 754 |
''' |
754 | 755 |
def toXml(self): |
755 | 756 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree |
757 |
from EngineeringAbstractItem import QEngineeringAbsractItem |
|
756 | 758 |
from EngineeringTextItem import QEngineeringTextItem |
757 | 759 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
758 | 760 |
from SymbolAttr import SymbolAttr |
... | ... | |
770 | 772 |
attributeValueNode = Element('ASSOCIATIONS') |
771 | 773 |
for assoc in self.associations(): |
772 | 774 |
assoc_node = Element('ASSOCIATION') |
773 |
assoc_node.attrib['TYPE'] = self.assoc_type(assoc)
|
|
775 |
assoc_node.attrib['TYPE'] = QEngineeringAbsractItem.assoc_type(assoc)
|
|
774 | 776 |
assoc_node.text = str(assoc.uid) |
775 | 777 |
attributeValueNode.append(assoc_node) |
776 | 778 |
node.append(attributeValueNode) |
DTI_PID/DTI_PID/SymbolAttr.py | ||
---|---|---|
21 | 21 |
""" |
22 | 22 |
return if attribute is selectable |
23 | 23 |
""" |
24 |
return (self.AttributeType == 'Size Text Item' or self.AttributeType == 'Text Item' or self.AttributeType == 'Valve Oper Code' or self.AttributeType == 'Symbol Item') |
|
24 |
from SymbolAttrEditorDialog import QSymbolAttrEditorDialog |
|
25 | ||
26 |
return (self.AttributeType in [key for key,value in QSymbolAttrEditorDialog.SYMBOL_ATTR_DATA_TYPES.items() if value == -1]) |
|
25 | 27 | |
26 | 28 |
@staticmethod |
27 | 29 |
def fromXml(node): |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
20 | 20 |
""" |
21 | 21 |
This is symbol attribute editor dialog class |
22 | 22 |
""" |
23 |
|
|
24 |
SYMBOL_ATTR_DATA_TYPES = {'Symbol Item':-1, 'Text Item':-1, 'Tag No':-1, 'Valve Oper Code':-1, 'Comp Item':-1, 'Int':1, 'String':1} |
|
23 | 25 | |
24 | 26 |
def __init__(self, parent, symbolType = None): |
25 | 27 |
QDialog.__init__(self, parent) |
... | ... | |
119 | 121 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
120 | 122 | |
121 | 123 |
attrTypeComboBox = QComboBox() |
122 |
attrTypeComboBox.addItem('Symbol Item') |
|
123 |
attrTypeComboBox.addItem('Text Item') |
|
124 |
attrTypeComboBox.addItem('Valve Oper Code') |
|
125 |
attrTypeComboBox.addItem('Comp Item') |
|
126 |
attrTypeComboBox.addItem('Int') |
|
127 |
attrTypeComboBox.addItem('String') |
|
124 |
for key,value in QSymbolAttrEditorDialog.SYMBOL_ATTR_DATA_TYPES.items(): |
|
125 |
attrTypeComboBox.addItem(key) |
|
126 | ||
128 | 127 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox) |
129 | 128 |
result = attrTypeComboBox.findText(attr.AttributeType) # Type |
130 | 129 |
attrTypeComboBox.setCurrentIndex(result) |
... | ... | |
173 | 172 |
self.ui.tableWidgetAttr.setRowCount(rows + 1) |
174 | 173 | |
175 | 174 |
attrTypeComboBox = QComboBox() |
176 |
attrTypeComboBox.addItem('Symbol Item') |
|
177 |
attrTypeComboBox.addItem('Text Item') |
|
178 |
attrTypeComboBox.addItem('Valve Oper Code') |
|
179 |
attrTypeComboBox.addItem('Comp Item') |
|
180 |
attrTypeComboBox.addItem('Int') |
|
181 |
attrTypeComboBox.addItem('String') |
|
175 |
for key,value in QSymbolAttrEditorDialog.SYMBOL_ATTR_DATA_TYPES.items(): |
|
176 |
attrTypeComboBox.addItem(key) |
|
177 | ||
182 | 178 |
self.ui.tableWidgetAttr.setCellWidget(rows, 3, attrTypeComboBox) |
183 | 179 | |
184 | 180 |
import uuid |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
299 | 299 |
@date 2018.05.03 |
300 | 300 |
''' |
301 | 301 |
def isTagNoText(self, text): |
302 |
docData = AppDocData.instance() |
|
303 |
dataList = docData.getEquipmentDataList() |
|
304 |
matches = [data for data in dataList if data['ITEM_NO'] == text] |
|
305 |
return (len(matches) > 0) |
|
302 |
from CodeTables import CodeTable |
|
303 | ||
304 |
found = CodeTable.instance('EqpTagNames').find(text) |
|
305 | ||
306 |
return True if found else False |
|
306 | 307 | |
307 | 308 |
def is_valve_operation_code(self, text): |
308 | 309 |
""" |
DTI_PID/DTI_PID/UI/CodeTable.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>836</width>
|
|
9 |
<width>910</width>
|
|
10 | 10 |
<height>589</height> |
11 | 11 |
</rect> |
12 | 12 |
</property> |
... | ... | |
268 | 268 |
</item> |
269 | 269 |
</layout> |
270 | 270 |
</widget> |
271 |
<widget class="QWidget" name="tab_2"> |
|
272 |
<attribute name="title"> |
|
273 |
<string>Eqp Tag Names</string> |
|
274 |
</attribute> |
|
275 |
<layout class="QGridLayout" name="gridLayout_22"> |
|
276 |
<item row="0" column="0"> |
|
277 |
<widget class="QGroupBox" name="groupBox_8"> |
|
278 |
<property name="title"> |
|
279 |
<string>Tag Names</string> |
|
280 |
</property> |
|
281 |
<layout class="QGridLayout" name="gridLayout_21"> |
|
282 |
<item row="0" column="0"> |
|
283 |
<widget class="QTableWidget" name="tableWidgetEqpTagNames"> |
|
284 |
<property name="columnCount"> |
|
285 |
<number>3</number> |
|
286 |
</property> |
|
287 |
<attribute name="verticalHeaderVisible"> |
|
288 |
<bool>false</bool> |
|
289 |
</attribute> |
|
290 |
<column/> |
|
291 |
<column/> |
|
292 |
<column/> |
|
293 |
</widget> |
|
294 |
</item> |
|
295 |
</layout> |
|
296 |
</widget> |
|
297 |
</item> |
|
298 |
</layout> |
|
299 |
</widget> |
|
271 | 300 |
</widget> |
272 | 301 |
</item> |
273 | 302 |
</layout> |
내보내기 Unified diff