프로젝트

일반

사용자정보

개정판 c46ad1e0

IDc46ad1e0229b61e5727cb50fd08fd2777e1c06a7
상위 638dd2dd
하위 3c797715

김연진이(가) 약 5년 전에 추가함

issue #1053 : 장치의 Tag No. 표기

Change-Id: I36ca926ad7b3e2384f7adf337115693f2a509e79

차이점 보기:

HYTOS/HYTOS/Coil.py
13 13
import Coil_UI
14 14
import math
15 15

  
16

  
17
def is_not_blank(s):
18
    return bool(s and s.strip())
19

  
20

  
16 21
class QCoil(QDialog):
17 22
    def __init__(self):
18 23
        QDialog.__init__(self)
19 24

  
20 25
        self.ui = Coil_UI.Ui_CoilDialog()
21 26
        self.ui.setupUi(self)
27
        self._item = None
28

  
22 29
        self.ui.lineEdit_Pressure_Drop.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_Pressure_Drop))
23 30
        self.ui.lineEdit_Elevation.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_Elevation))
24 31
        self.initialize()
25
        
26
        
27
    def showDialog(self, item):
32

  
33
    def show_dialog(self, item):
28 34
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
29 35
        self._item = item
30 36

  
31 37
        self.ui.lineEdit_TagNo.setFocus()
32
        self.set_controls(item)
38
        self.set_controls()
33 39
        self.load_data()
34 40

  
35 41
        return self.exec_()
......
37 43
    def initialize(self):
38 44
        self.ui.label_Img.setVisible(False)
39 45

  
40
    def set_controls(self, item):    
46
    def set_controls(self):
41 47
        self.ui.label_Img.setVisible(True)
42 48

  
43 49
    def load_data(self):
44 50
        """ load tag no and nozzle data """
45 51
        from Drawing import Drawing
46
        
52
        self.ui.lineEdit_TagNo.setText(self._item.tag_no)
53

  
47 54
        appDocData = AppDocData.instance()
48
        drawing = appDocData.activeDrawing    
55
        drawing = appDocData.activeDrawing
49 56
        if drawing:
50 57
            for attr in drawing.attrs:
51 58
                if attr[0] == 'Units':
......
55 62
        matches = [connector.data for connector in self._item.connectors if connector.data]
56 63
        if matches:
57 64
            pressure_drop = matches[0].pressure_drop
58
            if pressure_drop:                
65
            if pressure_drop:
59 66
                self.ui.lineEdit_Pressure_Drop.setText(str(pressure_drop))
60 67

  
61 68
            elevation = matches[0].elevation
62 69
            if elevation:
63 70
                self.ui.lineEdit_Elevation.setText(str(elevation))
64
             
71

  
65 72
    def accept(self):
66 73
        """ set tag no and nozzle data """
67 74
        from EngineeringConnectorItem import NozzleData
75
        tag_no = self.ui.lineEdit_TagNo.text()
68 76

  
69
        for connector in self._item.connectors:
70
            if not connector.data: 
71
                connector.data = NozzleData()
77
        if is_not_blank(tag_no):
78
            self._item.tag_no = tag_no
79
            for connector in self._item.connectors:
80
                if not connector.data:
81
                    connector.data = NozzleData()
72 82

  
73
            pressure_drop = self.ui.lineEdit_Pressure_Drop.text()
74
            if pressure_drop:
75
                connector.data.pressure_drop = float(pressure_drop)    
76
            else: 
77
                connector.data.pressure_drop = None
83
                pressure_drop = self.ui.lineEdit_Pressure_Drop.text()
84
                if pressure_drop:
85
                    connector.data.pressure_drop = float(pressure_drop)
86
                else:
87
                    connector.data.pressure_drop = None
78 88

  
79
            elevation = self.ui.lineEdit_Elevation.text()
80
            if elevation:
81
                connector.data.elevation = float(elevation)  
82
            else:
83
                connector.data.elevation = None
84
                
85
        QDialog.accept(self)
89
                elevation = self.ui.lineEdit_Elevation.text()
90
                if elevation:
91
                    connector.data.elevation = float(elevation)
92
                else:
93
                    connector.data.elevation = None
94

  
95
            QDialog.accept(self)
96
        else:
97
            QMessageBox.warning(self, self.tr('Notice'), self.tr('Please Input [Tag No.]'))
86 98

  
87 99
    def reject(self):
88
        QDialog.reject(self)
100
        QDialog.reject(self)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)