개정판 08955797
issue #1048 : 화면/네뉴/툴바 개발
Change-Id: I1b89f30441c774d71581ea4125ce639240e419b6
HYTOS/HYTOS/Drum_Vertical.py | ||
---|---|---|
14 | 14 |
import math |
15 | 15 |
|
16 | 16 |
|
17 |
def is_float(s): |
|
18 |
try: |
|
19 |
if s: |
|
20 |
float(s) |
|
21 |
return True |
|
22 |
else: |
|
23 |
return False |
|
24 |
except ValueError: |
|
25 |
return False |
|
26 |
|
|
27 |
|
|
28 |
def is_blank(s): |
|
29 |
return not (s and s.strip()) |
|
30 |
|
|
31 |
|
|
17 | 32 |
def is_not_blank(s): |
18 | 33 |
return bool(s and s.strip()) |
19 | 34 |
|
20 | 35 |
|
36 |
def convert_to_fixed_point(value): |
|
37 |
if is_float(str(value)): |
|
38 |
tokens = f"{float(value):.10f}".split('.') |
|
39 |
if len(tokens) == 2: |
|
40 |
# 소수점 아래가 있을 경우 소수점 아래의 trailing zero를 제거한다. |
|
41 |
if is_blank(tokens[1].rstrip('0')): |
|
42 |
return tokens[0] |
|
43 |
else: |
|
44 |
tokens[1] = tokens[1].rstrip('0') |
|
45 |
return '.'.join(tokens) |
|
46 |
else: |
|
47 |
return tokens[0] |
|
48 |
else: |
|
49 |
return value |
|
50 |
|
|
51 |
|
|
21 | 52 |
class QDrum_Vertical(QDialog): |
22 | 53 |
def __init__(self): |
23 | 54 |
QDialog.__init__(self) |
... | ... | |
211 | 242 |
index = connector._conn_index |
212 | 243 |
if connector.data: |
213 | 244 |
pressure = connector.data.pressure |
214 |
if pressure: |
|
245 |
if pressure is not None:
|
|
215 | 246 |
if index == 1: |
216 |
self.ui.lineEdit_N1_Pressure.setText(str(pressure))
|
|
247 |
self.ui.lineEdit_N1_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
217 | 248 |
elif index == 2: |
218 |
self.ui.lineEdit_N2_Pressure.setText(str(pressure))
|
|
249 |
self.ui.lineEdit_N2_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
219 | 250 |
elif index == 3: |
220 |
self.ui.lineEdit_N3_Pressure.setText(str(pressure))
|
|
251 |
self.ui.lineEdit_N3_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
221 | 252 |
elif index == 4: |
222 |
self.ui.lineEdit_N4_Pressure.setText(str(pressure))
|
|
253 |
self.ui.lineEdit_N4_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
223 | 254 |
elif index == 5: |
224 |
self.ui.lineEdit_N5_Pressure.setText(str(pressure))
|
|
255 |
self.ui.lineEdit_N5_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
225 | 256 |
elif index == 6: |
226 |
self.ui.lineEdit_N6_Pressure.setText(str(pressure))
|
|
257 |
self.ui.lineEdit_N6_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
227 | 258 |
elif index == 7: |
228 |
self.ui.lineEdit_N7_Pressure.setText(str(pressure))
|
|
259 |
self.ui.lineEdit_N7_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
229 | 260 |
elif index == 8: |
230 |
self.ui.lineEdit_N8_Pressure.setText(str(pressure))
|
|
261 |
self.ui.lineEdit_N8_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
231 | 262 |
elif index == 9: |
232 |
self.ui.lineEdit_N9_Pressure.setText(str(pressure))
|
|
263 |
self.ui.lineEdit_N9_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
233 | 264 |
elif index == 10: |
234 |
self.ui.lineEdit_N10_Pressure.setText(str(pressure))
|
|
265 |
self.ui.lineEdit_N10_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
235 | 266 |
elif index == 11: |
236 |
self.ui.lineEdit_N11_Pressure.setText(str(pressure))
|
|
267 |
self.ui.lineEdit_N11_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
237 | 268 |
elif index == 12: |
238 |
self.ui.lineEdit_N12_Pressure.setText(str(pressure))
|
|
269 |
self.ui.lineEdit_N12_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
239 | 270 |
|
240 | 271 |
elevation = connector.data.elevation |
241 |
if elevation: |
|
272 |
if elevation is not None:
|
|
242 | 273 |
if index == 1: |
243 |
self.ui.lineEdit_N1_Elevation.setText(str(elevation))
|
|
274 |
self.ui.lineEdit_N1_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
244 | 275 |
elif index == 2: |
245 |
self.ui.lineEdit_N2_Elevation.setText(str(elevation))
|
|
276 |
self.ui.lineEdit_N2_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
246 | 277 |
elif index == 3: |
247 |
self.ui.lineEdit_N3_Elevation.setText(str(elevation))
|
|
278 |
self.ui.lineEdit_N3_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
248 | 279 |
elif index == 4: |
249 |
self.ui.lineEdit_N4_Elevation.setText(str(elevation))
|
|
280 |
self.ui.lineEdit_N4_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
250 | 281 |
elif index == 5: |
251 |
self.ui.lineEdit_N5_Elevation.setText(str(elevation))
|
|
282 |
self.ui.lineEdit_N5_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
252 | 283 |
elif index == 6: |
253 |
self.ui.lineEdit_N6_Elevation.setText(str(elevation))
|
|
284 |
self.ui.lineEdit_N6_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
254 | 285 |
elif index == 7: |
255 |
self.ui.lineEdit_N7_Elevation.setText(str(elevation))
|
|
286 |
self.ui.lineEdit_N7_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
256 | 287 |
elif index == 8: |
257 |
self.ui.lineEdit_N8_Elevation.setText(str(elevation))
|
|
288 |
self.ui.lineEdit_N8_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
258 | 289 |
elif index == 9: |
259 |
self.ui.lineEdit_N9_Elevation.setText(str(elevation))
|
|
290 |
self.ui.lineEdit_N9_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
260 | 291 |
elif index == 10: |
261 |
self.ui.lineEdit_N10_Elevation.setText(str(elevation))
|
|
292 |
self.ui.lineEdit_N10_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
262 | 293 |
elif index == 11: |
263 |
self.ui.lineEdit_N11_Elevation.setText(str(elevation))
|
|
294 |
self.ui.lineEdit_N11_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
264 | 295 |
elif index == 12: |
265 |
self.ui.lineEdit_N12_Elevation.setText(str(elevation))
|
|
296 |
self.ui.lineEdit_N12_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
266 | 297 |
|
267 | 298 |
def accept(self): |
268 | 299 |
""" set tag no and nozzle data """ |
... | ... | |
277 | 308 |
connector.data = NozzleData() |
278 | 309 |
|
279 | 310 |
if index == 1: |
280 |
pressure = self.ui.lineEdit_N1_Pressure.text() |
|
281 |
if pressure: |
|
282 |
connector.data.pressure = float(pressure) |
|
283 |
else: |
|
284 |
connector.data.pressure = None |
|
285 |
|
|
286 |
elevation = self.ui.lineEdit_N1_Elevation.text() |
|
287 |
if elevation: |
|
288 |
connector.data.elevation = float(elevation) |
|
289 |
else: |
|
290 |
connector.data.elevation = None |
|
311 |
if self.ui.lineEdit_N1_Pressure.isEnabled(): |
|
312 |
pressure = self.ui.lineEdit_N1_Pressure.text() |
|
313 |
if pressure: |
|
314 |
connector.data.pressure = float(pressure) |
|
315 |
else: |
|
316 |
connector.data.pressure = 0 |
|
317 |
|
|
318 |
if self.ui.lineEdit_N1_Elevation.isEnabled(): |
|
319 |
elevation = self.ui.lineEdit_N1_Elevation.text() |
|
320 |
if elevation: |
|
321 |
connector.data.elevation = float(elevation) |
|
322 |
else: |
|
323 |
connector.data.elevation = 0 |
|
291 | 324 |
elif index == 2: |
292 |
pressure = self.ui.lineEdit_N2_Pressure.text() |
|
293 |
if pressure: |
|
294 |
connector.data.pressure = float(pressure) |
|
295 |
else: |
|
296 |
connector.data.pressure = None |
|
297 |
|
|
298 |
elevation = self.ui.lineEdit_N2_Elevation.text() |
|
299 |
if elevation: |
|
300 |
connector.data.elevation = float(elevation) |
|
301 |
else: |
|
302 |
connector.data.elevation = None |
|
325 |
if self.ui.lineEdit_N2_Pressure.isEnabled(): |
|
326 |
pressure = self.ui.lineEdit_N2_Pressure.text() |
|
327 |
if pressure: |
|
328 |
connector.data.pressure = float(pressure) |
|
329 |
else: |
|
330 |
connector.data.pressure = 0 |
|
331 |
|
|
332 |
if self.ui.lineEdit_N2_Elevation.isEnabled(): |
|
333 |
elevation = self.ui.lineEdit_N2_Elevation.text() |
|
334 |
if elevation: |
|
335 |
connector.data.elevation = float(elevation) |
|
336 |
else: |
|
337 |
connector.data.elevation = 0 |
|
303 | 338 |
elif index == 3: |
304 |
pressure = self.ui.lineEdit_N3_Pressure.text() |
|
305 |
if pressure: |
|
306 |
connector.data.pressure = float(pressure) |
|
307 |
else: |
|
308 |
connector.data.pressure = None |
|
309 |
|
|
310 |
elevation = self.ui.lineEdit_N3_Elevation.text() |
|
311 |
if elevation: |
|
312 |
connector.data.elevation = float(elevation) |
|
313 |
else: |
|
314 |
connector.data.elevation = None |
|
339 |
if self.ui.lineEdit_N3_Pressure.isEnabled(): |
|
340 |
pressure = self.ui.lineEdit_N3_Pressure.text() |
|
341 |
if pressure: |
|
342 |
connector.data.pressure = float(pressure) |
|
343 |
else: |
|
344 |
connector.data.pressure = 0 |
|
345 |
|
|
346 |
if self.ui.lineEdit_N3_Elevation.isEnabled(): |
|
347 |
elevation = self.ui.lineEdit_N3_Elevation.text() |
|
348 |
if elevation: |
|
349 |
connector.data.elevation = float(elevation) |
|
350 |
else: |
|
351 |
connector.data.elevation = 0 |
|
315 | 352 |
elif index == 4: |
316 |
pressure = self.ui.lineEdit_N4_Pressure.text() |
|
317 |
if pressure: |
|
318 |
connector.data.pressure = float(pressure) |
|
319 |
else: |
|
320 |
connector.data.pressure = None |
|
321 |
|
|
322 |
elevation = self.ui.lineEdit_N4_Elevation.text() |
|
323 |
if elevation: |
|
324 |
connector.data.elevation = float(elevation) |
|
325 |
else: |
|
326 |
connector.data.elevation = None |
|
353 |
if self.ui.lineEdit_N4_Pressure.isEnabled(): |
|
354 |
pressure = self.ui.lineEdit_N4_Pressure.text() |
|
355 |
if pressure: |
|
356 |
connector.data.pressure = float(pressure) |
|
357 |
else: |
|
358 |
connector.data.pressure = 0 |
|
359 |
|
|
360 |
if self.ui.lineEdit_N4_Elevation.isEnabled(): |
|
361 |
elevation = self.ui.lineEdit_N4_Elevation.text() |
|
362 |
if elevation: |
|
363 |
connector.data.elevation = float(elevation) |
|
364 |
else: |
|
365 |
connector.data.elevation = 0 |
|
327 | 366 |
elif index == 5: |
328 |
pressure = self.ui.lineEdit_N5_Pressure.text() |
|
329 |
if pressure: |
|
330 |
connector.data.pressure = float(pressure) |
|
331 |
else: |
|
332 |
connector.data.pressure = None |
|
333 |
|
|
334 |
elevation = self.ui.lineEdit_N5_Elevation.text() |
|
335 |
if elevation: |
|
336 |
connector.data.elevation = float(elevation) |
|
337 |
else: |
|
338 |
connector.data.elevation = None |
|
367 |
if self.ui.lineEdit_N5_Pressure.isEnabled(): |
|
368 |
pressure = self.ui.lineEdit_N5_Pressure.text() |
|
369 |
if pressure: |
|
370 |
connector.data.pressure = float(pressure) |
|
371 |
else: |
|
372 |
connector.data.pressure = 0 |
|
373 |
|
|
374 |
if self.ui.lineEdit_N5_Elevation.isEnabled(): |
|
375 |
elevation = self.ui.lineEdit_N5_Elevation.text() |
|
376 |
if elevation: |
|
377 |
connector.data.elevation = float(elevation) |
|
378 |
else: |
|
379 |
connector.data.elevation = 0 |
|
339 | 380 |
elif index == 6: |
340 |
pressure = self.ui.lineEdit_N6_Pressure.text() |
|
341 |
if pressure: |
|
342 |
connector.data.pressure = float(pressure) |
|
343 |
else: |
|
344 |
connector.data.pressure = None |
|
345 |
|
|
346 |
elevation = self.ui.lineEdit_N6_Elevation.text() |
|
347 |
if elevation: |
|
348 |
connector.data.elevation = float(elevation) |
|
349 |
else: |
|
350 |
connector.data.elevation = None |
|
381 |
if self.ui.lineEdit_N6_Pressure.isEnabled(): |
|
382 |
pressure = self.ui.lineEdit_N6_Pressure.text() |
|
383 |
if pressure: |
|
384 |
connector.data.pressure = float(pressure) |
|
385 |
else: |
|
386 |
connector.data.pressure = 0 |
|
387 |
|
|
388 |
if self.ui.lineEdit_N6_Elevation.isEnabled(): |
|
389 |
elevation = self.ui.lineEdit_N6_Elevation.text() |
|
390 |
if elevation: |
|
391 |
connector.data.elevation = float(elevation) |
|
392 |
else: |
|
393 |
connector.data.elevation = 0 |
|
351 | 394 |
elif index == 7: |
352 |
pressure = self.ui.lineEdit_N7_Pressure.text() |
|
353 |
if pressure: |
|
354 |
connector.data.pressure = float(pressure) |
|
355 |
else: |
|
356 |
connector.data.pressure = None |
|
357 |
|
|
358 |
elevation = self.ui.lineEdit_N7_Elevation.text() |
|
359 |
if elevation: |
|
360 |
connector.data.elevation = float(elevation) |
|
361 |
else: |
|
362 |
connector.data.elevation = None |
|
395 |
if self.ui.lineEdit_N7_Pressure.isEnabled(): |
|
396 |
pressure = self.ui.lineEdit_N7_Pressure.text() |
|
397 |
if pressure: |
|
398 |
connector.data.pressure = float(pressure) |
|
399 |
else: |
|
400 |
connector.data.pressure = 0 |
|
401 |
|
|
402 |
if self.ui.lineEdit_N7_Elevation.isEnabled(): |
|
403 |
elevation = self.ui.lineEdit_N7_Elevation.text() |
|
404 |
if elevation: |
|
405 |
connector.data.elevation = float(elevation) |
|
406 |
else: |
|
407 |
connector.data.elevation = 0 |
|
363 | 408 |
elif index == 8: |
364 |
pressure = self.ui.lineEdit_N8_Pressure.text() |
|
365 |
if pressure: |
|
366 |
connector.data.pressure = float(pressure) |
|
367 |
else: |
|
368 |
connector.data.pressure = None |
|
369 |
|
|
370 |
elevation = self.ui.lineEdit_N8_Elevation.text() |
|
371 |
if elevation: |
|
372 |
connector.data.elevation = float(elevation) |
|
373 |
else: |
|
374 |
connector.data.elevation = None |
|
409 |
if self.ui.lineEdit_N8_Pressure.isEnabled(): |
|
410 |
pressure = self.ui.lineEdit_N8_Pressure.text() |
|
411 |
if pressure: |
|
412 |
connector.data.pressure = float(pressure) |
|
413 |
else: |
|
414 |
connector.data.pressure = 0 |
|
415 |
|
|
416 |
if self.ui.lineEdit_N8_Elevation.isEnabled(): |
|
417 |
elevation = self.ui.lineEdit_N8_Elevation.text() |
|
418 |
if elevation: |
|
419 |
connector.data.elevation = float(elevation) |
|
420 |
else: |
|
421 |
connector.data.elevation = 0 |
|
375 | 422 |
elif index == 9: |
376 |
pressure = self.ui.lineEdit_N9_Pressure.text() |
|
377 |
if pressure: |
|
378 |
connector.data.pressure = float(pressure) |
|
379 |
else: |
|
380 |
connector.data.pressure = None |
|
381 |
|
|
382 |
elevation = self.ui.lineEdit_N9_Elevation.text() |
|
383 |
if elevation: |
|
384 |
connector.data.elevation = float(elevation) |
|
385 |
else: |
|
386 |
connector.data.elevation = None |
|
423 |
if self.ui.lineEdit_N9_Pressure.isEnabled(): |
|
424 |
pressure = self.ui.lineEdit_N9_Pressure.text() |
|
425 |
if pressure: |
|
426 |
connector.data.pressure = float(pressure) |
|
427 |
else: |
|
428 |
connector.data.pressure = 0 |
|
429 |
|
|
430 |
if self.ui.lineEdit_N9_Elevation.isEnabled(): |
|
431 |
elevation = self.ui.lineEdit_N9_Elevation.text() |
|
432 |
if elevation: |
|
433 |
connector.data.elevation = float(elevation) |
|
434 |
else: |
|
435 |
connector.data.elevation = 0 |
|
387 | 436 |
elif index == 10: |
388 |
pressure = self.ui.lineEdit_N10_Pressure.text() |
|
389 |
if pressure: |
|
390 |
connector.data.pressure = float(pressure) |
|
391 |
else: |
|
392 |
connector.data.pressure = None |
|
393 |
|
|
394 |
elevation = self.ui.lineEdit_N10_Elevation.text() |
|
395 |
if elevation: |
|
396 |
connector.data.elevation = float(elevation) |
|
397 |
else: |
|
398 |
connector.data.elevation = None |
|
437 |
if self.ui.lineEdit_N10_Pressure.isEnabled(): |
|
438 |
pressure = self.ui.lineEdit_N10_Pressure.text() |
|
439 |
if pressure: |
|
440 |
connector.data.pressure = float(pressure) |
|
441 |
else: |
|
442 |
connector.data.pressure = 0 |
|
443 |
|
|
444 |
if self.ui.lineEdit_N10_Elevation.isEnabled(): |
|
445 |
elevation = self.ui.lineEdit_N10_Elevation.text() |
|
446 |
if elevation: |
|
447 |
connector.data.elevation = float(elevation) |
|
448 |
else: |
|
449 |
connector.data.elevation = 0 |
|
399 | 450 |
elif index == 11: |
400 |
pressure = self.ui.lineEdit_N11_Pressure.text() |
|
401 |
if pressure: |
|
402 |
connector.data.pressure = float(pressure) |
|
403 |
else: |
|
404 |
connector.data.pressure = None |
|
405 |
|
|
406 |
elevation = self.ui.lineEdit_N11_Elevation.text() |
|
407 |
if elevation: |
|
408 |
connector.data.elevation = float(elevation) |
|
409 |
else: |
|
410 |
connector.data.elevation = None |
|
451 |
if self.ui.lineEdit_N11_Pressure.isEnabled(): |
|
452 |
pressure = self.ui.lineEdit_N11_Pressure.text() |
|
453 |
if pressure: |
|
454 |
connector.data.pressure = float(pressure) |
|
455 |
else: |
|
456 |
connector.data.pressure = 0 |
|
457 |
|
|
458 |
if self.ui.lineEdit_N11_Elevation.isEnabled(): |
|
459 |
elevation = self.ui.lineEdit_N11_Elevation.text() |
|
460 |
if elevation: |
|
461 |
connector.data.elevation = float(elevation) |
|
462 |
else: |
|
463 |
connector.data.elevation = 0 |
|
411 | 464 |
elif index == 12: |
412 |
pressure = self.ui.lineEdit_N12_Pressure.text() |
|
413 |
if pressure: |
|
414 |
connector.data.pressure = float(pressure) |
|
415 |
else: |
|
416 |
connector.data.pressure = None |
|
417 |
|
|
418 |
elevation = self.ui.lineEdit_N12_Elevation.text() |
|
419 |
if elevation: |
|
420 |
connector.data.elevation = float(elevation) |
|
421 |
else: |
|
422 |
connector.data.elevation = None |
|
465 |
if self.ui.lineEdit_N12_Pressure.isEnabled(): |
|
466 |
pressure = self.ui.lineEdit_N12_Pressure.text() |
|
467 |
if pressure: |
|
468 |
connector.data.pressure = float(pressure) |
|
469 |
else: |
|
470 |
connector.data.pressure = 0 |
|
471 |
|
|
472 |
if self.ui.lineEdit_N12_Elevation.isEnabled(): |
|
473 |
elevation = self.ui.lineEdit_N12_Elevation.text() |
|
474 |
if elevation: |
|
475 |
connector.data.elevation = float(elevation) |
|
476 |
else: |
|
477 |
connector.data.elevation = 0 |
|
423 | 478 |
|
424 | 479 |
QDialog.accept(self) |
425 | 480 |
else: |
426 |
QMessageBox.warning(self, self.tr('Notice'), self.tr('Please Input [Tag No.]'))
|
|
481 |
QMessageBox.information(self, self.tr('Information'), self.tr('Please Input [Tag No.]'))
|
|
427 | 482 |
|
428 | 483 |
def reject(self): |
429 | 484 |
QDialog.reject(self) |
내보내기 Unified diff