개정판 188ff83c
issue #1054 스트림 데이타 입력 - Display Stream No
Change-Id: I47d9782658613c84e76fa73c6f73b53152e57736
HYTOS/HYTOS/Calculation.py | ||
---|---|---|
2419 | 2419 |
self._hmb.flowrate_mass = round(mass * 2.20462, 3) |
2420 | 2420 |
elif flowrate_mass_unit == 't/h': |
2421 | 2421 |
self._hmb.flowrate_mass = round(mass * 1000, 3) |
2422 |
else:
|
|
2422 |
elif is_not_blank(str(self._hmb.flowrate_mass)) and is_not_blank(str(self._hmb.flowrate_volume)):
|
|
2423 | 2423 |
# (5-3) 둘다 적힌 경우 |
2424 | 2424 |
density = self._hmb.density |
2425 | 2425 |
|
HYTOS/HYTOS/HMBTable.py | ||
---|---|---|
26 | 26 |
self._uid = None |
27 | 27 |
self._components_uid = None |
28 | 28 |
self._stream_no = None |
29 |
self._stream_no_text = None |
|
29 | 30 |
self._phase_type = None |
30 | 31 |
self._flowrate_mass = None |
31 | 32 |
self._flowrate_volume = None |
... | ... | |
123 | 124 |
self._stream_no = int(value) |
124 | 125 |
|
125 | 126 |
@property |
127 |
def stream_no_text(self): |
|
128 |
return self._stream_no_text |
|
129 |
|
|
130 |
''' |
|
131 |
@author humkyung |
|
132 |
@date 2018.07.12 |
|
133 |
''' |
|
134 |
|
|
135 |
@stream_no_text.setter |
|
136 |
def stream_no_text(self, value): |
|
137 |
if value: |
|
138 |
self._stream_no_text = str(value) |
|
139 |
|
|
140 |
@property |
|
126 | 141 |
def phase_type(self): |
127 | 142 |
return self._phase_type |
128 | 143 |
|
... | ... | |
490 | 505 |
hmb._liquid_flowrate_mass = row[39] |
491 | 506 |
hmb._liquid_density = row[40] |
492 | 507 |
hmb._liquid_viscosity = row[41] |
508 |
hmb._stream_no_text = row[42] |
|
493 | 509 |
|
494 | 510 |
return hmb |
495 | 511 |
|
... | ... | |
517 | 533 |
@author yeonjin |
518 | 534 |
@date 2019.08.19 |
519 | 535 |
''' |
536 |
def deleteByStreamNo(self, stream_no): |
|
537 |
hmbs = self._hmbs |
|
538 |
if hmbs is not None: |
|
539 |
for hmb in hmbs: |
|
540 |
if str(hmb.stream_no) == str(stream_no): |
|
541 |
hmb.isDeleted = True |
|
542 |
break |
|
520 | 543 |
|
521 | 544 |
def deleteByUID(self, uid): |
522 | 545 |
hmbs = self._hmbs |
... | ... | |
529 | 552 |
def add(self, components_uid, stream_no): |
530 | 553 |
import uuid |
531 | 554 |
|
532 |
hmb = HMBData() |
|
533 |
hmb.uid = str(uuid.uuid4()) |
|
534 |
hmb.components_uid = components_uid |
|
535 |
hmb.stream_no = stream_no |
|
536 |
hmb.isDeleted = False |
|
555 |
matches = [hmb for hmb in self._hmbs if hmb.isDeleted and hmb.stream_no == stream_no] |
|
556 |
if matches: |
|
557 |
# make deleted hmb to alive |
|
558 |
matches[0].components_uid = components_uid |
|
559 |
matches[0].isDeleted = False |
|
560 |
else: |
|
561 |
hmb = HMBData() |
|
562 |
hmb.uid = str(uuid.uuid4()) |
|
563 |
hmb.components_uid = components_uid |
|
564 |
hmb.stream_no = stream_no |
|
537 | 565 |
|
538 |
self.append(hmb) |
|
566 |
hmb.isDeleted = False |
|
567 |
|
|
568 |
self.append(hmb) |
|
539 | 569 |
|
540 | 570 |
def updateByUID(self, components_uid, values): |
541 | 571 |
try: |
542 | 572 |
for hmb in self._hmbs: |
543 | 573 |
if str(hmb.components_uid) == str(components_uid): |
574 |
if 'Stream_No_Text' in values: |
|
575 |
hmb.stream_no_text = values['Stream_No_Text'] |
|
544 | 576 |
if 'Phase_Type' in values: |
545 | 577 |
hmb.phase_type = values['Phase_Type'] |
546 | 578 |
if 'Flowrate_Mass' in values: |
... | ... | |
649 | 681 |
cursor = conn.cursor() |
650 | 682 |
sql = """select h.UID |
651 | 683 |
, h.Components_UID |
652 |
, h.Stream_No |
|
684 |
, h.Stream_No
|
|
653 | 685 |
, h.Phase_Type |
654 | 686 |
, h.Flowrate_Mass |
655 | 687 |
, h.Flowrate_Volume |
... | ... | |
689 | 721 |
, h.Liquid_Flowrate_Mass |
690 | 722 |
, h.Liquid_Density |
691 | 723 |
, h.Liquid_Viscosity |
724 |
, c.Name |
|
692 | 725 |
from HMB h |
693 | 726 |
left join Components c |
694 | 727 |
on h.Components_UID = c.UID |
... | ... | |
798 | 831 |
@date 2018.07.12 |
799 | 832 |
''' |
800 | 833 |
|
834 |
def deleted_stream_nos(self): |
|
835 |
return set([hmb.stream_no for hmb in self._hmbs if hmb.isDeleted == True]) if self._hmbs is not None else {} |
|
836 |
|
|
801 | 837 |
def streamNos(self): |
802 | 838 |
return set([hmb.stream_no for hmb in self._hmbs if hmb.isDeleted == False]) if self._hmbs is not None else {} |
803 | 839 |
|
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
856 | 856 |
''' |
857 | 857 |
|
858 | 858 |
def onInitializeScene(self, action): |
859 |
|
|
860 |
if not self.graphicsView.hasImage(): |
|
861 |
self.showImageSelectionMessageBox() |
|
862 |
return |
|
863 |
|
|
864 | 859 |
try: |
865 | 860 |
msg = QMessageBox(self) |
866 | 861 |
msg.setIcon(QMessageBox.Question) |
... | ... | |
2342 | 2337 |
app_doc_data = AppDocData.instance() |
2343 | 2338 |
activeDrawing = app_doc_data.activeDrawing |
2344 | 2339 |
if activeDrawing: |
2345 |
activeDrawing.hmbTable.deleteByUID(stream_line.uid) |
|
2340 |
# activeDrawing.hmbTable.deleteByUID(stream_line.uid) |
|
2341 |
activeDrawing.hmbTable.deleteByStreamNo(stream_line.stream_no) |
|
2346 | 2342 |
|
2347 | 2343 |
self.load_HMB() |
2348 | 2344 |
|
... | ... | |
2356 | 2352 |
if drawing: |
2357 | 2353 |
components_uid = stream_line.uid |
2358 | 2354 |
stream_no = self.get_next_stream_no(drawing) |
2359 |
stream_line.stream_no = stream_no |
|
2360 | 2355 |
drawing.hmbTable.add(components_uid, stream_no) |
2356 |
stream_line.stream_no = stream_no |
|
2357 |
stream_line.stream_no_text = str(stream_no) |
|
2361 | 2358 |
except Exception as ex: |
2362 | 2359 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
2363 | 2360 |
sys.exc_info()[-1].tb_lineno) |
... | ... | |
2368 | 2365 |
if len(list(drawing.hmbTable.streamNos())) == 0: |
2369 | 2366 |
return 1 |
2370 | 2367 |
else: |
2371 |
streamNos = sorted(list(drawing.hmbTable.streamNos())) |
|
2372 |
lastStreamNo = streamNos[-1] |
|
2373 |
return lastStreamNo + 1 |
|
2368 |
if len(list(drawing.hmbTable.deleted_stream_nos())) > 0: |
|
2369 |
deleted_stream_nos = sorted(list(drawing.hmbTable.deleted_stream_nos())) |
|
2370 |
lastStreamNo = deleted_stream_nos[-1] |
|
2371 |
return lastStreamNo |
|
2372 |
else: |
|
2373 |
streamNos = sorted(list(drawing.hmbTable.streamNos())) |
|
2374 |
lastStreamNo = streamNos[-1] |
|
2375 |
return lastStreamNo + 1 |
|
2374 | 2376 |
|
2375 | 2377 |
def clear_HMB(self): |
2376 | 2378 |
self.tableWidgetHMB.clearContents() |
... | ... | |
2388 | 2390 |
for hmb in hmbs: |
2389 | 2391 |
columnCount = self.tableWidgetHMB.columnCount() |
2390 | 2392 |
self.tableWidgetHMB.setColumnCount(columnCount + 1) |
2391 |
col_names.append(str(hmb.stream_no)) |
|
2393 |
col_names.append(str(hmb.stream_no) + '\n(' + str(hmb.stream_no_text if hmb.stream_no_text else hmb._stream_no) + ')')
|
|
2392 | 2394 |
|
2393 | 2395 |
self.tableWidgetHMB.setItem(0, columnCount, set_item_properties(hmb.uid, |
2394 | 2396 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py | ||
---|---|---|
349 | 349 |
from AppDocData import AppDocData |
350 | 350 |
from EngineeringStreamNoTextItem import QEngineeringStreamNoTextItem |
351 | 351 |
|
352 |
if not self._stream_no_text: |
|
353 |
self._stream_no_text = QEngineeringStreamNoTextItem(f"{self._stream_no}", self) |
|
352 |
try: |
|
353 |
display_text = self.data.stream_no_text if self.data.stream_no_text else self._stream_no |
|
354 |
if not self._stream_no_text: |
|
355 |
self._stream_no_text = QEngineeringStreamNoTextItem(str(display_text), self) |
|
356 |
self._stream_no_text.setPlainText(str(display_text)) |
|
354 | 357 |
|
355 |
app_doc_data = AppDocData.instance() |
|
356 |
font_size = None |
|
357 |
configs = app_doc_data.getAppConfigs('option', 'TagFontSize') |
|
358 |
if configs and len(configs) == 1: |
|
359 |
self._stream_no_text.set_font_size(configs[0].value) |
|
358 |
app_doc_data = AppDocData.instance() |
|
359 |
font_size = None |
|
360 |
configs = app_doc_data.getAppConfigs('option', 'TagFontSize') |
|
361 |
if configs and len(configs) == 1: |
|
362 |
self._stream_no_text.set_font_size(configs[0].value) |
|
363 |
except Exception as ex: |
|
364 |
from App import App |
|
365 |
from AppDocData import MessageType |
|
366 |
|
|
367 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
368 |
sys.exc_info()[-1].tb_lineno) |
|
369 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
360 | 370 |
|
361 | 371 |
def build_path(self): |
362 | 372 |
"""build path""" |
... | ... | |
919 | 929 |
dialog = QStreamDataDialog() |
920 | 930 |
if dialog.showDialog(self): |
921 | 931 |
self.load_HMB() |
932 |
self.update_label_contents() |
|
922 | 933 |
except Exception as ex: |
923 | 934 |
from App import App |
924 | 935 |
from AppDocData import MessageType |
... | ... | |
957 | 968 |
|
958 | 969 |
cols = ['UID', 'Symbols_UID', 'Name'] |
959 | 970 |
values = ['?', '?', '?'] |
960 |
param = [str(uid), str(dbUid), str(self.stream_no)] |
|
971 |
param = [str(uid), str(dbUid), str(self.data.stream_no_text if self.data.stream_no_text else self._stream_no)] |
|
972 |
|
|
961 | 973 |
sql = 'insert or replace into Components({}) values({})'.format(','.join(cols), ','.join(values)) |
962 | 974 |
res.append((sql, tuple(param))) |
963 | 975 |
|
... | ... | |
1051 | 1063 |
item = QEngineeringStreamlineItem(uid) |
1052 | 1064 |
hmb_data = app_doc_data.activeDrawing.hmbTable.get_hmb_data(uid) |
1053 | 1065 |
item.stream_no = int(hmb_data.stream_no) if hmb_data else 1 # stream no |
1054 |
|
|
1066 |
item.stream_no_text = str(hmb_data.stream_no_text) if hmb_data else str(hmb_data.stream_no) # stream no |
|
1055 | 1067 |
pointsUids = [] |
1056 | 1068 |
for componentInfo in componentInfos: |
1057 | 1069 |
pointsUid = componentInfo['Point_UID'] # uid@Points |
HYTOS/HYTOS/StreamDataDialog.py | ||
---|---|---|
1258 | 1258 |
self.item = item |
1259 | 1259 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
1260 | 1260 |
self.ui.lineEdit_StreamNo.setText(str(item.stream_no)) |
1261 |
|
|
1262 |
if item.data.stream_no_text is not None: |
|
1263 |
self.ui.lineEdit_StreamNo_Text.setText(str(item.data.stream_no_text)) |
|
1264 |
else: |
|
1265 |
self.ui.lineEdit_StreamNo_Text.setText(str(item.data.stream_no)) |
|
1266 |
|
|
1261 | 1267 |
self.load_hmb(item.uid) |
1262 | 1268 |
self.load_geometry() |
1263 | 1269 |
self.exec_() |
... | ... | |
1501 | 1507 |
if drawing: |
1502 | 1508 |
values = {} |
1503 | 1509 |
|
1510 |
stream_no_text = self.ui.lineEdit_StreamNo_Text.text() |
|
1511 |
if is_blank(stream_no_text): |
|
1512 |
values['Stream_No_Text'] = self.ui.lineEdit_StreamNo.text() |
|
1513 |
else: |
|
1514 |
values['Stream_No_Text'] = stream_no_text |
|
1515 |
|
|
1504 | 1516 |
phase_type = self.ui.comboBox_PhaseType.currentData() |
1505 | 1517 |
values['Phase_Type'] = phase_type |
1506 | 1518 |
if phase_type == 'Vapor': |
HYTOS/HYTOS/StreamData_UI.py | ||
---|---|---|
1129 | 1129 |
self.pushButton_Copy_Stream.setGeometry(QtCore.QRect(368, 432, 121, 24)) |
1130 | 1130 |
self.pushButton_Copy_Stream.setObjectName("pushButton_Copy_Stream") |
1131 | 1131 |
self.comboBox_PhaseType = QtWidgets.QComboBox(Dialog) |
1132 |
self.comboBox_PhaseType.setGeometry(QtCore.QRect(288, 18, 169, 22))
|
|
1132 |
self.comboBox_PhaseType.setGeometry(QtCore.QRect(508, 18, 169, 22))
|
|
1133 | 1133 |
self.comboBox_PhaseType.setObjectName("comboBox_PhaseType") |
1134 | 1134 |
self.label_14 = QtWidgets.QLabel(Dialog) |
1135 |
self.label_14.setGeometry(QtCore.QRect(208, 20, 77, 16))
|
|
1135 |
self.label_14.setGeometry(QtCore.QRect(428, 20, 77, 16))
|
|
1136 | 1136 |
font = QtGui.QFont() |
1137 | 1137 |
font.setFamily("맑은 고딕") |
1138 | 1138 |
font.setBold(True) |
... | ... | |
1164 | 1164 |
self.pushButton_view.setMinimumSize(QtCore.QSize(0, 24)) |
1165 | 1165 |
self.pushButton_view.setMaximumSize(QtCore.QSize(16777215, 24)) |
1166 | 1166 |
self.pushButton_view.setObjectName("pushButton_view") |
1167 |
self.lineEdit_StreamNo_Text = QtWidgets.QLineEdit(Dialog) |
|
1168 |
self.lineEdit_StreamNo_Text.setGeometry(QtCore.QRect(296, 18, 121, 21)) |
|
1169 |
self.lineEdit_StreamNo_Text.setMinimumSize(QtCore.QSize(0, 21)) |
|
1170 |
self.lineEdit_StreamNo_Text.setMaximumSize(QtCore.QSize(16777215, 16777215)) |
|
1171 |
font = QtGui.QFont() |
|
1172 |
font.setFamily("맑은 고딕") |
|
1173 |
font.setBold(False) |
|
1174 |
font.setWeight(50) |
|
1175 |
self.lineEdit_StreamNo_Text.setFont(font) |
|
1176 |
self.lineEdit_StreamNo_Text.setAlignment(QtCore.Qt.AlignCenter) |
|
1177 |
self.lineEdit_StreamNo_Text.setReadOnly(False) |
|
1178 |
self.lineEdit_StreamNo_Text.setObjectName("lineEdit_StreamNo_Text") |
|
1179 |
self.label_33 = QtWidgets.QLabel(Dialog) |
|
1180 |
self.label_33.setGeometry(QtCore.QRect(212, 20, 77, 16)) |
|
1181 |
font = QtGui.QFont() |
|
1182 |
font.setFamily("맑은 고딕") |
|
1183 |
font.setBold(True) |
|
1184 |
font.setWeight(75) |
|
1185 |
self.label_33.setFont(font) |
|
1186 |
self.label_33.setObjectName("label_33") |
|
1167 | 1187 |
|
1168 | 1188 |
self.retranslateUi(Dialog) |
1169 | 1189 |
self.buttonBox.accepted.connect(Dialog.accept) |
... | ... | |
1292 | 1312 |
self.label_14.setText(_translate("Dialog", "Phase Type : ")) |
1293 | 1313 |
self.label_5.setText(_translate("Dialog", "Stream No. : ")) |
1294 | 1314 |
self.pushButton_view.setText(_translate("Dialog", "View Calculation Result")) |
1315 |
self.label_33.setText(_translate("Dialog", "Display Text : ")) |
|
1295 | 1316 |
import Resource_rc |
HYTOS/HYTOS/UI/StreamData.ui | ||
---|---|---|
2877 | 2877 |
<widget class="QComboBox" name="comboBox_PhaseType"> |
2878 | 2878 |
<property name="geometry"> |
2879 | 2879 |
<rect> |
2880 |
<x>288</x>
|
|
2880 |
<x>508</x>
|
|
2881 | 2881 |
<y>18</y> |
2882 | 2882 |
<width>169</width> |
2883 | 2883 |
<height>22</height> |
... | ... | |
2887 | 2887 |
<widget class="QLabel" name="label_14"> |
2888 | 2888 |
<property name="geometry"> |
2889 | 2889 |
<rect> |
2890 |
<x>208</x>
|
|
2890 |
<x>428</x>
|
|
2891 | 2891 |
<y>20</y> |
2892 | 2892 |
<width>77</width> |
2893 | 2893 |
<height>16</height> |
... | ... | |
2984 | 2984 |
<string>View Calculation Result</string> |
2985 | 2985 |
</property> |
2986 | 2986 |
</widget> |
2987 |
<widget class="QLineEdit" name="lineEdit_StreamNo_Text"> |
|
2988 |
<property name="geometry"> |
|
2989 |
<rect> |
|
2990 |
<x>296</x> |
|
2991 |
<y>18</y> |
|
2992 |
<width>121</width> |
|
2993 |
<height>21</height> |
|
2994 |
</rect> |
|
2995 |
</property> |
|
2996 |
<property name="minimumSize"> |
|
2997 |
<size> |
|
2998 |
<width>0</width> |
|
2999 |
<height>21</height> |
|
3000 |
</size> |
|
3001 |
</property> |
|
3002 |
<property name="maximumSize"> |
|
3003 |
<size> |
|
3004 |
<width>16777215</width> |
|
3005 |
<height>16777215</height> |
|
3006 |
</size> |
|
3007 |
</property> |
|
3008 |
<property name="font"> |
|
3009 |
<font> |
|
3010 |
<family>맑은 고딕</family> |
|
3011 |
<weight>50</weight> |
|
3012 |
<bold>false</bold> |
|
3013 |
</font> |
|
3014 |
</property> |
|
3015 |
<property name="alignment"> |
|
3016 |
<set>Qt::AlignCenter</set> |
|
3017 |
</property> |
|
3018 |
<property name="readOnly"> |
|
3019 |
<bool>false</bool> |
|
3020 |
</property> |
|
3021 |
</widget> |
|
3022 |
<widget class="QLabel" name="label_33"> |
|
3023 |
<property name="geometry"> |
|
3024 |
<rect> |
|
3025 |
<x>212</x> |
|
3026 |
<y>20</y> |
|
3027 |
<width>77</width> |
|
3028 |
<height>16</height> |
|
3029 |
</rect> |
|
3030 |
</property> |
|
3031 |
<property name="font"> |
|
3032 |
<font> |
|
3033 |
<family>맑은 고딕</family> |
|
3034 |
<weight>75</weight> |
|
3035 |
<bold>true</bold> |
|
3036 |
</font> |
|
3037 |
</property> |
|
3038 |
<property name="text"> |
|
3039 |
<string>Display Text : </string> |
|
3040 |
</property> |
|
3041 |
</widget> |
|
2987 | 3042 |
</widget> |
2988 | 3043 |
<tabstops> |
2989 | 3044 |
<tabstop>lineEdit_StreamNo</tabstop> |
내보내기 Unified diff