개정판 8d384e72
issue #1462: prepare
Change-Id: I28e373679e02ecfa73d55004e851afcb18bf91f5
DTI_PID/DTI_PID/Commands/SetStreamNoCommand.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is Load command module """ |
|
3 |
import os.path |
|
4 |
import sys, math |
|
5 |
from enum import Enum |
|
6 |
import uuid |
|
7 |
from PyQt5.QtCore import * |
|
8 |
from PyQt5.QtWidgets import * |
|
9 |
from PyQt5.QtGui import * |
|
10 |
from AppDocData import AppDocData |
|
11 |
from AbstractCommand import AbstractCommand |
|
12 |
from QtImageViewer import QtImageViewer |
|
13 |
|
|
14 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
|
15 |
from EngineeringLineItem import QEngineeringLineItem |
|
16 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
|
17 |
from SymbolSvgItem import SymbolSvgItem |
|
18 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
19 |
from EngineeringInstrumentItem import QEngineeringInstrumentItem |
|
20 |
from EngineeringVendorItem import QEngineeringVendorItem |
|
21 |
|
|
22 |
|
|
23 |
class SetStreamCommand(AbstractCommand): |
|
24 |
display_message = pyqtSignal(Enum, str) |
|
25 |
|
|
26 |
def __init__(self): |
|
27 |
super(SetStreamCommand, self).__init__(None) |
|
28 |
|
|
29 |
def execute(self, scene): |
|
30 |
"""set stream no""" |
|
31 |
|
|
32 |
from App import App |
|
33 |
from AppDocData import MessageType |
|
34 |
|
|
35 |
app_doc_data = AppDocData.instance() |
|
36 |
try: |
|
37 |
|
|
38 |
|
|
39 |
except Exception as ex: |
|
40 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
41 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
42 |
self.display_message.emit(MessageType.Error, message) |
DTI_PID/DTI_PID/ConnectAttrDialog.py | ||
---|---|---|
98 | 98 |
self.ui.checkBoxUpdateSpec.setHidden(True) |
99 | 99 |
self.ui.checkBoxUpdateLineType.setHidden(True) |
100 | 100 |
self.ui.checkBoxValidation.setHidden(True) |
101 |
self.ui.checkBoxStreamNo.setHidden(True) |
|
101 | 102 |
|
102 | 103 |
@property |
103 | 104 |
def validation_checked(self): |
... | ... | |
163 | 164 |
|
164 | 165 |
if self.instrument == 1: |
165 | 166 |
self.obj = Worker(self.scene, connectAttrImpl, self.ui.checkBoxUpdateLineType.isChecked(), |
166 |
self.ui.checkBoxUpdateFlowMark.isChecked(), self.ui.checkBoxUpdateSpec.isChecked()) |
|
167 |
self.ui.checkBoxUpdateFlowMark.isChecked(), self.ui.checkBoxUpdateSpec.isChecked(), self.ui.checkBoxStreamNo.isChecked())
|
|
167 | 168 |
else: |
168 | 169 |
self.obj = Worker(self.scene, connectAttrImpl_inst, self.ui.checkBoxUpdateLineType.isChecked(), |
169 |
self.ui.checkBoxUpdateFlowMark.isChecked(), self.ui.checkBoxUpdateSpec.isChecked()) |
|
170 |
self.ui.checkBoxUpdateFlowMark.isChecked(), self.ui.checkBoxUpdateSpec.isChecked(), self.ui.checkBoxStreamNo.isChecked())
|
|
170 | 171 |
|
171 | 172 |
# 2 - Connect Worker Signals to the Thread slots |
172 | 173 |
self.obj.signals.display_message.connect(self.addListItem) |
DTI_PID/DTI_PID/ConnectAttr_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
# Form implementation generated from reading ui file '.\UI\dlgConnectAttr.ui'
|
|
3 |
# Form implementation generated from reading ui file './UI/dlgConnectAttr.ui'
|
|
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.13.0
|
|
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 |
|
|
10 | 9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
11 | 10 |
|
12 |
|
|
13 | 11 |
class Ui_ConnectAttr(object): |
14 | 12 |
def setupUi(self, ConnectAttr): |
15 | 13 |
ConnectAttr.setObjectName("ConnectAttr") |
... | ... | |
55 | 53 |
self.checkBoxUpdateLineType = QtWidgets.QCheckBox(ConnectAttr) |
56 | 54 |
self.checkBoxUpdateLineType.setObjectName("checkBoxUpdateLineType") |
57 | 55 |
self.horizontalLayout_2.addWidget(self.checkBoxUpdateLineType) |
56 |
self.checkBoxStreamNo = QtWidgets.QCheckBox(ConnectAttr) |
|
57 |
self.checkBoxStreamNo.setObjectName("checkBoxStreamNo") |
|
58 |
self.horizontalLayout_2.addWidget(self.checkBoxStreamNo) |
|
58 | 59 |
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
59 | 60 |
self.horizontalLayout_2.addItem(spacerItem) |
60 | 61 |
self.pushButtonStart = QtWidgets.QPushButton(ConnectAttr) |
... | ... | |
84 | 85 |
self.checkBoxUpdateFlowMark.setText(_translate("ConnectAttr", "Update Flow Mark")) |
85 | 86 |
self.checkBoxUpdateSpec.setText(_translate("ConnectAttr", "Update Segment Break")) |
86 | 87 |
self.checkBoxUpdateLineType.setText(_translate("ConnectAttr", "Update Line Type")) |
88 |
self.checkBoxStreamNo.setText(_translate("ConnectAttr", "Update Stream No")) |
|
87 | 89 |
self.pushButtonStart.setText(_translate("ConnectAttr", "Start")) |
90 |
|
|
91 |
|
|
92 |
if __name__ == "__main__": |
|
93 |
import sys |
|
94 |
app = QtWidgets.QApplication(sys.argv) |
|
95 |
ConnectAttr = QtWidgets.QDialog() |
|
96 |
ui = Ui_ConnectAttr() |
|
97 |
ui.setupUi(ConnectAttr) |
|
98 |
ConnectAttr.show() |
|
99 |
sys.exit(app.exec_()) |
|
100 |
|
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
605 | 605 |
else: # elif key.AttributeType == 'Spec': |
606 | 606 |
self.setItem(row, 3, QTableWidgetItem(str(value)[1:-1])) |
607 | 607 |
else: |
608 |
pass |
|
609 |
''' |
|
608 | 610 |
self.setItem(row, 3, value_item) |
609 | 611 |
if key.Attribute.upper() == 'STREAM NO': |
610 | 612 |
stream_no_combo = QComboBox() |
... | ... | |
619 | 621 |
|
620 | 622 |
stream_no_combo.currentIndexChanged.connect( |
621 | 623 |
partial(self.on_stream_no_changed, item, stream_no_combo)) |
624 |
''' |
|
622 | 625 |
|
623 | 626 |
checkbox.state_changed(checkbox.isChecked()) |
624 | 627 |
|
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
40 | 40 |
self._end_breaks = end_breaks |
41 | 41 |
self.maxValue = None |
42 | 42 |
|
43 |
""" |
|
44 |
for spec in self._specBreak: |
|
45 |
for attr in spec.attrs: |
|
46 |
if type(attr) is tuple and attr[1] != '': |
|
47 |
self._specBreakUID.append(attr[1]) |
|
48 |
""" |
|
49 | 43 |
except Exception as ex: |
50 | 44 |
from App import App |
51 | 45 |
|
... | ... | |
445 | 439 |
@history humkyung 2018.06.21 paste connect attributes codes from recognizeLine function |
446 | 440 |
kyouho 2018.09.14 clear Item's owner |
447 | 441 |
''' |
448 |
async def connectAttrImpl(worker, update_line_type, update_flow_mark, update_spec): |
|
442 |
async def connectAttrImpl(worker, update_line_type, update_flow_mark, update_spec, update_stream_no):
|
|
449 | 443 |
from App import App |
450 | 444 |
import uuid |
451 | 445 |
from LineNoTracer import LineNoTracer |
... | ... | |
687 | 681 |
lineNo.clear_attr_and_assoc_item() |
688 | 682 |
lineNo.EvaluatedEQ() |
689 | 683 |
|
684 |
''' set stream no ''' |
|
685 |
if update_stream_no: |
|
686 |
set_stream_no(worker) |
|
687 |
|
|
688 |
''' visible on ''' |
|
690 | 689 |
ALL_ITEM = [item for item in worker.scene.items() if issubclass(type(item), QEngineeringAbstractItem)] |
691 | 690 |
for item in ALL_ITEM: |
692 | 691 |
item.setVisible(True) |
... | ... | |
699 | 698 |
(type1, value, traceback) = sys.exc_info() |
700 | 699 |
sys.excepthook(type1, value, traceback) |
701 | 700 |
|
701 |
def set_stream_no(worker): |
|
702 |
''' set stream no ''' |
|
703 |
|
|
704 |
from App import App |
|
705 |
from SetStreamCommand import SetStreamCommand |
|
706 |
|
|
707 |
cmd = SetStreamCommand() |
|
708 |
cmd.display_message.connect(App.mainWnd().onAddMessage) |
|
709 |
cmd.execute(worker.scene) |
|
702 | 710 |
|
703 | 711 |
def make_end_break(worker, end_breaks, lineNos): |
704 | 712 |
''' make end break ''' |
... | ... | |
1524 | 1532 |
sys.exc_info()[-1].tb_lineno) |
1525 | 1533 |
worker.display_message.emit(message) |
1526 | 1534 |
|
1527 |
async def connectAttrImpl_inst(worker, update_line_type, update_flow_mark, update_spec): |
|
1535 |
async def connectAttrImpl_inst(worker, update_line_type, update_flow_mark, update_spec, update_stream_no):
|
|
1528 | 1536 |
from App import App |
1529 | 1537 |
import uuid |
1530 | 1538 |
from LineNoTracer import LineNoTracer |
DTI_PID/DTI_PID/Scripts/SQLite_Project.tables.sql | ||
---|---|---|
72 | 72 |
`Priority` varchar ( 37 ), |
73 | 73 |
FOREIGN KEY(`Table_UID`) REFERENCES `InstTables`(`UID`), |
74 | 74 |
PRIMARY KEY(`UID`) |
75 |
); |
|
76 |
|
|
77 |
CREATE TABLE IF NOT EXISTS HMB ( |
|
78 |
UID VARCHAR (37) PRIMARY KEY, |
|
79 |
StreamNumber TEXT, |
|
80 |
StreamDescription TEXT, |
|
81 |
DATACASE TEXT, |
|
82 |
STREAMPHASE TEXT, |
|
83 |
Unitno TEXT, |
|
84 |
OVERALLVAPORFRACTION TEXT, |
|
85 |
OVERALLTEMPERATURE TEXT, |
|
86 |
OVERALLPRESSURE TEXT, |
|
87 |
OVERALLMOLECULARWEIGHT TEXT, |
|
88 |
OVERALLMOLARFLOW TEXT, |
|
89 |
OVERALLMASSFLOW TEXT, |
|
90 |
OVERALLACTUALVOLUMEFLOW TEXT, |
|
91 |
OVERALLMASSDENSITY TEXT, |
|
92 |
OVERALLVISCOSITY TEXT, |
|
93 |
OVERALLMASSHEATCAPACITY TEXT, |
|
94 |
OVERALLHEATFLOW TEXT, |
|
95 |
OverallMassEnthalpy TEXT, |
|
96 |
[OverallSp.Gravity] TEXT, |
|
97 |
OverallAPIGravity TEXT, |
|
98 |
OverallCriticalPressure TEXT, |
|
99 |
OverallCriticalTemperature TEXT, |
|
100 |
OverallUOPKfactor TEXT, |
|
101 |
LIQUIDMOLEFRACTION TEXT, |
|
102 |
VaporTemperature TEXT, |
|
103 |
VaporPressure TEXT, |
|
104 |
VaporPseudocriticalTemperature TEXT, |
|
105 |
VaporPseudocriticalPressure TEXT, |
|
106 |
VAPORMOLARRATE TEXT, |
|
107 |
VAPORMASSRATE TEXT, |
|
108 |
VAPORACTUALVOLUMERATE TEXT, |
|
109 |
[VAPORSTD.VOLUMERATE] TEXT, |
|
110 |
VAPORMOLECULARWEIGHT TEXT, |
|
111 |
VaporHeatFlow TEXT, |
|
112 |
VAPORCOMPRESSIBILITY TEXT, |
|
113 |
VAPORSPECIFICENTHALPY TEXT, |
|
114 |
VAPORSPECIFICHEATCAPACITY TEXT, |
|
115 |
IDEALVAPORSPECIFICHEATRATIO TEXT, |
|
116 |
VAPORACTUALDENSITY TEXT, |
|
117 |
VAPORTHERMALCONDUCTIVITY TEXT, |
|
118 |
VAPORVISCOSITY TEXT, |
|
119 |
LiquidTemperature TEXT, |
|
120 |
LiquidPressure TEXT, |
|
121 |
LiquidPseudocriticalTemperature TEXT, |
|
122 |
LiquidPseudocriticalPressure TEXT, |
|
123 |
LIQUIDMOLARRATE TEXT, |
|
124 |
LIQUIDMASSRATE TEXT, |
|
125 |
LIQUIDACTUALVOLUMEFLOW TEXT, |
|
126 |
[LIQUIDSTD.VOLUMEFLOW] TEXT, |
|
127 |
LIQUIDMOLECULARWEIGHT TEXT, |
|
128 |
LiquidHeatFlow TEXT, |
|
129 |
LIQUIDSPECIFICENTHALPY TEXT, |
|
130 |
LIQUIDBoilingPointPressureatStreamT TEXT, |
|
131 |
LIQUIDSPECIFICHEATCAPACITY TEXT, |
|
132 |
LIQUIDACTUALDENSITY TEXT, |
|
133 |
LiquidStdDensity TEXT, |
|
134 |
[LiquidSpecificGravity@15°C] TEXT, |
|
135 |
LIQUIDSURFACETENSION TEXT, |
|
136 |
LIQUIDTHERMALCONDUCTIVITY TEXT, |
|
137 |
LIQUIDVISCOSITY TEXT, |
|
138 |
AQUEOUSPseudocriticalTemperature TEXT, |
|
139 |
AQUEOUSPseudocriticalPressure TEXT, |
|
140 |
AQUEOUSMOLARRATE TEXT, |
|
141 |
AQUEOUSMASSRATE TEXT, |
|
142 |
AQUEOUSACTUALVOLUMEFLOW TEXT, |
|
143 |
[AQUEOUSSTD.LIQUIDFLOW] TEXT, |
|
144 |
AQUEOUSMolecularWeight TEXT, |
|
145 |
AQUEOUSHeatFlow TEXT, |
|
146 |
AQUEOUSSPECIFICENTHALPY TEXT, |
|
147 |
AQUEOUSBoilingPointPressureatStreamT TEXT, |
|
148 |
AQUEOUSSPECIFICHEATCAPACITY TEXT, |
|
149 |
AQUEOUSACTUALDENSITY TEXT, |
|
150 |
AQUEOUSStdDensity TEXT, |
|
151 |
[AQUEOUSSpecificGravity@15°C] TEXT, |
|
152 |
AQUEOUSSURFACETENSION TEXT, |
|
153 |
AQUEOUSTHERMALCONDUCTIVITY TEXT, |
|
154 |
AQUEOUSVISCOSITY TEXT, |
|
155 |
DataSource TEXT |
|
156 |
); |
|
157 |
|
|
158 |
|
|
159 |
CREATE TABLE IF NOT EXISTS Streamlines ( |
|
160 |
UID INTEGER PRIMARY KEY AUTOINCREMENT |
|
161 |
NOT NULL, |
|
162 |
HMB_UID VARCHAR (37) REFERENCES HMB (UID) ON DELETE CASCADE, |
|
163 |
[From_UID] VARCHAR (37) REFERENCES Components (UID) ON DELETE SET NULL, |
|
164 |
[To_UID] VARCHAR (37) REFERENCES Components (UID) ON DELETE SET NULL, |
|
165 |
[From] VARCHAR (100), |
|
166 |
[To] VARCHAR (100) |
|
167 | 75 |
); |
DTI_PID/DTI_PID/StreamlineDialog.py | ||
---|---|---|
210 | 210 |
|
211 | 211 |
def on_success_select_comp(selected): |
212 | 212 |
current = self.ui.tableViewFromTo.selectionModel().currentIndex() |
213 |
row = self.ui.tableViewFromTo.model().item(current.row(), 0)
|
|
214 |
column = row.data(Qt.UserRole)
|
|
215 |
item = self.ui.tableViewFromTo.model().item(current.row(), column)
|
|
213 |
row = current.row()
|
|
214 |
column = current.column()
|
|
215 |
item = self.ui.tableViewFromTo.model().item(row, column)
|
|
216 | 216 |
item.setText(str(selected)) |
217 | 217 |
item.setData(str(selected.uid), Qt.UserRole) |
218 | 218 |
App.mainWnd().graphicsView.useDefaultCommand() |
... | ... | |
220 | 220 |
# save column index |
221 | 221 |
if self.sender().parent() in self._from_to_widgets: |
222 | 222 |
row, column = self._from_to_widgets[self.sender().parent()] |
223 |
item = self.ui.tableViewFromTo.model().item(row, 0) |
|
224 |
item.setData(column, Qt.UserRole) |
|
225 | 223 |
self.ui.tableViewFromTo.setCurrentIndex(self.ui.tableViewFromTo.model().index(row, column)) |
224 |
|
|
225 |
app_doc_data = AppDocData.instance() |
|
226 |
drawing_item = self.ui.tableViewFromTo.model().item(row, 0) |
|
227 |
if drawing_item.data(Qt.UserRole) != app_doc_data.activeDrawing.UID: |
|
228 |
return |
|
226 | 229 |
# up to here |
230 |
|
|
227 | 231 |
cmd = SelectCompCommand(App.mainWnd().graphicsView) |
228 | 232 |
cmd.onSuccess.connect(on_success_select_comp) |
229 | 233 |
App.mainWnd().graphicsView.command = cmd |
DTI_PID/DTI_PID/UI/dlgConnectAttr.ui | ||
---|---|---|
86 | 86 |
</widget> |
87 | 87 |
</item> |
88 | 88 |
<item> |
89 |
<widget class="QCheckBox" name="checkBoxStreamNo"> |
|
90 |
<property name="text"> |
|
91 |
<string>Update Stream No</string> |
|
92 |
</property> |
|
93 |
</widget> |
|
94 |
</item> |
|
95 |
<item> |
|
89 | 96 |
<spacer name="horizontalSpacer"> |
90 | 97 |
<property name="orientation"> |
91 | 98 |
<enum>Qt::Horizontal</enum> |
내보내기 Unified diff