개정판 4f1aa001
issue #1054: 스트림 넘버를 수정할 수 있다
Change-Id: I571836fc04e0d92928e1b1d003f051285347da36
HYTOS/HYTOS/App.py | ||
---|---|---|
100 | 100 |
|
101 | 101 |
return None |
102 | 102 |
|
103 |
|
|
103 | 104 |
if __name__ == '__main__': |
104 | 105 |
from AppDocData import AppDocData |
105 | 106 |
from MainWindow import MainWindow |
HYTOS/HYTOS/Commands/HydroCalculationCommand.py | ||
---|---|---|
703 | 703 |
break |
704 | 704 |
# end at connector |
705 | 705 |
elif loop.items[-1].connectedItem and int(loop.items[-1].connectedItem._conn_index) == 2: |
706 |
if loop.items[-1].parentItem().name in ['HEX_H']:
|
|
706 |
if loop.items[-1].parentItem().name in ['HEX_DP', 'HEX_H', 'HEX_K', 'HEX_P', 'HEX_V']:
|
|
707 | 707 |
ports = {1: 3, 2: 4, 3: 1, 4: 2} |
708 | 708 |
target = ports[loop.items[-1]._conn_index] |
709 | 709 |
matches = [conn for conn in loop.items[-1].parentItem().connectors if |
HYTOS/HYTOS/HMBTable.py | ||
---|---|---|
127 | 127 |
def stream_no_text(self): |
128 | 128 |
return self._stream_no_text |
129 | 129 |
|
130 |
''' |
|
131 |
@author humkyung |
|
132 |
@date 2018.07.12 |
|
133 |
''' |
|
134 |
|
|
135 | 130 |
@stream_no_text.setter |
136 | 131 |
def stream_no_text(self, value): |
137 |
if value: |
|
138 |
self._stream_no_text = str(value) |
|
132 |
self._stream_no_text = str(value) |
|
139 | 133 |
|
140 | 134 |
@property |
141 | 135 |
def phase_type(self): |
... | ... | |
571 | 565 |
try: |
572 | 566 |
for hmb in self._hmbs: |
573 | 567 |
if str(hmb.components_uid) == str(components_uid): |
568 |
if 'Stream_No' in values: |
|
569 |
hmb.stream_no = values['Stream_No'] |
|
570 |
|
|
574 | 571 |
if 'Stream_No_Text' in values: |
575 | 572 |
hmb.stream_no_text = values['Stream_No_Text'] |
573 |
|
|
576 | 574 |
if 'Phase_Type' in values: |
577 | 575 |
hmb.phase_type = values['Phase_Type'] |
578 | 576 |
if 'Flowrate_Mass' in values: |
... | ... | |
657 | 655 |
from App import App |
658 | 656 |
from AppDocData import MessageType |
659 | 657 |
|
660 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
661 |
sys.exc_info()[-1].tb_lineno)
|
|
658 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
659 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
662 | 660 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
663 | 661 |
|
664 | 662 |
''' |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
258 | 258 |
|
259 | 259 |
version = QCoreApplication.applicationVersion() |
260 | 260 |
if drawingName is None: |
261 |
self.setWindowTitle(_translate(App.NAME + "({})".format(version), App.NAME + "({})".format(version)))
|
|
261 |
self.setWindowTitle(_translate(App.NAME + f"({version})", App.NAME + f"({version})"))
|
|
262 | 262 |
else: |
263 | 263 |
self.setWindowTitle( |
264 |
_translate(App.NAME + "({})".format(version), App.NAME + "({})".format(version)) + ' - {}'.format( |
|
265 |
drawingName)) |
|
264 |
_translate(App.NAME + f"({version})", App.NAME + f"({version})") + f" - {drawingName}") |
|
266 | 265 |
except Exception as ex: |
267 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
268 |
sys.exc_info()[-1].tb_lineno)
|
|
266 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
267 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
269 | 268 |
self.addMessage.emit(MessageType.Error, message) |
270 | 269 |
|
271 | 270 |
def on_sync_stream_data(self): |
... | ... | |
1719 | 1718 |
if hmbs is not None: |
1720 | 1719 |
stream_count = 1 |
1721 | 1720 |
col_no = 3 |
1722 |
for hmb in hmbs: |
|
1721 |
_hmbs = sorted(hmbs, key=lambda hmb: hmb.stream_no) |
|
1722 |
for hmb in _hmbs: |
|
1723 | 1723 |
if hmb.isDeleted == True: |
1724 | 1724 |
continue |
1725 | 1725 |
|
... | ... | |
2649 | 2649 |
self.tableWidgetHMB.setColumnCount(2) |
2650 | 2650 |
|
2651 | 2651 |
col_names = ['Stream No.', 'Unit'] |
2652 |
for hmb in hmbs: |
|
2652 |
_hmbs = sorted(hmbs, key=lambda hmb: hmb.stream_no) |
|
2653 |
for hmb in _hmbs: |
|
2653 | 2654 |
columnCount = self.tableWidgetHMB.columnCount() |
2654 | 2655 |
self.tableWidgetHMB.setColumnCount(columnCount + 1) |
2655 | 2656 |
col_names.append(str(hmb.stream_no) + '\n(' + str(hmb.stream_no_text if hmb.stream_no_text else hmb._stream_no) + ')') |
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py | ||
---|---|---|
953 | 953 |
self.scene().contents_changed.emit() |
954 | 954 |
|
955 | 955 |
def mouseDoubleClickEvent(self, event): |
956 |
from App import App |
|
956 | 957 |
from StreamDataDialog import QStreamDataDialog |
957 | 958 |
|
958 | 959 |
try: |
959 |
dialog = QStreamDataDialog()
|
|
960 |
if dialog.showDialog(self):
|
|
960 |
dlg = QStreamDataDialog()
|
|
961 |
if dlg.showDialog(self):
|
|
961 | 962 |
self.load_HMB() |
962 | 963 |
self.update_label_contents() |
964 |
if dlg.changed_stream_line: |
|
965 |
dlg.changed_stream_line.update_label_contents() |
|
966 |
if dlg.stream_no_changed: |
|
967 |
App.mainWnd().calculation() |
|
963 | 968 |
except Exception as ex: |
964 | 969 |
from App import App |
965 | 970 |
from AppDocData import MessageType |
966 | 971 |
|
967 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
968 |
sys.exc_info()[-1].tb_lineno)
|
|
972 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
973 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
969 | 974 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
970 | 975 |
|
971 | 976 |
def load_HMB(self): |
HYTOS/HYTOS/StreamDataDialog.py | ||
---|---|---|
74 | 74 |
|
75 | 75 |
self.item = None |
76 | 76 |
self.result = False |
77 |
self._stream_no_changed = False |
|
78 |
self._changed_stream_line = None |
|
77 | 79 |
self.liquid_drop_method = None |
78 | 80 |
self.ui.label_current_tab_index.setVisible(False) |
79 | 81 |
|
... | ... | |
153 | 155 |
self.init_nominal_diameter() |
154 | 156 |
self.init_schedule() |
155 | 157 |
|
158 |
@property |
|
159 |
def stream_no_changed(self): |
|
160 |
return self._stream_no_changed |
|
161 |
|
|
162 |
@stream_no_changed.setter |
|
163 |
def stream_no_changed(self, value): |
|
164 |
self._stream_no_changed = value |
|
165 |
|
|
166 |
@property |
|
167 |
def changed_stream_line(self): |
|
168 |
return self._changed_stream_line |
|
169 |
|
|
170 |
@changed_stream_line.setter |
|
171 |
def changed_stream_line(self, value): |
|
172 |
self._changed_stream_line = value |
|
173 |
|
|
156 | 174 |
def delete_geometry_data_click_event(self): |
157 | 175 |
try: |
158 | 176 |
row = self.ui.tableWidget_GeometryData_Mixed.currentRow() |
... | ... | |
1282 | 1300 |
self.ui.comboBox_Schedule_No.setCurrentIndex(-1) |
1283 | 1301 |
|
1284 | 1302 |
def showDialog(self, item): |
1303 |
"""pop up stream data dialog""" |
|
1304 |
from EngineeringStreamlineItem import QEngineeringStreamlineItem |
|
1305 |
|
|
1285 | 1306 |
self.item = item |
1286 | 1307 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
1287 |
self.ui.lineEdit_StreamNo.setText(str(item.stream_no)) |
|
1308 |
self.ui.spinBoxStreamNo.setValue(item.stream_no) |
|
1309 |
|
|
1310 |
max_stream_no = 0 |
|
1311 |
stream_lines = [item_ for item_ in item.scene().items() if type(item_) is QEngineeringStreamlineItem] |
|
1312 |
for item_ in stream_lines: |
|
1313 |
if item_.stream_no > max_stream_no: |
|
1314 |
max_stream_no = item_.stream_no |
|
1315 |
self.ui.spinBoxStreamNo.setMaximum(max_stream_no) |
|
1288 | 1316 |
|
1289 | 1317 |
if item.data.stream_no_text is not None: |
1290 | 1318 |
self.ui.lineEdit_StreamNo_Text.setText(str(item.data.stream_no_text)) |
... | ... | |
1527 | 1555 |
sys.exc_info()[-1].tb_lineno) |
1528 | 1556 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1529 | 1557 |
|
1530 |
def update_hmb(self): |
|
1558 |
def update_hmb(self, stream_no_changed: bool, changed_stream_line=None):
|
|
1531 | 1559 |
from AppDocData import AppDocData |
1532 | 1560 |
|
1533 | 1561 |
try: |
... | ... | |
1535 | 1563 |
if drawing: |
1536 | 1564 |
values = {} |
1537 | 1565 |
|
1566 |
if stream_no_changed: |
|
1567 |
values['Stream_No'] = self.item.stream_no |
|
1568 |
|
|
1538 | 1569 |
stream_no_text = self.ui.lineEdit_StreamNo_Text.text() |
1539 | 1570 |
if is_blank(stream_no_text): |
1540 |
values['Stream_No_Text'] = self.ui.lineEdit_StreamNo.text()
|
|
1571 |
values['Stream_No_Text'] = str(self.item.stream_no)
|
|
1541 | 1572 |
else: |
1542 | 1573 |
values['Stream_No_Text'] = stream_no_text |
1543 | 1574 |
|
... | ... | |
1588 | 1619 |
|
1589 | 1620 |
drawing.hmbTable.updateByUID(self.item.uid, values) |
1590 | 1621 |
|
1622 |
if changed_stream_line: |
|
1623 |
values = {'Stream_No': changed_stream_line.stream_no, 'Stream_No_Text': ''} |
|
1624 |
drawing.hmbTable.updateByUID(changed_stream_line.uid, values) |
|
1591 | 1625 |
except Exception as ex: |
1592 | 1626 |
from App import App |
1593 | 1627 |
from AppDocData import MessageType |
1594 | 1628 |
|
1595 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
1596 |
sys.exc_info()[-1].tb_lineno)
|
|
1629 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
1630 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
1597 | 1631 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1598 | 1632 |
|
1599 | 1633 |
def get_mixed_equivalent_length(self): |
... | ... | |
1725 | 1759 |
|
1726 | 1760 |
# 'miter로 표현됨 길이임 |
1727 | 1761 |
FF = fit_FF * (0.25 * round(b) + 0.15 * round(f) + 0.025 * round(e)) + val_FF * (0.9 * round(a) + 0.08 * round(d) + 0.02 * round(c)) |
1728 |
str_len = float(self.ui.lineEdit_Straight_Length.text()) |
|
1762 |
str_len = float(self.ui.lineEdit_Straight_Length.text()) if self.ui.lineEdit_Straight_Length.text() else 0
|
|
1729 | 1763 |
|
1730 | 1764 |
equivalent_length_unit = self.ui.label_Equivalent_Lenght_Input_Unit.text() |
1731 | 1765 |
if equivalent_length_unit == 'm': |
... | ... | |
1785 | 1819 |
self.item.mixed_geometry = geometry |
1786 | 1820 |
|
1787 | 1821 |
def accept(self): |
1822 |
from EngineeringStreamlineItem import QEngineeringStreamlineItem |
|
1823 |
|
|
1788 | 1824 |
# Mixed Type Check |
1789 | 1825 |
phase_type = self.ui.comboBox_PhaseType.currentData() |
1790 | 1826 |
if phase_type == 'Mixed': |
... | ... | |
1792 | 1828 |
QMessageBox.information(self, self.tr("Information"), self.tr("Calculate this line !")) |
1793 | 1829 |
return |
1794 | 1830 |
|
1795 |
self.update_hmb() |
|
1831 |
"""stream no is changed""" |
|
1832 |
if self.item.stream_no != self.ui.spinBoxStreamNo.value(): |
|
1833 |
new_stream_no = self.ui.spinBoxStreamNo.value() |
|
1834 |
found = [item for item in self.item.scene().items() if type(item) is QEngineeringStreamlineItem and |
|
1835 |
item.stream_no == new_stream_no] |
|
1836 |
if found: |
|
1837 |
self.changed_stream_line = found[0] |
|
1838 |
self.item.stream_no, self.changed_stream_line.stream_no = new_stream_no, self.item.stream_no |
|
1839 |
self.stream_no_changed = True |
|
1840 |
else: |
|
1841 |
self.item.stream_no = new_stream_no |
|
1842 |
self.stream_no_changed = True |
|
1843 |
"""up to here""" |
|
1844 |
|
|
1845 |
self.update_hmb(self.stream_no_changed, self.changed_stream_line) |
|
1796 | 1846 |
self.result = True |
1797 | 1847 |
|
1798 | 1848 |
QDialog.accept(self) |
HYTOS/HYTOS/StreamData_UI.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
# Form implementation generated from reading ui file '.\UI\StreamData.ui' |
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.15.0
|
|
5 |
# Created by: PyQt5 UI code generator 5.13.1
|
|
6 | 6 |
# |
7 |
# WARNING: Any manual changes made to this file will be lost when pyuic5 is |
|
8 |
# run again. Do not edit this file unless you know what you are doing. |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
9 | 8 |
|
10 | 9 |
|
11 | 10 |
from PyQt5 import QtCore, QtGui, QtWidgets |
... | ... | |
1145 | 1144 |
font.setWeight(75) |
1146 | 1145 |
self.label_14.setFont(font) |
1147 | 1146 |
self.label_14.setObjectName("label_14") |
1148 |
self.lineEdit_StreamNo = QtWidgets.QLineEdit(Dialog) |
|
1149 |
self.lineEdit_StreamNo.setGeometry(QtCore.QRect(92, 18, 109, 21)) |
|
1150 |
self.lineEdit_StreamNo.setMinimumSize(QtCore.QSize(0, 21)) |
|
1151 |
self.lineEdit_StreamNo.setMaximumSize(QtCore.QSize(16777215, 16777215)) |
|
1152 |
font = QtGui.QFont() |
|
1153 |
font.setFamily("맑은 고딕") |
|
1154 |
font.setBold(False) |
|
1155 |
font.setWeight(50) |
|
1156 |
self.lineEdit_StreamNo.setFont(font) |
|
1157 |
self.lineEdit_StreamNo.setAlignment(QtCore.Qt.AlignCenter) |
|
1158 |
self.lineEdit_StreamNo.setReadOnly(True) |
|
1159 |
self.lineEdit_StreamNo.setObjectName("lineEdit_StreamNo") |
|
1160 | 1147 |
self.label_5 = QtWidgets.QLabel(Dialog) |
1161 | 1148 |
self.label_5.setGeometry(QtCore.QRect(12, 20, 77, 16)) |
1162 | 1149 |
font = QtGui.QFont() |
... | ... | |
1190 | 1177 |
font.setWeight(75) |
1191 | 1178 |
self.label_33.setFont(font) |
1192 | 1179 |
self.label_33.setObjectName("label_33") |
1180 |
self.spinBoxStreamNo = QtWidgets.QSpinBox(Dialog) |
|
1181 |
self.spinBoxStreamNo.setGeometry(QtCore.QRect(90, 19, 111, 22)) |
|
1182 |
self.spinBoxStreamNo.setMinimum(1) |
|
1183 |
self.spinBoxStreamNo.setObjectName("spinBoxStreamNo") |
|
1193 | 1184 |
|
1194 | 1185 |
self.retranslateUi(Dialog) |
1195 | 1186 |
self.buttonBox.accepted.connect(Dialog.accept) |
1196 | 1187 |
self.buttonBox.rejected.connect(Dialog.reject) |
1197 | 1188 |
QtCore.QMetaObject.connectSlotsByName(Dialog) |
1198 |
Dialog.setTabOrder(self.lineEdit_StreamNo, self.comboBox_PhaseType) |
|
1199 | 1189 |
Dialog.setTabOrder(self.comboBox_PhaseType, self.lineEdit_Flowrate_Mass_Liquid) |
1200 | 1190 |
Dialog.setTabOrder(self.lineEdit_Flowrate_Mass_Liquid, self.lineEdit_Flowrate_Volume) |
1201 | 1191 |
Dialog.setTabOrder(self.lineEdit_Flowrate_Volume, self.lineEdit_Density) |
HYTOS/HYTOS/UI/StreamData.ui | ||
---|---|---|
2914 | 2914 |
<string>Phase Type : </string> |
2915 | 2915 |
</property> |
2916 | 2916 |
</widget> |
2917 |
<widget class="QLineEdit" name="lineEdit_StreamNo"> |
|
2918 |
<property name="geometry"> |
|
2919 |
<rect> |
|
2920 |
<x>92</x> |
|
2921 |
<y>18</y> |
|
2922 |
<width>109</width> |
|
2923 |
<height>21</height> |
|
2924 |
</rect> |
|
2925 |
</property> |
|
2926 |
<property name="minimumSize"> |
|
2927 |
<size> |
|
2928 |
<width>0</width> |
|
2929 |
<height>21</height> |
|
2930 |
</size> |
|
2931 |
</property> |
|
2932 |
<property name="maximumSize"> |
|
2933 |
<size> |
|
2934 |
<width>16777215</width> |
|
2935 |
<height>16777215</height> |
|
2936 |
</size> |
|
2937 |
</property> |
|
2938 |
<property name="font"> |
|
2939 |
<font> |
|
2940 |
<family>맑은 고딕</family> |
|
2941 |
<weight>50</weight> |
|
2942 |
<bold>false</bold> |
|
2943 |
</font> |
|
2944 |
</property> |
|
2945 |
<property name="alignment"> |
|
2946 |
<set>Qt::AlignCenter</set> |
|
2947 |
</property> |
|
2948 |
<property name="readOnly"> |
|
2949 |
<bool>true</bool> |
|
2950 |
</property> |
|
2951 |
</widget> |
|
2952 | 2917 |
<widget class="QLabel" name="label_5"> |
2953 | 2918 |
<property name="geometry"> |
2954 | 2919 |
<rect> |
... | ... | |
3049 | 3014 |
<string>Display Text : </string> |
3050 | 3015 |
</property> |
3051 | 3016 |
</widget> |
3017 |
<widget class="QSpinBox" name="spinBoxStreamNo"> |
|
3018 |
<property name="geometry"> |
|
3019 |
<rect> |
|
3020 |
<x>90</x> |
|
3021 |
<y>19</y> |
|
3022 |
<width>111</width> |
|
3023 |
<height>22</height> |
|
3024 |
</rect> |
|
3025 |
</property> |
|
3026 |
<property name="minimum"> |
|
3027 |
<number>1</number> |
|
3028 |
</property> |
|
3029 |
</widget> |
|
3052 | 3030 |
</widget> |
3053 | 3031 |
<tabstops> |
3054 |
<tabstop>lineEdit_StreamNo</tabstop> |
|
3055 | 3032 |
<tabstop>comboBox_PhaseType</tabstop> |
3056 | 3033 |
<tabstop>lineEdit_Flowrate_Mass_Liquid</tabstop> |
3057 | 3034 |
<tabstop>lineEdit_Flowrate_Volume</tabstop> |
내보내기 Unified diff