hytos / HYTOS / HYTOS / PlateHeatExchanger.py @ 1b05f1f8
이력 | 보기 | 이력해설 | 다운로드 (7.06 KB)
1 | 0b4e00b7 | kim yeonjin | # -*- coding: utf-8 -*-
|
---|---|---|---|
2 | |||
3 | # Form implementation generated from reading ui file 'ProjectDialog.ui'
|
||
4 | #
|
||
5 | # Created by: PyQt5 UI code generator 5.6
|
||
6 | #
|
||
7 | # WARNING! All changes made in this file will be lost!
|
||
8 | |||
9 | from PyQt5 import QtCore, QtGui, QtWidgets |
||
10 | from PyQt5.QtWidgets import * |
||
11 | import os |
||
12 | from AppDocData import AppDocData |
||
13 | import PlateHeatExchanger_UI |
||
14 | import math |
||
15 | |||
16 | class QPlateHeatExchanger(QDialog): |
||
17 | def __init__(self): |
||
18 | QDialog.__init__(self)
|
||
19 | |||
20 | self.ui = PlateHeatExchanger_UI.Ui_PlateHeatExchangerDialog()
|
||
21 | self.ui.setupUi(self) |
||
22 | 24ea7edf | kim yeonjin | |
23 | self.ui.lineEdit_UpDown_Pressure_Drop.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_UpDown_Pressure_Drop)) |
||
24 | self.ui.lineEdit_DownUp_Pressure_Drop.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_DownUp_Pressure_Drop)) |
||
25 | self.ui.lineEdit_UpDown_Elevation.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_UpDown_Elevation)) |
||
26 | self.ui.lineEdit_DownUp_Elevation.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_DownUp_Elevation)) |
||
27 | |||
28 | 0b4e00b7 | kim yeonjin | self.initialize()
|
29 | |||
30 | def showDialog(self, item): |
||
31 | self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
||
32 | 24ea7edf | kim yeonjin | self._item = item
|
33 | 0b4e00b7 | kim yeonjin | |
34 | self.ui.lineEdit_TagNo.setFocus()
|
||
35 | self.set_controls(item)
|
||
36 | 24ea7edf | kim yeonjin | self.load_data()
|
37 | 0b4e00b7 | kim yeonjin | |
38 | self.exec_()
|
||
39 | |||
40 | def initialize(self): |
||
41 | self.ui.label_Img_1.setVisible(False) |
||
42 | self.ui.label_Img_2.setVisible(False) |
||
43 | self.ui.label_Img_3.setVisible(False) |
||
44 | self.ui.label_Img_4.setVisible(False) |
||
45 | |||
46 | self.ui.label_UpDown.setVisible(False) |
||
47 | 24ea7edf | kim yeonjin | self.ui.lineEdit_UpDown_Pressure_Drop.setEnabled(False) |
48 | 0b4e00b7 | kim yeonjin | self.ui.lineEdit_UpDown_Elevation.setEnabled(False) |
49 | |||
50 | self.ui.label_DownUp.setVisible(False) |
||
51 | 24ea7edf | kim yeonjin | self.ui.lineEdit_DownUp_Pressure_Drop.setEnabled(False) |
52 | 0b4e00b7 | kim yeonjin | self.ui.lineEdit_DownUp_Elevation.setEnabled(False) |
53 | |||
54 | def set_controls(self, item): |
||
55 | used_index = [] |
||
56 | |||
57 | for connector in item.connectors: |
||
58 | if connector.connectedItem:
|
||
59 | used_index.append(connector._conn_index) |
||
60 | |||
61 | if len(used_index) > 0: |
||
62 | if 1 in used_index or 3 in used_index: |
||
63 | self.ui.label_Img_1.setVisible(True) |
||
64 | self.ui.label_Img_3.setVisible(True) |
||
65 | |||
66 | self.ui.label_UpDown.setVisible(True) |
||
67 | 24ea7edf | kim yeonjin | self.ui.lineEdit_UpDown_Pressure_Drop.setEnabled(True) |
68 | 0b4e00b7 | kim yeonjin | self.ui.lineEdit_UpDown_Elevation.setEnabled(True) |
69 | |||
70 | if 2 in used_index or 4 in used_index: |
||
71 | self.ui.label_Img_2.setVisible(True) |
||
72 | self.ui.label_Img_4.setVisible(True) |
||
73 | |||
74 | self.ui.label_DownUp.setVisible(True) |
||
75 | 24ea7edf | kim yeonjin | self.ui.lineEdit_DownUp_Pressure_Drop.setEnabled(True) |
76 | 0b4e00b7 | kim yeonjin | self.ui.lineEdit_DownUp_Elevation.setEnabled(True) |
77 | |||
78 | 24ea7edf | kim yeonjin | def load_data(self): |
79 | """ load tag no and nozzle data """
|
||
80 | 0b4e00b7 | kim yeonjin | from Drawing import Drawing |
81 | |||
82 | appDocData = AppDocData.instance() |
||
83 | drawing = appDocData.activeDrawing |
||
84 | if drawing:
|
||
85 | 09a565dd | kim yeonjin | for attr in drawing.attrs: |
86 | if attr[0] == 'Units': |
||
87 | self.ui.label_PressureUnit.setText(attr[1]['Pressure']) |
||
88 | self.ui.label_ElevationUnit.setText(attr[1]['Length']) |
||
89 | 24ea7edf | kim yeonjin | |
90 | |||
91 | for connector in self._item.connectors: |
||
92 | index = connector._conn_index |
||
93 | 4aa060ea | humkyung | if connector.data:
|
94 | pressure_drop = connector.data.pressure_drop |
||
95 | 24ea7edf | kim yeonjin | if pressure_drop:
|
96 | if index == 1: |
||
97 | self.ui.lineEdit_UpDown_Pressure_Drop.setText(str(pressure_drop)) |
||
98 | elif index == 2: |
||
99 | self.ui.lineEdit_DownUp_Pressure_Drop.setText(str(pressure_drop)) |
||
100 | elif index == 3: |
||
101 | self.ui.lineEdit_UpDown_Pressure_Drop.setText(str(pressure_drop)) |
||
102 | elif index == 4: |
||
103 | self.ui.lineEdit_DownUp_Pressure_Drop.setText(str(pressure_drop)) |
||
104 | |||
105 | |||
106 | 4aa060ea | humkyung | elevation = connector.data.elevation |
107 | 24ea7edf | kim yeonjin | if elevation:
|
108 | if index == 1: |
||
109 | self.ui.lineEdit_UpDown_Elevation.setText(str(elevation)) |
||
110 | elif index == 2: |
||
111 | self.ui.lineEdit_DownUp_Elevation.setText(str(elevation)) |
||
112 | elif index == 3: |
||
113 | self.ui.lineEdit_UpDown_Elevation.setText(str(elevation)) |
||
114 | elif index == 4: |
||
115 | self.ui.lineEdit_DownUp_Elevation.setText(str(elevation)) |
||
116 | |||
117 | |||
118 | 0b4e00b7 | kim yeonjin | def accept(self): |
119 | 24ea7edf | kim yeonjin | """ set tag no and nozzle data """
|
120 | from EngineeringConnectorItem import NozzleData |
||
121 | |||
122 | for connector in self._item.connectors: |
||
123 | index = connector._conn_index |
||
124 | 4aa060ea | humkyung | if not connector.data: |
125 | connector.data = NozzleData() |
||
126 | 24ea7edf | kim yeonjin | |
127 | if index == 1: |
||
128 | pressure_drop = self.ui.lineEdit_UpDown_Pressure_Drop.text()
|
||
129 | if pressure_drop:
|
||
130 | 4aa060ea | humkyung | connector.data.pressure_drop = float(pressure_drop)
|
131 | 24ea7edf | kim yeonjin | else:
|
132 | 4aa060ea | humkyung | connector.data.pressure_drop = None
|
133 | 24ea7edf | kim yeonjin | |
134 | elevation = self.ui.lineEdit_UpDown_Elevation.text()
|
||
135 | if elevation:
|
||
136 | 4aa060ea | humkyung | connector.data.elevation = float(elevation)
|
137 | 24ea7edf | kim yeonjin | else:
|
138 | 4aa060ea | humkyung | connector.data.elevation = None
|
139 | 24ea7edf | kim yeonjin | elif index == 2: |
140 | pressure_drop = self.ui.lineEdit_DownUp_Pressure_Drop.text()
|
||
141 | if pressure_drop:
|
||
142 | 4aa060ea | humkyung | connector.data.pressure_drop = float(pressure_drop)
|
143 | 24ea7edf | kim yeonjin | else:
|
144 | 4aa060ea | humkyung | connector.data.pressure_drop = None
|
145 | 24ea7edf | kim yeonjin | |
146 | elevation = self.ui.lineEdit_DownUp_Elevation.text()
|
||
147 | if elevation:
|
||
148 | 4aa060ea | humkyung | connector.data.elevation = float(elevation)
|
149 | 24ea7edf | kim yeonjin | else:
|
150 | 4aa060ea | humkyung | connector.data.elevation = None
|
151 | 24ea7edf | kim yeonjin | elif index == 3: |
152 | pressure_drop = self.ui.lineEdit_UpDown_Pressure_Drop.text()
|
||
153 | if pressure_drop:
|
||
154 | 4aa060ea | humkyung | connector.data.pressure_drop = float(pressure_drop)
|
155 | 24ea7edf | kim yeonjin | else:
|
156 | 4aa060ea | humkyung | connector.data.pressure_drop = None
|
157 | 24ea7edf | kim yeonjin | |
158 | elevation = self.ui.lineEdit_UpDown_Elevation.text()
|
||
159 | if elevation:
|
||
160 | 4aa060ea | humkyung | connector.data.elevation = float(elevation)
|
161 | 24ea7edf | kim yeonjin | else:
|
162 | 4aa060ea | humkyung | connector.data.elevation = None
|
163 | 24ea7edf | kim yeonjin | elif index == 4: |
164 | pressure_drop = self.ui.lineEdit_DownUp_Pressure_Drop.text()
|
||
165 | if pressure_drop:
|
||
166 | 4aa060ea | humkyung | connector.data.pressure_drop = float(pressure_drop)
|
167 | 24ea7edf | kim yeonjin | else:
|
168 | 4aa060ea | humkyung | connector.data.pressure_drop = None
|
169 | 24ea7edf | kim yeonjin | |
170 | elevation = self.ui.lineEdit_DownUp_Elevation.text()
|
||
171 | if elevation:
|
||
172 | 4aa060ea | humkyung | connector.data.elevation = float(elevation)
|
173 | 24ea7edf | kim yeonjin | else:
|
174 | 4aa060ea | humkyung | connector.data.elevation = None
|
175 | 24ea7edf | kim yeonjin | |
176 | 0b4e00b7 | kim yeonjin | QDialog.accept(self)
|
177 | |||
178 | def reject(self): |
||
179 | QDialog.reject(self) |