개정판 2737caa7
issue #1047 : set_table_widget_item_properties => set_item_properties
Change-Id: I16664e181108ddc3563587c84cae273bc821284c
HYTOS/HYTOS/StreamDataDialog.py | ||
---|---|---|
17 | 17 |
import math |
18 | 18 |
|
19 | 19 |
|
20 |
def set_table_widget_item_properties(name, alignment, color=None):
|
|
20 |
def set_item_properties(name, alignment, color=None): |
|
21 | 21 |
item = QTableWidgetItem(str(name)) |
22 | 22 |
item.setTextAlignment(alignment) |
23 | 23 |
if color: |
... | ... | |
153 | 153 |
|
154 | 154 |
if isAccepted: |
155 | 155 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 0, |
156 |
set_table_widget_item_properties(element,
|
|
157 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
156 |
set_item_properties(element, |
|
157 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
158 | 158 |
|
159 | 159 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 1, |
160 |
set_table_widget_item_properties(nominal_pipe_size,
|
|
161 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
160 |
set_item_properties(nominal_pipe_size, |
|
161 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
162 | 162 |
|
163 | 163 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 2, |
164 |
set_table_widget_item_properties(schedule_no,
|
|
165 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
164 |
set_item_properties(schedule_no, |
|
165 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
166 | 166 |
|
167 | 167 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 3, |
168 |
set_table_widget_item_properties(inside_pipe_size,
|
|
169 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
168 |
set_item_properties(inside_pipe_size, |
|
169 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
170 | 170 |
|
171 | 171 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 4, |
172 |
set_table_widget_item_properties(roughness,
|
|
173 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
172 |
set_item_properties(roughness, |
|
173 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
174 | 174 |
|
175 | 175 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 5, |
176 |
set_table_widget_item_properties(length,
|
|
177 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
176 |
set_item_properties(length, |
|
177 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
178 | 178 |
|
179 | 179 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 6, |
180 |
set_table_widget_item_properties(angle,
|
|
181 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
180 |
set_item_properties(angle, |
|
181 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
182 | 182 |
|
183 | 183 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 7, |
184 |
set_table_widget_item_properties(rpd,
|
|
185 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
184 |
set_item_properties(rpd, |
|
185 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
186 | 186 |
|
187 | 187 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 8, |
188 |
set_table_widget_item_properties(d1_d2,
|
|
189 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
188 |
set_item_properties(d1_d2, |
|
189 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
190 | 190 |
|
191 | 191 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 9, |
192 |
set_table_widget_item_properties(k,
|
|
193 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
192 |
set_item_properties(k, |
|
193 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
194 | 194 |
|
195 | 195 |
self.ui.tableWidget_GeometryData_Mixed.resizeColumnsToContents() |
196 | 196 |
self.ui.tableWidget_GeometryData_Mixed.resizeRowsToContents() |
... | ... | |
220 | 220 |
|
221 | 221 |
if isAccepted: |
222 | 222 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 0, |
223 |
set_table_widget_item_properties(element,
|
|
224 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
223 |
set_item_properties(element, |
|
224 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
225 | 225 |
|
226 | 226 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 1, |
227 |
set_table_widget_item_properties(nominal_pipe_size,
|
|
228 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
227 |
set_item_properties(nominal_pipe_size, |
|
228 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
229 | 229 |
|
230 | 230 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 2, |
231 |
set_table_widget_item_properties(schedule_no,
|
|
232 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
231 |
set_item_properties(schedule_no, |
|
232 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
233 | 233 |
|
234 | 234 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 3, |
235 |
set_table_widget_item_properties(inside_pipe_size,
|
|
236 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
235 |
set_item_properties(inside_pipe_size, |
|
236 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
237 | 237 |
|
238 | 238 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 4, |
239 |
set_table_widget_item_properties(roughness,
|
|
240 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
239 |
set_item_properties(roughness, |
|
240 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
241 | 241 |
|
242 | 242 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 5, |
243 |
set_table_widget_item_properties(length,
|
|
244 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
243 |
set_item_properties(length, |
|
244 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
245 | 245 |
|
246 | 246 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 6, |
247 |
set_table_widget_item_properties(angle,
|
|
248 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
247 |
set_item_properties(angle, |
|
248 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
249 | 249 |
|
250 | 250 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 7, |
251 |
set_table_widget_item_properties(rpd,
|
|
252 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
251 |
set_item_properties(rpd, |
|
252 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
253 | 253 |
|
254 | 254 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 8, |
255 |
set_table_widget_item_properties(d1_d2,
|
|
256 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
255 |
set_item_properties(d1_d2, |
|
256 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
257 | 257 |
|
258 | 258 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row, 9, |
259 |
set_table_widget_item_properties(k,
|
|
260 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
259 |
set_item_properties(k, |
|
260 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
261 | 261 |
|
262 | 262 |
self.ui.tableWidget_GeometryData_Mixed.resizeColumnsToContents() |
263 | 263 |
self.ui.tableWidget_GeometryData_Mixed.resizeRowsToContents() |
... | ... | |
449 | 449 |
table.setRowCount(row_count + 1) |
450 | 450 |
|
451 | 451 |
table.setItem(row_count, 0, |
452 |
set_table_widget_item_properties(row[0], Qt.AlignHCenter | Qt.AlignVCenter)) # No
|
|
452 |
set_item_properties(row[0], Qt.AlignHCenter | Qt.AlignVCenter)) # No |
|
453 | 453 |
table.setItem(row_count, 1, |
454 |
set_table_widget_item_properties(row[1], Qt.AlignLeft | Qt.AlignVCenter)) # Element
|
|
454 |
set_item_properties(row[1], Qt.AlignLeft | Qt.AlignVCenter)) # Element |
|
455 | 455 |
table.setItem(row_count, 2, |
456 |
set_table_widget_item_properties(row[2], Qt.AlignRight | Qt.AlignVCenter)) # Inside Diameter
|
|
456 |
set_item_properties(row[2], Qt.AlignRight | Qt.AlignVCenter)) # Inside Diameter |
|
457 | 457 |
table.setItem(row_count, 3, |
458 |
set_table_widget_item_properties(row[3], Qt.AlignRight | Qt.AlignVCenter)) # Length
|
|
458 |
set_item_properties(row[3], Qt.AlignRight | Qt.AlignVCenter)) # Length |
|
459 | 459 |
table.setItem(row_count, 4, |
460 |
set_table_widget_item_properties(row[4], Qt.AlignRight | Qt.AlignVCenter)) # Angle
|
|
461 |
table.setItem(row_count, 5, set_table_widget_item_properties(row[5], Qt.AlignRight | Qt.AlignVCenter)) # K
|
|
460 |
set_item_properties(row[4], Qt.AlignRight | Qt.AlignVCenter)) # Angle |
|
461 |
table.setItem(row_count, 5, set_item_properties(row[5], Qt.AlignRight | Qt.AlignVCenter)) # K |
|
462 | 462 |
table.setItem(row_count, 6, |
463 |
set_table_widget_item_properties(row[6], Qt.AlignRight | Qt.AlignVCenter)) # Pressure
|
|
463 |
set_item_properties(row[6], Qt.AlignRight | Qt.AlignVCenter)) # Pressure |
|
464 | 464 |
table.setItem(row_count, 7, |
465 |
set_table_widget_item_properties(row[7], Qt.AlignRight | Qt.AlignVCenter)) # Void
|
|
465 |
set_item_properties(row[7], Qt.AlignRight | Qt.AlignVCenter)) # Void |
|
466 | 466 |
table.setItem(row_count, 8, |
467 |
set_table_widget_item_properties(row[8], Qt.AlignRight | Qt.AlignVCenter)) # Quality
|
|
467 |
set_item_properties(row[8], Qt.AlignRight | Qt.AlignVCenter)) # Quality |
|
468 | 468 |
table.setItem(row_count, 9, |
469 |
set_table_widget_item_properties(row[9], Qt.AlignRight | Qt.AlignVCenter)) # Density
|
|
469 |
set_item_properties(row[9], Qt.AlignRight | Qt.AlignVCenter)) # Density |
|
470 | 470 |
table.setItem(row_count, 10, |
471 |
set_table_widget_item_properties(row[10], Qt.AlignRight | Qt.AlignVCenter)) # V.Den
|
|
471 |
set_item_properties(row[10], Qt.AlignRight | Qt.AlignVCenter)) # V.Den |
|
472 | 472 |
table.setItem(row_count, 11, |
473 |
set_table_widget_item_properties(row[11], Qt.AlignRight | Qt.AlignVCenter)) # Mean Vel
|
|
473 |
set_item_properties(row[11], Qt.AlignRight | Qt.AlignVCenter)) # Mean Vel |
|
474 | 474 |
table.setItem(row_count, 12, |
475 |
set_table_widget_item_properties(row[12], Qt.AlignRight | Qt.AlignVCenter)) # Max Vel
|
|
475 |
set_item_properties(row[12], Qt.AlignRight | Qt.AlignVCenter)) # Max Vel |
|
476 | 476 |
table.setItem(row_count, 13, |
477 |
set_table_widget_item_properties(row[13], Qt.AlignRight | Qt.AlignVCenter)) # Ero Vel
|
|
477 |
set_item_properties(row[13], Qt.AlignRight | Qt.AlignVCenter)) # Ero Vel |
|
478 | 478 |
table.setItem(row_count, 14, |
479 |
set_table_widget_item_properties(row[14], Qt.AlignRight | Qt.AlignVCenter)) # X
|
|
479 |
set_item_properties(row[14], Qt.AlignRight | Qt.AlignVCenter)) # X |
|
480 | 480 |
table.setItem(row_count, 15, |
481 |
set_table_widget_item_properties(row[15], Qt.AlignRight | Qt.AlignVCenter)) # Y
|
|
481 |
set_item_properties(row[15], Qt.AlignRight | Qt.AlignVCenter)) # Y |
|
482 | 482 |
table.setItem(row_count, 16, |
483 |
set_table_widget_item_properties(row[16], Qt.AlignLeft | Qt.AlignVCenter)) # Regime
|
|
483 |
set_item_properties(row[16], Qt.AlignLeft | Qt.AlignVCenter)) # Regime |
|
484 | 484 |
table.setItem(row_count, 17, |
485 |
set_table_widget_item_properties(row[17], Qt.AlignRight | Qt.AlignVCenter)) # Friction
|
|
485 |
set_item_properties(row[17], Qt.AlignRight | Qt.AlignVCenter)) # Friction |
|
486 | 486 |
table.setItem(row_count, 18, |
487 |
set_table_widget_item_properties(row[18], Qt.AlignRight | Qt.AlignVCenter)) # Gravity
|
|
487 |
set_item_properties(row[18], Qt.AlignRight | Qt.AlignVCenter)) # Gravity |
|
488 | 488 |
table.setItem(row_count, 19, |
489 |
set_table_widget_item_properties(row[19], Qt.AlignRight | Qt.AlignVCenter)) # Momentum
|
|
489 |
set_item_properties(row[19], Qt.AlignRight | Qt.AlignVCenter)) # Momentum |
|
490 | 490 |
table.setItem(row_count, 20, |
491 |
set_table_widget_item_properties(row[20], Qt.AlignRight | Qt.AlignVCenter)) # Total
|
|
491 |
set_item_properties(row[20], Qt.AlignRight | Qt.AlignVCenter)) # Total |
|
492 | 492 |
|
493 | 493 |
table.resizeColumnsToContents() |
494 | 494 |
table.resizeRowsToContents() |
... | ... | |
570 | 570 |
if isAccepted: |
571 | 571 |
self.ui.tableWidget_GeometryData_Mixed.setRowCount(row_count + 1) |
572 | 572 |
|
573 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 0, set_table_widget_item_properties(element,
|
|
574 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
573 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 0, set_item_properties(element, |
|
574 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
575 | 575 |
|
576 | 576 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 1, |
577 |
set_table_widget_item_properties(nominal_pipe_size,
|
|
578 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
577 |
set_item_properties(nominal_pipe_size, |
|
578 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
579 | 579 |
|
580 | 580 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 2, |
581 |
set_table_widget_item_properties(schedule_no,
|
|
582 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
581 |
set_item_properties(schedule_no, |
|
582 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
583 | 583 |
|
584 | 584 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 3, |
585 |
set_table_widget_item_properties(inside_pipe_size,
|
|
586 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
585 |
set_item_properties(inside_pipe_size, |
|
586 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
587 | 587 |
|
588 | 588 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 4, |
589 |
set_table_widget_item_properties(roughness,
|
|
590 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
589 |
set_item_properties(roughness, |
|
590 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
591 | 591 |
|
592 | 592 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 5, |
593 |
set_table_widget_item_properties(length,
|
|
594 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
593 |
set_item_properties(length, |
|
594 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
595 | 595 |
|
596 | 596 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 6, |
597 |
set_table_widget_item_properties(angle,
|
|
598 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
597 |
set_item_properties(angle, |
|
598 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
599 | 599 |
|
600 | 600 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 7, |
601 |
set_table_widget_item_properties(rpd,
|
|
602 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
601 |
set_item_properties(rpd, |
|
602 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
603 | 603 |
|
604 | 604 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 8, |
605 |
set_table_widget_item_properties(d1_d2,
|
|
606 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
605 |
set_item_properties(d1_d2, |
|
606 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
607 | 607 |
|
608 | 608 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 9, |
609 |
set_table_widget_item_properties(k,
|
|
610 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
609 |
set_item_properties(k, |
|
610 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
611 | 611 |
|
612 | 612 |
self.ui.tableWidget_GeometryData_Mixed.resizeColumnsToContents() |
613 | 613 |
self.ui.tableWidget_GeometryData_Mixed.resizeRowsToContents() |
... | ... | |
1175 | 1175 |
self.ui.tableWidget_GeometryData_Mixed.setRowCount(row_count + 1) |
1176 | 1176 |
|
1177 | 1177 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 0, |
1178 |
set_table_widget_item_properties(row[0],
|
|
1179 |
Qt.AlignLeft | Qt.AlignVCenter))
|
|
1178 |
set_item_properties(row[0], |
|
1179 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1180 | 1180 |
|
1181 | 1181 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 1, |
1182 |
set_table_widget_item_properties(row[1],
|
|
1183 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1182 |
set_item_properties(row[1], |
|
1183 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1184 | 1184 |
|
1185 | 1185 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 2, |
1186 |
set_table_widget_item_properties(row[2],
|
|
1187 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1186 |
set_item_properties(row[2], |
|
1187 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1188 | 1188 |
|
1189 | 1189 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 3, |
1190 |
set_table_widget_item_properties(row[3],
|
|
1191 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1190 |
set_item_properties(row[3], |
|
1191 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1192 | 1192 |
|
1193 | 1193 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 4, |
1194 |
set_table_widget_item_properties(row[4],
|
|
1195 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1194 |
set_item_properties(row[4], |
|
1195 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1196 | 1196 |
|
1197 | 1197 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 5, |
1198 |
set_table_widget_item_properties(row[5],
|
|
1199 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1198 |
set_item_properties(row[5], |
|
1199 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1200 | 1200 |
|
1201 | 1201 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 6, |
1202 |
set_table_widget_item_properties(row[6],
|
|
1203 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1202 |
set_item_properties(row[6], |
|
1203 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1204 | 1204 |
|
1205 | 1205 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 7, |
1206 |
set_table_widget_item_properties(row[7],
|
|
1207 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1206 |
set_item_properties(row[7], |
|
1207 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1208 | 1208 |
|
1209 | 1209 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 8, |
1210 |
set_table_widget_item_properties(row[8],
|
|
1211 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1210 |
set_item_properties(row[8], |
|
1211 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1212 | 1212 |
|
1213 | 1213 |
self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 9, |
1214 |
set_table_widget_item_properties(row[9],
|
|
1215 |
Qt.AlignRight | Qt.AlignVCenter))
|
|
1214 |
set_item_properties(row[9], |
|
1215 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1216 | 1216 |
|
1217 | 1217 |
self.ui.tableWidget_GeometryData_Mixed.resizeColumnsToContents() |
1218 | 1218 |
self.ui.tableWidget_GeometryData_Mixed.resizeRowsToContents() |
내보내기 Unified diff