개정판 dd3553d3
issue #587: change line property type
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
725 | 725 |
@date 2018.04.09 |
726 | 726 |
''' |
727 | 727 |
def getLineProperties(self): |
728 |
from SymbolAttr import SymbolAttr |
|
729 | ||
728 | 730 |
res = [] |
729 | 731 |
try: |
730 | 732 |
# Creates or opens a file called mydb with a SQLite3 DB |
... | ... | |
737 | 739 |
cursor.execute(sql) |
738 | 740 |
rows = cursor.fetchall() |
739 | 741 |
for row in rows: |
740 |
res.append((row[0], row[1], row[2], row[3], row[4], row[5])) |
|
742 |
attr = SymbolAttr() |
|
743 |
attr.UID = row[0] |
|
744 |
attr.Attribute = row[1] |
|
745 |
attr.DisplayAttribute = row[2] |
|
746 |
attr.AttributeType = row[3] |
|
747 |
attr.Length = row[4] |
|
748 |
res.append(attr) |
|
741 | 749 |
# Catch the exception |
742 | 750 |
except Exception as ex: |
743 | 751 |
# Roll back any change if something goes wrong |
... | ... | |
755 | 763 |
@date 2018.04.09 |
756 | 764 |
''' |
757 | 765 |
def getLinePropertiesByUID(self, UID): |
766 |
from SymbolAttr import SymbolAttr |
|
767 | ||
758 | 768 |
res = [] |
759 | 769 |
try: |
760 | 770 |
# Creates or opens a file called mydb with a SQLite3 DB |
... | ... | |
767 | 777 |
cursor.execute(sql) |
768 | 778 |
rows = cursor.fetchall() |
769 | 779 |
for row in rows: |
770 |
res.append((row[0], row[1], row[2], row[3], row[4], row[5])) |
|
780 |
attr = SymbolAttr() |
|
781 |
attr.UID = row[0] |
|
782 |
attr.Attribute = row[1] |
|
783 |
attr.DisplayAttribute = row[2] |
|
784 |
attr.AttributeType = row[3] |
|
785 |
attr.Length = row[4] |
|
786 |
res.append(attr) |
|
771 | 787 |
# Catch the exception |
772 | 788 |
except Exception as ex: |
773 | 789 |
# Roll back any change if something goes wrong |
... | ... | |
1591 | 1607 |
@history humkyung 2018.10.13 load expression |
1592 | 1608 |
''' |
1593 | 1609 |
def getSymbolAttributeByUID(self, UID): |
1610 |
from SymbolAttr import SymbolAttr |
|
1611 | ||
1594 | 1612 |
res = None |
1595 | 1613 | |
1596 | 1614 |
try: |
DTI_PID/DTI_PID/ConfigurationDialog.py | ||
---|---|---|
95 | 95 | |
96 | 96 |
properties = docData.getLineProperties() |
97 | 97 |
for prop in properties: |
98 |
self.lineNoAttributeUID.append(prop[0])
|
|
99 |
self.ui.comboBoxProperties.addItem(prop[2])
|
|
100 |
if prop[3] == "Code Table":
|
|
101 |
self.tempLineColorUID.append(prop[0])
|
|
102 |
self.ui.comboBoxColorOption.addItem(prop[2])
|
|
98 |
self.lineNoAttributeUID.append(prop.UID)
|
|
99 |
self.ui.comboBoxProperties.addItem(prop.DisplayAttribute)
|
|
100 |
if prop.AttributeType == "Code Table":
|
|
101 |
self.tempLineColorUID.append(prop.Attribute)
|
|
102 |
self.ui.comboBoxColorOption.addItem(prop.DisplayAttribute)
|
|
103 | 103 | |
104 | 104 |
configs = docData.getConfigs('Line No', 'Configuration') |
105 | 105 |
if len(configs) == 1 and configs[0].value is not None: |
... | ... | |
107 | 107 |
#for value in configs[0].value.split(self.ui.lineEdit.text()): |
108 | 108 |
lineProp = docData.getLinePropertiesByUID(value) |
109 | 109 |
if lineProp: |
110 |
self.itemModel.appendRow(QStandardItem(lineProp[0][2]))
|
|
110 |
self.itemModel.appendRow(QStandardItem(lineProp[0].DisplayAttribute))
|
|
111 | 111 |
else: |
112 | 112 |
self.itemModel.appendRow(QStandardItem(value)) |
113 | 113 |
self.tempLineNoAttributeUID.append(value) |
... | ... | |
194 | 194 |
configs = docData.getConfigs('Color Property', 'State') |
195 | 195 |
uid = configs[0].value |
196 | 196 |
lineProp = docData.getLinePropertiesByUID(uid) |
197 |
selectedOption = lineProp[0][2] if lineProp and self.ui.comboBoxColorOption.findText(lineProp[0][2]) >= 0 else ''
|
|
197 |
selectedOption = lineProp[0].DisplayAttribute if lineProp and self.ui.comboBoxColorOption.findText(lineProp[0].DisplayAttribute) >= 0 else ''
|
|
198 | 198 |
self.ui.tableWidgetColorProperty.setHorizontalHeaderLabels(['Value', 'Color', 'ref', 'colorStr']) |
199 | 199 |
|
200 | 200 |
index = self.ui.comboBoxColorOption.findText(selectedOption) |
... | ... | |
254 | 254 | |
255 | 255 |
lineProp = docData.getLinePropertiesByUID(property) |
256 | 256 |
if lineProp: |
257 |
tableName = lineProp[0][1]
|
|
257 |
tableName = lineProp[0].Attribute
|
|
258 | 258 |
else: |
259 | 259 |
return |
260 | 260 | |
... | ... | |
354 | 354 |
lineProp = docData.getLinePropertiesByUID(uid) |
355 | 355 |
|
356 | 356 |
# 기본 테이블 셋팅 |
357 |
self.settingDefaultColorTable(lineProp[0][0])
|
|
357 |
self.settingDefaultColorTable(lineProp[0].UID)
|
|
358 | 358 |
# 설정된 색상 가져옴 |
359 |
self.settingColorStringCell(lineProp[0][0])
|
|
359 |
self.settingColorStringCell(lineProp[0].UID)
|
|
360 | 360 |
#Table Color Setting |
361 | 361 |
self.settingColorCell() |
362 | 362 | |
363 | ||
364 | 363 |
''' |
365 | 364 |
@brief Cell Double Click Event |
366 | 365 |
@author kyouho |
... | ... | |
427 | 426 |
lineProp = docData.getLinePropertiesByUID(uid) |
428 | 427 | |
429 | 428 |
# 기본 테이블 셋팅 |
430 |
self.settingDefaultColorTable(lineProp[0][0])
|
|
429 |
self.settingDefaultColorTable(lineProp[0].UID)
|
|
431 | 430 |
# 설정된 색상 가져옴 |
432 |
self.settingColorStringCell(lineProp[0][0])
|
|
431 |
self.settingColorStringCell(lineProp[0].UID)
|
|
433 | 432 |
#Table Color Setting |
434 | 433 |
self.settingColorCell() |
435 | 434 |
else: |
... | ... | |
492 | 491 |
lineProp = docData.getLinePropertiesByUID(uid) |
493 | 492 | |
494 | 493 |
configs.append(Config('Line Color', 'Visible Option', 'Random' if rbRandomValue else 'Property')) |
495 |
configs.append(Config('Color Property', 'State', lineProp[0][0]))
|
|
494 |
configs.append(Config('Color Property', 'State', lineProp[0].UID))
|
|
496 | 495 | |
497 | 496 |
for row in range(self.ui.tableWidgetLineTypes.rowCount()): |
498 | 497 |
lineType = self.ui.tableWidgetLineTypes.item(row, 0).text() |
... | ... | |
507 | 506 |
refStr = table.item(i, 2).text() |
508 | 507 |
colorStr = table.item(i, 3).text() |
509 | 508 |
if colorStr: |
510 |
configs.append(Config(lineProp[0][0], refStr, colorStr))
|
|
509 |
configs.append(Config(lineProp[0].UID, refStr, colorStr))
|
|
511 | 510 | |
512 | 511 |
#Configuration |
513 | 512 |
configuration = None |
DTI_PID/DTI_PID/ItemDataExportDialog.py | ||
---|---|---|
107 | 107 |
docData = AppDocData.instance() |
108 | 108 |
lineProps = docData.getLineProperties() |
109 | 109 |
for prop in lineProps: |
110 |
if prop[3] == 'Code Table':
|
|
111 |
tableName = prop[1].upper().replace(' ','')
|
|
110 |
if prop.AttributeType == 'Code Table':
|
|
111 |
tableName = prop.Attribute.upper().replace(' ','')
|
|
112 | 112 |
if tableName == 'NOMINALDIAMETER': |
113 | 113 |
self.nominalDiameterList = docData.getCodeTable(tableName, True) |
114 | 114 |
elif tableName == 'FLUIDCODE': |
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
50 | 50 |
self.stringCell = [] |
51 | 51 | |
52 | 52 |
self.cellChanged.connect(self.cellChangedEvent) |
53 | ||
53 | 54 |
''' |
54 | 55 |
@brief show item's property |
55 | 56 |
@author humkyung |
... | ... | |
266 | 267 |
humkyung 2018.07.05 display connectivity |
267 | 268 |
''' |
268 | 269 |
def initContentsCell(self): |
269 |
from EngineeringInstrumentItem import QEngineeringInstrumentItem |
|
270 |
|
|
271 | 270 |
self.attrValueList = [] |
272 | 271 |
self.intCell = [] |
273 | 272 |
self.stringCell = [] |
274 | 273 | |
275 |
if self.symData is not None: |
|
276 |
docData = AppDocData.instance() |
|
277 | ||
278 |
self.setItem(0, 1, QTableWidgetItem(str(self.symData.uid))) |
|
279 |
self.setItem(1, 1, QTableWidgetItem(self.symData.name)) |
|
280 |
self.setItem(2, 1, QTableWidgetItem(self.symData.type)) |
|
281 |
self.setItem(3, 1, QTableWidgetItem(str(round(math.degrees(self.symData.angle))))) |
|
282 |
self.setItem(4, 1, QTableWidgetItem(str(self.symData.origin))) |
|
283 |
self.setItem(5, 1, QTableWidgetItem('{}'.format(self.symData.owner))) |
|
284 | ||
285 |
row = self.rowCount() |
|
286 |
attrs = self.symData.getAttributes() |
|
287 |
self.setRowCount(row + len(attrs) + len(self.symData.connectors)) |
|
288 |
# display attributes of symbol |
|
289 |
if attrs is not None: |
|
290 |
for key in attrs.keys(): |
|
291 |
value = attrs[key] |
|
292 |
keyItem = QTableWidgetItem(key.Attribute) |
|
293 |
keyItem.setBackground(QColor(220, 220, 220)) |
|
294 |
keyItem.tag = key |
|
295 |
valueItem = QTableWidgetItem(str(value)) |
|
296 |
if key.AttributeType == 'Text Item' or key.AttributeType == 'Symbol Item': |
|
297 |
from PyQt5 import QtGui |
|
298 |
icon = QtGui.QIcon() |
|
299 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
300 |
valueItem.setIcon(icon) |
|
301 |
elif key.AttributeType == 'Int': |
|
302 |
self.intCell.append(valueItem) |
|
303 |
elif key.AttributeType == 'String': |
|
304 |
self.stringCell.append(valueItem) |
|
305 | ||
306 |
if key.AttributeType == 'Text Item': |
|
307 |
textItem = self.findTextItemFromUID(value) |
|
308 |
if textItem is not None: |
|
309 |
valueItem.setText(textItem.text()) |
|
310 |
self.attrValueList.append((valueItem, key)) |
|
311 |
keyText = docData.getSymbolAttributeByUID(key.UID) |
|
312 |
if keyText is not None: |
|
313 |
keyItem.setText(keyText[1]) |
|
274 |
try: |
|
275 |
if self.symData is not None: |
|
276 |
docData = AppDocData.instance() |
|
277 | ||
278 |
self.setItem(0, 1, QTableWidgetItem(str(self.symData.uid))) |
|
279 |
self.setItem(1, 1, QTableWidgetItem(self.symData.name)) |
|
280 |
self.setItem(2, 1, QTableWidgetItem(self.symData.type)) |
|
281 |
self.setItem(3, 1, QTableWidgetItem(str(round(math.degrees(self.symData.angle))))) |
|
282 |
self.setItem(4, 1, QTableWidgetItem(str(self.symData.origin))) |
|
283 |
self.setItem(5, 1, QTableWidgetItem('{}'.format(self.symData.owner))) |
|
284 | ||
285 |
row = self.rowCount() |
|
286 |
attrs = self.symData.getAttributes() |
|
287 |
self.setRowCount(row + len(attrs) + len(self.symData.connectors)) |
|
288 |
# display attributes of symbol |
|
289 |
if attrs is not None: |
|
290 |
for key in attrs.keys(): |
|
291 |
value = attrs[key] |
|
292 |
keyItem = QTableWidgetItem(key.Attribute) |
|
293 |
keyItem.setBackground(QColor(220, 220, 220)) |
|
294 |
keyItem.tag = key |
|
295 |
valueItem = QTableWidgetItem(str(value)) |
|
296 |
if key.AttributeType == 'Text Item' or key.AttributeType == 'Symbol Item': |
|
297 |
from PyQt5 import QtGui |
|
298 |
icon = QtGui.QIcon() |
|
299 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/doubleclick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
300 |
valueItem.setIcon(icon) |
|
301 |
elif key.AttributeType == 'Int': |
|
302 |
self.intCell.append(valueItem) |
|
303 |
elif key.AttributeType == 'String': |
|
304 |
self.stringCell.append(valueItem) |
|
305 | ||
306 |
if key.AttributeType == 'Text Item': |
|
307 |
textItem = self.findTextItemFromUID(value) |
|
308 |
if textItem is not None: |
|
309 |
valueItem.setText(textItem.text()) |
|
310 |
self.attrValueList.append((valueItem, key)) |
|
311 | ||
312 |
if key.DisplayAttribute is not None: |
|
313 |
keyItem.setText(key.DisplayAttribute) |
|
314 | 314 |
self.setItem(row, 0, keyItem) |
315 | 315 | |
316 |
if type(self.symData) is QEngineeringSpecBreakItem and (key == 'Up Stream' or key == 'Down Stream'): |
|
317 |
comboBox = QComboBox() |
|
318 |
comboBox.addItem('') |
|
316 |
if type(self.symData) is QEngineeringSpecBreakItem and (key == 'Up Stream' or key == 'Down Stream'): |
|
317 |
comboBox = QComboBox() |
|
318 |
comboBox.addItem('') |
|
319 | ||
320 |
itemList = self.mainWindow.findOverlapConnector(self.symData.connectors[0]) |
|
321 |
for item in itemList: |
|
322 |
comboBox.addItem(str(item.uid)) |
|
323 | ||
324 |
if key == 'Up Stream': |
|
325 |
comboBox.currentTextChanged.connect(self.upStreamChanged) |
|
326 |
else: |
|
327 |
comboBox.currentTextChanged.connect(self.downStreamChanged) |
|
319 | 328 | |
320 |
itemList = self.mainWindow.findOverlapConnector(self.symData.connectors[0]) |
|
321 |
for item in itemList: |
|
322 |
comboBox.addItem(str(item.uid)) |
|
329 |
tempIndex = comboBox.findText(value) if comboBox.findText(value) != -1 else 0 |
|
330 |
comboBox.setCurrentIndex(tempIndex) |
|
323 | 331 | |
324 |
if key == 'Up Stream': |
|
325 |
comboBox.currentTextChanged.connect(self.upStreamChanged) |
|
332 |
self.setCellWidget(row, 1, comboBox) |
|
326 | 333 |
else: |
327 |
comboBox.currentTextChanged.connect(self.downStreamChanged)
|
|
334 |
self.setItem(row, 1, valueItem)
|
|
328 | 335 | |
329 |
tempIndex = comboBox.findText(value) if comboBox.findText(value) != -1 else 0
|
|
330 |
comboBox.setCurrentIndex(tempIndex)
|
|
336 |
row = row + 1
|
|
337 |
# up to here
|
|
331 | 338 | |
332 |
self.setCellWidget(row, 1, comboBox) |
|
333 |
else: |
|
334 |
self.setItem(row, 1, valueItem) |
|
339 |
# display connectivity |
|
340 |
count = 1 |
|
341 |
for connector in self.symData.connectors: |
|
342 |
item = QTableWidgetItem('CONN{}'.format(count)) |
|
343 |
item.setFlags(Qt.ItemIsEnabled) |
|
344 |
item.setBackground(QColor(220, 220, 220)) |
|
345 |
self.setItem(row, 0, item) |
|
335 | 346 | |
347 |
item = QTableWidgetItem('{}'.format('None' if connector.connectedItem is None else str(connector.connectedItem.uid))) |
|
348 |
item.setFlags(Qt.ItemIsEnabled) |
|
349 |
self.setItem(row, 1, item) |
|
336 | 350 |
row = row + 1 |
337 |
# up to here |
|
338 | ||
339 |
# display connectivity |
|
340 |
count = 1 |
|
341 |
for connector in self.symData.connectors: |
|
342 |
item = QTableWidgetItem('CONN{}'.format(count)) |
|
343 |
item.setFlags(Qt.ItemIsEnabled) |
|
344 |
item.setBackground(QColor(220, 220, 220)) |
|
345 |
self.setItem(row, 0, item) |
|
351 |
count = count + 1 |
|
352 |
# up to here |
|
353 |
else: |
|
354 |
self.setRowCount(0) |
|
355 |
except Exception as ex: |
|
356 |
from App import App |
|
346 | 357 | |
347 |
item = QTableWidgetItem('{}'.format('None' if connector.connectedItem is None else str(connector.connectedItem.uid))) |
|
348 |
item.setFlags(Qt.ItemIsEnabled) |
|
349 |
self.setItem(row, 1, item) |
|
350 |
row = row + 1 |
|
351 |
count = count + 1 |
|
352 |
# up to here |
|
353 |
else: |
|
354 |
self.setRowCount(0) |
|
358 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
359 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
355 | 360 | |
356 | 361 |
''' |
357 | 362 |
@brief combobox change event |
... | ... | |
450 | 455 |
# UID로 확인 |
451 | 456 |
if keyStr: |
452 | 457 |
# editable value cell |
453 |
if keyStr[0][3] == 'String':
|
|
458 |
if keyStr[0].AttributeType == 'String':
|
|
454 | 459 |
self.attrValueList.append((valueCell, key)) |
455 | 460 |
self.stringCell.append(valueCell) |
456 |
key = keyStr[0][2]
|
|
461 |
key = keyStr[0].DisplayAttribute
|
|
457 | 462 |
|
458 | 463 |
item = QTableWidgetItem(key) |
459 | 464 |
item.setFlags(Qt.ItemIsEnabled) |
... | ... | |
552 | 557 |
items[0].attrs.append(newAttr) |
553 | 558 |
# line no 경우 |
554 | 559 |
else: |
555 |
for attr in items[0]._attrs:
|
|
560 |
for attr in items[0].attrs: |
|
556 | 561 |
if type(attr) is UserInputAttribute and attr.attribute == typeUID: |
557 | 562 |
attr.text = str |
558 | 563 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1430 | 1430 |
newAttr = UserInputAttribute(userInputAttr.find('TYPEUID').text, userInputAttr.find('TYPEVALUE').text) |
1431 | 1431 |
item.attrs.append(newAttr) |
1432 | 1432 |
for attr in lineNo.iter('ATTRIBUTE'): |
1433 |
item._attrs.append((attr.find('NAME').text, attr.find('VALUE').text))
|
|
1433 |
item.attrs[docData.getLinePropertiesByUID(attr.find('UID').text)[0]] = attr.find('VALUE').text
|
|
1434 | 1434 | |
1435 | 1435 |
connLine = lineNo.find('CONNLINE') |
1436 | 1436 |
if connLine is not None: |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
96 | 96 |
configs = lineNoconfigs[0].value.split(self.delimiter) |
97 | 97 |
lineAttrs = docData.getLineProperties() |
98 | 98 |
for lineAttr in lineAttrs: |
99 |
if lineAttr[3] == 'String':
|
|
99 |
if lineAttr.AttributeType == 'String':
|
|
100 | 100 |
find = False |
101 | 101 |
for attr in self.attrs: |
102 |
if type(attr) is UserInputAttribute and attr.attribute == lineAttr[0]:
|
|
102 |
if type(attr) is UserInputAttribute and attr.attribute == lineAttr.UID:
|
|
103 | 103 |
find = True |
104 |
break;
|
|
104 |
break |
|
105 | 105 |
if not find: |
106 |
newAttr = UserInputAttribute(lineAttr[0], '')
|
|
107 |
self._attrs.append(newAttr)
|
|
106 |
newAttr = UserInputAttribute(lineAttr.UID, '')
|
|
107 |
self.attrs[lineAttr] = ''
|
|
108 | 108 | |
109 |
attrs[lineAttr[0]] = ''
|
|
109 |
attrs[lineAttr.UID] = ''
|
|
110 | 110 |
else: |
111 | 111 |
for i in range(len(configs)): |
112 |
if lineAttr[0] == configs[i]:
|
|
113 |
attrs[lineAttr[0]] = result[i]
|
|
112 |
if lineAttr.UID == configs[i]:
|
|
113 |
attrs[lineAttr.UID] = result[i]
|
|
114 | 114 |
break |
115 | 115 | |
116 |
for attr in self._attrs:
|
|
116 |
for attr in self.attrs: |
|
117 | 117 |
if type(attr) is UserInputAttribute: |
118 | 118 |
attrs[attr.attribute] = attr.text |
119 | 119 | |
120 | 120 |
attrs['CONN'] = self.conns[0].uid if self.conns else '' |
121 | 121 |
except Exception as ex: |
122 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
122 |
from App import App |
|
123 |
from AppDocData import MessageType |
|
124 | ||
125 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
126 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
123 | 127 |
|
124 | 128 |
return attrs |
125 | 129 | |
... | ... | |
174 | 178 |
for run in self.runs: |
175 | 179 |
node.append(run.toXml()) |
176 | 180 | |
177 |
for attr in self._attrs:
|
|
178 |
if type(attr) is not UserInputAttribute:
|
|
181 |
for key in self.attrs.keys():
|
|
182 |
if type(key) is not UserInputAttribute:
|
|
179 | 183 |
attrNode = Element('ATTRIBUTE') |
180 | 184 | |
181 | 185 |
uidNode = Element('UID') |
182 |
uidNode.text = str(self.uid)
|
|
186 |
uidNode.text = str(key.UID)
|
|
183 | 187 |
attrNode.append(uidNode) |
184 | 188 | |
185 | 189 |
nameNode = Element('NAME') |
186 |
nameNode.text = str(attr[0])
|
|
190 |
nameNode.text = str(key.Attribute)
|
|
187 | 191 |
attrNode.append(nameNode) |
188 | 192 | |
189 | 193 |
valueNode = Element('VALUE') |
190 |
valueNode.text = str(attr[1])
|
|
194 |
valueNode.text = str(self.attrs[key])
|
|
191 | 195 |
attrNode.append(valueNode) |
192 | 196 | |
193 | 197 |
node.append(attrNode) |
194 | 198 |
else: |
195 |
node.append(attr.toXml())
|
|
199 |
node.append(key.toXml())
|
|
196 | 200 |
|
197 | 201 |
if self.conns: |
198 | 202 |
connNode = Element('CONNLINE') |
... | ... | |
200 | 204 |
node.append(connNode) |
201 | 205 | |
202 | 206 |
except Exception as ex: |
207 |
from App import App |
|
208 |
from AppDocData import MessageType |
|
209 | ||
210 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
211 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
212 | ||
203 | 213 |
return str(self.uid) |
204 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
205 | 214 | |
206 | 215 |
return node |
207 | 216 | |
... | ... | |
268 | 277 |
if type(attr) is not UserInputAttribute: |
269 | 278 |
lineProp = docData.getLinePropertiesByUID(attr[0]) |
270 | 279 |
if lineProp: |
271 |
attrName = lineProp[0][1].upper().replace(' ','')
|
|
280 |
attrName = lineProp[0].attribute.upper().replace(' ','')
|
|
272 | 281 |
else: |
273 |
attrName = attr[0].upper().replace(' ','')
|
|
274 |
data = attr[1] if attr[1] is not None else ''
|
|
282 |
attrName = attr.UID.upper().replace(' ','')
|
|
283 |
data = attr.Attribute if attr.Attribute is not None else ''
|
|
275 | 284 |
if attrName == 'NOMINALDIAMETER': |
276 | 285 |
dataList[1] = data |
277 | 286 |
elif attrName == 'FLUIDCODE': |
... | ... | |
292 | 301 |
elif attrName == '': |
293 | 302 |
pass |
294 | 303 |
else: |
295 |
typeUID = attr.attribute
|
|
304 |
typeUID = attr.Attribute
|
|
296 | 305 |
value = attr.text |
297 | 306 |
lineAttr = docData.getLinePropertiesByUID(typeUID) |
298 | 307 | |
299 | 308 |
for index in range(len(lineColumnList)): |
300 |
if lineColumnList[index] == lineAttr[0][1]:
|
|
309 |
if lineColumnList[index] == lineAttr[0].Attribute:
|
|
301 | 310 |
dataList[index] = value |
302 | 311 |
except Exception as ex: |
303 | 312 |
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/SymbolAttr.py | ||
---|---|---|
4 | 4 |
""" |
5 | 5 | |
6 | 6 |
class SymbolAttr: |
7 |
""" |
|
8 |
This is symbol attribute class |
|
9 |
""" |
|
7 | 10 |
def __init__(self): |
8 | 11 |
self.UID = None |
9 | 12 |
self.Attribute = None |
10 | 13 |
self.DisplayAttribute = None |
11 | 14 |
self.AttributeType = None |
12 | 15 |
self.AttrAt = None |
13 |
self.Expression = None |
|
16 |
self.Expression = None |
|
17 |
self.Length = None |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
225 | 225 | |
226 | 226 |
row = 0 |
227 | 227 |
for attr in attrs: |
228 |
item = QTableWidgetItem(attr[0] if attr[0] is not None else '')
|
|
228 |
item = QTableWidgetItem(attr.UID if attr.UID is not None else '')
|
|
229 | 229 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
230 |
item = QTableWidgetItem(attr[1] if attr[1] is not None else '')
|
|
230 |
item = QTableWidgetItem(attr.Attribute if attr.Attribute is not None else '')
|
|
231 | 231 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
232 |
item = QTableWidgetItem(attr[2] if attr[2] is not None else '')
|
|
232 |
item = QTableWidgetItem(attr.DisplayAttribute if attr.DisplayAttribute is not None else '')
|
|
233 | 233 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
234 | 234 | |
235 | 235 |
attrTypeComboBox = QComboBox() |
... | ... | |
237 | 237 |
attrTypeComboBox.addItem('Int') |
238 | 238 |
attrTypeComboBox.addItem('String') |
239 | 239 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox) |
240 |
result = attrTypeComboBox.findText(attr[3] if attr[2] is not None else '')
|
|
240 |
result = attrTypeComboBox.findText(attr.AttributeType if attr.DisplayAttribute is not None else '')
|
|
241 | 241 |
attrTypeComboBox.setCurrentIndex(result) |
242 |
|
|
243 | 242 | |
244 |
item = QTableWidgetItem(str(attr[4]) if attr[4] is not None else '')
|
|
243 |
item = QTableWidgetItem(str(attr.Length) if attr.Length is not None else '')
|
|
245 | 244 |
self.ui.tableWidgetAttr.setItem(row, 4, item) |
246 | 245 | |
247 | 246 |
row = row + 1 |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
149 | 149 |
lineProp = docData.getLinePropertiesByUID(propertyName) |
150 | 150 |
# Line property인 경우 |
151 | 151 |
if lineProp: |
152 |
lineType = lineProp[0][3]
|
|
152 |
lineType = lineProp[0].AttributeType
|
|
153 | 153 |
if lineType == 'Code Table': |
154 |
tableName = lineProp[0][1]
|
|
154 |
tableName = lineProp[0].Attribute
|
|
155 | 155 |
loopList = docData.getCodeTable(tableName, True) |
156 | 156 |
isStartWord = True |
157 | 157 | |
158 | 158 |
elif lineType == 'Int': |
159 |
length = lineProp[0][4]
|
|
159 |
length = lineProp[0].Length
|
|
160 | 160 |
loopList.append((length, True)) |
161 | 161 | |
162 | 162 |
elif lineType == 'String': |
163 |
length = lineProp[0][4]
|
|
163 |
length = lineProp[0].Length
|
|
164 | 164 |
loopList.append((length, False)) |
165 | 165 | |
166 | 166 |
# 못찾은 경우 (ex. delimiter) |
내보내기 Unified diff