프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / HYTOS / HYTOS / DP_Equipment.py @ e534f39d

이력 | 보기 | 이력해설 | 다운로드 (3.01 KB)

1
# -*- 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 Project import Project
13
from AppDocData import AppDocData
14
import DP_Equipment_UI
15
import math
16

    
17
class QDP_Equipment(QDialog):
18
    def __init__(self):
19
        QDialog.__init__(self)
20

    
21
        self.ui = DP_Equipment_UI.Ui_DP_EquipmentDialog()
22
        self.ui.setupUi(self)
23
        self.initialize()
24
        
25
        
26
    def showDialog(self, item):
27
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
28

    
29
        self.ui.lineEdit_TagNo.setFocus()
30
        self.set_controls(item)
31
        self.load_units()
32
        
33
        self.exec_()
34

    
35
    def initialize(self):
36
        self.ui.label_Img_Horizontal_In.setVisible(False)
37
        self.ui.label_Img_Horizontal_Out.setVisible(False)
38
        self.ui.label_Img_Vertical_In.setVisible(False)
39
        self.ui.label_Img_Vertical_Out.setVisible(False)
40

    
41
        self.ui.label_Horizontal.setVisible(False)
42
        self.ui.lineEdit_Horizontal_Pressure.setEnabled(False)                
43
        self.ui.lineEdit_Horizontal_Elevation.setEnabled(False)
44

    
45
        self.ui.label_Vertical.setVisible(False)
46
        self.ui.lineEdit_Vertical_Pressure.setEnabled(False)                
47
        self.ui.lineEdit_Vertical_Elevation.setEnabled(False)
48

    
49
    def set_controls(self, item):
50
        used_index = []
51

    
52
        for connector in item.connectors:            
53
            if connector.connectedItem:
54
                used_index.append(connector._conn_index)
55

    
56
        if len(used_index) > 0:
57
            if 1 in used_index or 3 in used_index:                
58
                self.ui.label_Img_Vertical_In.setVisible(True)
59
                self.ui.label_Img_Vertical_Out.setVisible(True)
60
                
61
                self.ui.label_Vertical.setVisible(True)
62
                self.ui.lineEdit_Vertical_Pressure.setEnabled(True)                
63
                self.ui.lineEdit_Vertical_Elevation.setEnabled(True)
64

    
65
            if 2 in used_index or 4 in used_index:
66
                self.ui.label_Img_Horizontal_In.setVisible(True)
67
                self.ui.label_Img_Horizontal_Out.setVisible(True)
68
                
69
                self.ui.label_Horizontal.setVisible(True)
70
                self.ui.lineEdit_Horizontal_Pressure.setEnabled(True)
71
                self.ui.lineEdit_Horizontal_Elevation.setEnabled(True)
72

    
73
    def load_units(self):
74
        from Drawing import Drawing
75
        
76
        appDocData = AppDocData.instance()
77
        drawing = appDocData.activeDrawing    
78
        if drawing:
79
            for attr in drawing.attrs:
80
                if attr[0] == 'Units':
81
                    self.ui.label_PressureUnit.setText(attr[1]['Pressure'])
82
                    self.ui.label_ElevationUnit.setText(attr[1]['Length'])
83
                
84
    def accept(self):
85

    
86
        QDialog.accept(self)
87

    
88
    def reject(self):
89
        QDialog.reject(self)
클립보드 이미지 추가 (최대 크기: 500 MB)