개정판 cf24199a
issue #1465: test
Change-Id: I33ea943ac795f5e982870ffa7150858b263ce9fa
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
2727 | 2727 |
f"{sys.exc_info()[-1].tb_lineno}" |
2728 | 2728 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
2729 | 2729 |
|
2730 |
def get_stream_line_list_data(drawing_names=None): |
|
2730 |
def get_stream_line_list_data(self, drawing_names=None):
|
|
2731 | 2731 |
""" get stream line list data from """ |
2732 | 2732 |
with self.project.database.connect() as conn: |
2733 | 2733 |
try: |
... | ... | |
2740 | 2740 |
doc_names = "','".join(drawing_names) |
2741 | 2741 |
|
2742 | 2742 |
sql = f"select S.PnIDNumber, S.Tag_Seq_No, S.PipingMaterialsClass, S.InsulationPurpose, S.FluidCode, " \ |
2743 |
f"S.UnitNumber, S.NominalDiameter, S.[From], S.[To], S.Stream_No, S.[Index], D.Name from Stream_Line_List S" \ |
|
2743 |
f"S.UnitNumber, S.NominalDiameter, S.[From], S.[To], S.Stream_No, S.[Index], D.Name from Stream_Line_List S " \
|
|
2744 | 2744 |
f"join Drawings D on S.Drawing_UID=D.UID " \ |
2745 | 2745 |
f"where S.Drawing_UID in (select UID from Drawings where Name in ('{doc_names}'))" |
2746 | 2746 |
sql = self.project.database.to_sql(sql) |
... | ... | |
2761 | 2761 |
data['TO'] = row['To'] |
2762 | 2762 |
data['Stream No'] = row['Stream_No'] |
2763 | 2763 |
data['index'] = row['Index'] |
2764 |
data['Name'] = row['Name'] |
|
2764 |
data['Drawing Name'] = row['Name']
|
|
2765 | 2765 |
|
2766 | 2766 |
datas.append(data) |
2767 | 2767 |
|
... | ... | |
3901 | 3901 |
@author kyouho |
3902 | 3902 |
@date 2018.08.14 |
3903 | 3903 |
''' |
3904 |
|
|
3905 | 3904 |
def get_instrument_data_list(self, drawings=None): |
3906 | 3905 |
result = [] |
3907 | 3906 |
conn = self.project.database.connect() |
DTI_PID/DTI_PID/ItemDataExportDialog.py | ||
---|---|---|
340 | 340 |
|
341 | 341 |
app_doc_data = AppDocData.instance() |
342 | 342 |
special_item_types = SpecialItemTypes.instance() |
343 |
self.lineColumnListAll = ['UID', 'Drawing Name'] |
|
343 |
self.lineColumnListAll = ['UID', 'Drawing Name', 'Stream No', 'FROM', 'TO']
|
|
344 | 344 |
self.lineColumnListAll.extend([prop.Attribute for prop in app_doc_data.getLineProperties()]) |
345 | 345 |
self.lineColumnListAll = self.add_hmb_header(self.lineColumnListAll) |
346 | 346 |
self.equipColumnListAll = ['UID', 'ITEM_NO'] |
... | ... | |
560 | 560 |
|
561 | 561 |
return dataList_backup |
562 | 562 |
|
563 |
def set_line_list_data(self): |
|
564 |
pass
|
|
563 |
def set_line_list_data(self, hmb_datas=None):
|
|
564 |
""" set line data from stream line list """
|
|
565 | 565 |
|
566 |
lineTable = self.ui.tableWidgetLineDataList |
|
567 |
app_doc_data = AppDocData.instance() |
|
568 |
# 기존 저장된 데이터 불러옴 |
|
569 |
drawings = self.checked_drawings |
|
570 |
|
|
571 |
dataList = app_doc_data.get_stream_line_list_data(drawings if drawings else None) |
|
572 |
dataList = self.add_hmb_data(hmb_datas, dataList) |
|
573 |
lineTable.setRowCount(len(dataList)) |
|
574 |
row = 0 |
|
575 |
for data in dataList: |
|
576 |
for col in range(self.ui.tableWidgetLineDataList.columnCount()): |
|
577 |
col_item = self.ui.tableWidgetLineDataList.horizontalHeaderItem(col) |
|
578 |
if col_item.data(Qt.UserRole) in data: |
|
579 |
item = QTableWidgetItem(data[col_item.data(Qt.UserRole)]) |
|
580 |
item.setFlags(Qt.ItemIsEnabled) |
|
581 |
lineTable.setItem(row, col, item) |
|
582 |
|
|
583 |
row += 1 |
|
566 | 584 |
|
567 | 585 |
''' |
568 | 586 |
@brief setting line data |
... | ... | |
657 | 675 |
@author kyouho |
658 | 676 |
@date 2018.08.14 |
659 | 677 |
''' |
660 |
|
|
661 | 678 |
def set_instrument_data(self, hmb_datas=None): |
662 | 679 |
inst_table = self.ui.tableWidgetInstrumentDataList |
663 | 680 |
app_doc_data = AppDocData.instance() |
... | ... | |
765 | 782 |
hmb_datas = app_doc_data.get_hmb_data(None) |
766 | 783 |
configs = app_doc_data.getConfigs('Line List', 'Use Stream No') |
767 | 784 |
if configs and int(configs[0].value) == 1: |
768 |
self.set_line_list_data() |
|
785 |
self.set_line_list_data(hmb_datas)
|
|
769 | 786 |
else: |
770 | 787 |
self.set_line_data() |
771 | 788 |
self.set_equipment_data() |
DTI_PID/DTI_PID/LineListDialog.py | ||
---|---|---|
4 | 4 |
""" |
5 | 5 |
import os |
6 | 6 |
import sys |
7 |
import copy |
|
7 | 8 |
from PyQt5.QtCore import * |
8 | 9 |
from PyQt5.QtGui import * |
9 | 10 |
from PyQt5.QtWidgets import * |
... | ... | |
317 | 318 |
app_doc_data = AppDocData.instance() |
318 | 319 |
hmb_datas = app_doc_data.get_hmb_data(None) |
319 | 320 |
|
320 |
if (self.parent() and app_doc_data._streamLineListModelDatas is None) or not self.parent(): |
|
321 |
if True:#(self.parent() and app_doc_data._streamLineListModelDatas is None) or not self.parent():
|
|
321 | 322 |
row_datas = self.make_valid_data(datas) |
322 | 323 |
|
323 | 324 |
model_datas = [] |
... | ... | |
396 | 397 |
model.appendRow(items) |
397 | 398 |
model_datas.append(model_data) |
398 | 399 |
else: |
399 |
model_datas = app_doc_data._streamLineListModelDatas |
|
400 |
model_datas = copy.deepcopy(app_doc_data._streamLineListModelDatas) |
|
401 |
|
|
402 |
for model_data in model_datas: |
|
403 |
stream_no = model_data['Stream No'] |
|
404 |
matches = [hmb_data for hmb_data in hmb_datas if hmb_data.stream_no == stream_no] |
|
405 |
hmb_data = None |
|
406 |
|
|
407 |
if matches: |
|
408 |
hmb_data = matches[0] |
|
409 |
|
|
410 |
phase = '' |
|
411 |
if hmb_data: |
|
412 |
phase = hmb_data.phase |
|
413 |
|
|
414 |
from_ = model_data['FROM'] |
|
415 |
to_ = model_data['TO'] |
|
416 |
|
|
417 |
from_item = QStandardItem(from_) |
|
418 |
from_item.tag = None # need fix |
|
419 |
to_item = QStandardItem(to_) |
|
420 |
to_item.tag = None # need fix |
|
421 |
|
|
422 |
pnid_no = model_data['Drawing Name'] |
|
423 |
|
|
424 |
data = model_data |
|
425 |
data['FROM'] = from_item |
|
426 |
data['TO'] = to_item |
|
427 |
data['P&ID NO.'] = pnid_no |
|
428 |
data['PHASE'] = phase |
|
429 |
|
|
430 |
items = [] |
|
431 |
model_data = {} |
|
432 |
for name, display in headers: |
|
433 |
value = '' |
|
434 |
|
|
435 |
if name in data: |
|
436 |
items.append(QStandardItem(data[name])) if type(data[name]) is str else items.append(data[name]) |
|
437 |
model_data[name] = data[name] if type(data[name]) is str else data[name].text() |
|
438 |
continue |
|
439 |
|
|
440 |
if name == self.emptyCol: |
|
441 |
items.append(QStandardItem('')) |
|
442 |
model_data[name] = '' |
|
443 |
continue |
|
444 |
|
|
445 |
datas = [] |
|
446 |
if phase == 'Two': |
|
447 |
phase = 'LIQUID' |
|
448 |
elif not phase: |
|
449 |
items.append(QStandardItem('-')) |
|
450 |
model_data[name] = '-' |
|
451 |
continue |
|
452 |
|
|
453 |
if hmb_data: |
|
454 |
datas = hmb_data.data |
|
455 |
|
|
456 |
matches = [data for data in datas if data.name == name and data.phase == phase] |
|
457 |
if matches: |
|
458 |
value = matches[0].value |
|
459 |
items.append(QStandardItem(value)) if type(value) is str else items.append(value) |
|
460 |
model_data[name] = value if type(value) is str else value.text() |
|
461 |
else: |
|
462 |
matches = [data for data in datas if data.name == name] |
|
463 |
if matches: |
|
464 |
value = matches[0].value |
|
465 |
items.append(QStandardItem(value)) if type(value) is str else items.append(value) |
|
466 |
model_data[name] = value if type(value) is str else value.text() |
|
467 |
else: |
|
468 |
items.append(QStandardItem('')) if type(value) is str else items.append(value) |
|
469 |
model_data[name] = value if type(value) is str else value.text() |
|
470 |
|
|
471 |
model.appendRow(items) |
|
400 | 472 |
|
401 | 473 |
model.setHorizontalHeaderLabels([header[1] for header in headers]) |
402 | 474 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1541 | 1541 |
cmd.show_progress.connect(self.progress.setValue) |
1542 | 1542 |
cmd.execute((drawing, self.graphicsView.scene()), |
1543 | 1543 |
symbol=True, text=True, line=True, unknown=True, package=True, update=True) |
1544 |
|
|
1545 |
app_doc_data._streamLineListModelDatas = app_doc_data.get_stream_line_list_data() |
|
1544 | 1546 |
# up to here |
1545 | 1547 |
|
1546 | 1548 |
""""update item tree widget""" |
내보내기 Unified diff