개정판 2737caa7
issue #1047 : set_table_widget_item_properties => set_item_properties
Change-Id: I16664e181108ddc3563587c84cae273bc821284c
HYTOS/HYTOS/CopyStreamData.py | ||
---|---|---|
16 | 16 |
import math |
17 | 17 |
|
18 | 18 |
|
19 |
def set_table_widget_item_properties(name, alignment, color=None):
|
|
19 |
def set_item_properties(name, alignment, color=None): |
|
20 | 20 |
if name is None: |
21 | 21 |
name = '' |
22 | 22 |
|
... | ... | |
60 | 60 |
def add_stream_data(self, name, value, unit): |
61 | 61 |
row = self.ui.tableWidget_StreamData.rowCount() |
62 | 62 |
self.ui.tableWidget_StreamData.setRowCount(row + 1) |
63 |
self.ui.tableWidget_StreamData.setItem(row, 0, set_table_widget_item_properties(name,
|
|
64 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
65 |
self.ui.tableWidget_StreamData.setItem(row, 1, set_table_widget_item_properties(value,
|
|
66 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
67 |
self.ui.tableWidget_StreamData.setItem(row, 2, set_table_widget_item_properties(unit,
|
|
68 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
63 |
self.ui.tableWidget_StreamData.setItem(row, 0, set_item_properties(name, |
|
64 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
65 |
self.ui.tableWidget_StreamData.setItem(row, 1, set_item_properties(value, |
|
66 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
67 |
self.ui.tableWidget_StreamData.setItem(row, 2, set_item_properties(unit, |
|
68 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
69 | 69 |
|
70 | 70 |
self.ui.tableWidget_StreamData.resizeRowsToContents() |
71 | 71 |
self.ui.tableWidget_StreamData.resizeColumnsToContents() |
... | ... | |
73 | 73 |
def add_stream_no(self, stream_no, components_uid): |
74 | 74 |
row = self.ui.tableWidget_StreamNo.rowCount() |
75 | 75 |
self.ui.tableWidget_StreamNo.setRowCount(row + 1) |
76 |
self.ui.tableWidget_StreamNo.setItem(row, 0, set_table_widget_item_properties(stream_no,
|
|
77 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
78 |
self.ui.tableWidget_StreamNo.setItem(row, 1, set_table_widget_item_properties(components_uid,
|
|
79 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
76 |
self.ui.tableWidget_StreamNo.setItem(row, 0, set_item_properties(stream_no, |
|
77 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
78 |
self.ui.tableWidget_StreamNo.setItem(row, 1, set_item_properties(components_uid, |
|
79 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
80 | 80 |
|
81 | 81 |
self.ui.tableWidget_StreamNo.resizeRowsToContents() |
82 | 82 |
self.ui.tableWidget_StreamNo.resizeColumnsToContents() |
... | ... | |
165 | 165 |
unit = self.convertToUnits(columnInfo[1]) |
166 | 166 |
|
167 | 167 |
self.ui.tableWidget_StreamData.setItem(rowIndex, 0, |
168 |
set_table_widget_item_properties(name,
|
|
169 |
QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter,
|
|
170 |
QColor(51, 153,
|
|
168 |
set_item_properties(name, |
|
169 |
QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter, |
|
170 |
QColor(51, 153, |
|
171 | 171 |
102))) # QColor(230, 230, 230))) |
172 | 172 |
|
173 | 173 |
self.ui.tableWidget_StreamData.setItem(rowIndex, 1, |
174 |
set_table_widget_item_properties(unit,
|
|
175 |
QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter,
|
|
176 |
QColor(204, 255,
|
|
174 |
set_item_properties(unit, |
|
175 |
QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter, |
|
176 |
QColor(204, 255, |
|
177 | 177 |
204))) # QColor(230, 230, 230))) |
178 | 178 |
|
179 | 179 |
rowIndex += 1 |
... | ... | |
228 | 228 |
drawing = app_doc_data.activeDrawing |
229 | 229 |
matches = [hmb for hmb in drawing.hmbTable._hmbs if hmb.components_uid == components_uid] |
230 | 230 |
if matches: |
231 |
self.ui.tableWidget_StreamData.setItem(0, 2, set_table_widget_item_properties(matches[0].uid,
|
|
232 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
233 |
self.ui.tableWidget_StreamData.setItem(1, 2, set_table_widget_item_properties(matches[0].components_uid,
|
|
234 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
235 |
self.ui.tableWidget_StreamData.setItem(2, 2, set_table_widget_item_properties(matches[0].stream_no,
|
|
236 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
237 |
self.ui.tableWidget_StreamData.setItem(3, 2, set_table_widget_item_properties(matches[0].phase_type,
|
|
238 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
239 |
self.ui.tableWidget_StreamData.setItem(4, 2, set_table_widget_item_properties(matches[0].flowrate_mass,
|
|
240 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
231 |
self.ui.tableWidget_StreamData.setItem(0, 2, set_item_properties(matches[0].uid, |
|
232 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
233 |
self.ui.tableWidget_StreamData.setItem(1, 2, set_item_properties(matches[0].components_uid, |
|
234 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
235 |
self.ui.tableWidget_StreamData.setItem(2, 2, set_item_properties(matches[0].stream_no, |
|
236 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
237 |
self.ui.tableWidget_StreamData.setItem(3, 2, set_item_properties(matches[0].phase_type, |
|
238 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
239 |
self.ui.tableWidget_StreamData.setItem(4, 2, set_item_properties(matches[0].flowrate_mass, |
|
240 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
241 | 241 |
self.ui.tableWidget_StreamData.setItem(5, 2, |
242 |
set_table_widget_item_properties(matches[0].flowrate_volume,
|
|
243 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
244 |
self.ui.tableWidget_StreamData.setItem(6, 2, set_table_widget_item_properties(matches[0].density,
|
|
245 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
246 |
self.ui.tableWidget_StreamData.setItem(7, 2, set_table_widget_item_properties(matches[0].viscosity,
|
|
247 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
248 |
self.ui.tableWidget_StreamData.setItem(8, 2, set_table_widget_item_properties(matches[0].temperature,
|
|
249 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
242 |
set_item_properties(matches[0].flowrate_volume, |
|
243 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
244 |
self.ui.tableWidget_StreamData.setItem(6, 2, set_item_properties(matches[0].density, |
|
245 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
246 |
self.ui.tableWidget_StreamData.setItem(7, 2, set_item_properties(matches[0].viscosity, |
|
247 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
248 |
self.ui.tableWidget_StreamData.setItem(8, 2, set_item_properties(matches[0].temperature, |
|
249 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
250 | 250 |
self.ui.tableWidget_StreamData.setItem(9, 2, |
251 |
set_table_widget_item_properties(matches[0].molecular_weight,
|
|
252 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
251 |
set_item_properties(matches[0].molecular_weight, |
|
252 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
253 | 253 |
self.ui.tableWidget_StreamData.setItem(10, 2, |
254 |
set_table_widget_item_properties(matches[0].specific_heat_ratio,
|
|
255 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
254 |
set_item_properties(matches[0].specific_heat_ratio, |
|
255 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
256 | 256 |
self.ui.tableWidget_StreamData.setItem(11, 2, |
257 |
set_table_widget_item_properties(matches[0].compress_factor,
|
|
258 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
257 |
set_item_properties(matches[0].compress_factor, |
|
258 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
259 | 259 |
self.ui.tableWidget_StreamData.setItem(12, 2, |
260 |
set_table_widget_item_properties(matches[0].nominal_pipe_size,
|
|
261 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
260 |
set_item_properties(matches[0].nominal_pipe_size, |
|
261 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
262 | 262 |
self.ui.tableWidget_StreamData.setItem(13, 2, |
263 |
set_table_widget_item_properties(matches[0].inside_pipe_size,
|
|
264 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
263 |
set_item_properties(matches[0].inside_pipe_size, |
|
264 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
265 | 265 |
self.ui.tableWidget_StreamData.setItem(14, 2, |
266 |
set_table_widget_item_properties(matches[0].schedule_no,
|
|
267 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
266 |
set_item_properties(matches[0].schedule_no, |
|
267 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
268 | 268 |
self.ui.tableWidget_StreamData.setItem(15, 2, |
269 |
set_table_widget_item_properties(matches[0].straight_length,
|
|
270 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
269 |
set_item_properties(matches[0].straight_length, |
|
270 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
271 | 271 |
self.ui.tableWidget_StreamData.setItem(16, 2, |
272 |
set_table_widget_item_properties(matches[0].equivalent_length,
|
|
273 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
272 |
set_item_properties(matches[0].equivalent_length, |
|
273 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
274 | 274 |
self.ui.tableWidget_StreamData.setItem(17, 2, |
275 |
set_table_widget_item_properties(
|
|
275 |
set_item_properties( |
|
276 | 276 |
matches[0].equivalent_length_input, |
277 | 277 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
278 | 278 |
self.ui.tableWidget_StreamData.setItem(18, 2, |
279 |
set_table_widget_item_properties(matches[0].fitting_length,
|
|
280 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
279 |
set_item_properties(matches[0].fitting_length, |
|
280 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
281 | 281 |
self.ui.tableWidget_StreamData.setItem(19, 2, |
282 |
set_table_widget_item_properties(matches[0].fitting_K,
|
|
283 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
282 |
set_item_properties(matches[0].fitting_K, |
|
283 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
284 | 284 |
self.ui.tableWidget_StreamData.setItem(20, 2, |
285 |
set_table_widget_item_properties(
|
|
285 |
set_item_properties( |
|
286 | 286 |
matches[0].equivalent_length_cal, |
287 | 287 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
288 | 288 |
self.ui.tableWidget_StreamData.setItem(21, 2, |
289 |
set_table_widget_item_properties(matches[0].roughness,
|
|
290 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
289 |
set_item_properties(matches[0].roughness, |
|
290 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
291 | 291 |
self.ui.tableWidget_StreamData.setItem(22, 2, |
292 |
set_table_widget_item_properties(matches[0].limitation_velocity,
|
|
293 |
Qt.AlignHCenter | Qt.AlignVCenter))
|
|
292 |
set_item_properties(matches[0].limitation_velocity, |
|
293 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
294 | 294 |
self.ui.tableWidget_StreamData.setItem(23, 2, |
295 |
set_table_widget_item_properties(
|
|
295 |
set_item_properties( |
|
296 | 296 |
matches[0].limitation_pressure_drop, |
297 | 297 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
298 | 298 |
except Exception as ex: |
내보내기 Unified diff