hytos / HYTOS / HYTOS / Equipment.py @ e534f39d
이력 | 보기 | 이력해설 | 다운로드 (7.74 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 Equipment_UI |
15 |
import math |
16 |
|
17 |
class QEquipment(QDialog): |
18 |
def __init__(self): |
19 |
QDialog.__init__(self)
|
20 |
|
21 |
self.ui = Equipment_UI.Ui_EquipmentDialog()
|
22 |
self.ui.setupUi(self) |
23 |
self.initialize()
|
24 |
|
25 |
def showDialog(self, item): |
26 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
27 |
|
28 |
self.ui.lineEdit_TagNo.setFocus()
|
29 |
self.set_controls(item)
|
30 |
self.load_units()
|
31 |
|
32 |
self.exec_()
|
33 |
|
34 |
def initialize(self): |
35 |
# To do : 이름으로 Control 찾아오기
|
36 |
self.ui.label_Img_N1.setVisible(False) |
37 |
self.ui.label_Img_N2.setVisible(False) |
38 |
self.ui.label_Img_N3.setVisible(False) |
39 |
self.ui.label_Img_N4.setVisible(False) |
40 |
self.ui.label_Img_N5.setVisible(False) |
41 |
self.ui.label_Img_N6.setVisible(False) |
42 |
self.ui.label_Img_N7.setVisible(False) |
43 |
self.ui.label_Img_N8.setVisible(False) |
44 |
self.ui.label_Img_N9.setVisible(False) |
45 |
self.ui.label_Img_N10.setVisible(False) |
46 |
self.ui.label_Img_N11.setVisible(False) |
47 |
self.ui.label_Img_N12.setVisible(False) |
48 |
|
49 |
self.ui.label_N1.setVisible(False) |
50 |
self.ui.lineEdit_N1_Pressure.setEnabled(False) |
51 |
self.ui.lineEdit_N1_Elevation.setEnabled(False) |
52 |
|
53 |
self.ui.label_N2.setVisible(False) |
54 |
self.ui.lineEdit_N2_Pressure.setEnabled(False) |
55 |
self.ui.lineEdit_N2_Elevation.setEnabled(False) |
56 |
|
57 |
self.ui.label_N3.setVisible(False) |
58 |
self.ui.lineEdit_N3_Pressure.setEnabled(False) |
59 |
self.ui.lineEdit_N3_Elevation.setEnabled(False) |
60 |
|
61 |
self.ui.label_N4.setVisible(False) |
62 |
self.ui.lineEdit_N4_Pressure.setEnabled(False) |
63 |
self.ui.lineEdit_N4_Elevation.setEnabled(False) |
64 |
|
65 |
self.ui.label_N5.setVisible(False) |
66 |
self.ui.lineEdit_N5_Pressure.setEnabled(False) |
67 |
self.ui.lineEdit_N5_Elevation.setEnabled(False) |
68 |
|
69 |
self.ui.label_N6.setVisible(False) |
70 |
self.ui.lineEdit_N6_Pressure.setEnabled(False) |
71 |
self.ui.lineEdit_N6_Elevation.setEnabled(False) |
72 |
|
73 |
self.ui.label_N7.setVisible(False) |
74 |
self.ui.lineEdit_N7_Pressure.setEnabled(False) |
75 |
self.ui.lineEdit_N7_Elevation.setEnabled(False) |
76 |
|
77 |
self.ui.label_N8.setVisible(False) |
78 |
self.ui.lineEdit_N8_Pressure.setEnabled(False) |
79 |
self.ui.lineEdit_N8_Elevation.setEnabled(False) |
80 |
|
81 |
self.ui.label_N9.setVisible(False) |
82 |
self.ui.lineEdit_N9_Pressure.setEnabled(False) |
83 |
self.ui.lineEdit_N9_Elevation.setEnabled(False) |
84 |
|
85 |
self.ui.label_N10.setVisible(False) |
86 |
self.ui.lineEdit_N10_Pressure.setEnabled(False) |
87 |
self.ui.lineEdit_N10_Elevation.setEnabled(False) |
88 |
|
89 |
self.ui.label_N11.setVisible(False) |
90 |
self.ui.lineEdit_N11_Pressure.setEnabled(False) |
91 |
self.ui.lineEdit_N11_Elevation.setEnabled(False) |
92 |
|
93 |
self.ui.label_N12.setVisible(False) |
94 |
self.ui.lineEdit_N12_Pressure.setEnabled(False) |
95 |
self.ui.lineEdit_N12_Elevation.setEnabled(False) |
96 |
|
97 |
def set_controls(self, item): |
98 |
# To do : 이름으로 Control 찾아오기
|
99 |
for connector in item.connectors: |
100 |
index = connector._conn_index |
101 |
if connector.connectedItem:
|
102 |
if index == 1: |
103 |
self.ui.label_Img_N1.setVisible(True) |
104 |
self.ui.label_N1.setVisible(True) |
105 |
self.ui.lineEdit_N1_Pressure.setEnabled(True) |
106 |
self.ui.lineEdit_N1_Elevation.setEnabled(True) |
107 |
elif index == 2: |
108 |
self.ui.label_Img_N2.setVisible(True) |
109 |
self.ui.label_N2.setVisible(True) |
110 |
self.ui.lineEdit_N2_Pressure.setEnabled(True) |
111 |
self.ui.lineEdit_N2_Elevation.setEnabled(True) |
112 |
elif index == 3: |
113 |
self.ui.label_Img_N3.setVisible(True) |
114 |
self.ui.label_N3.setVisible(True) |
115 |
self.ui.lineEdit_N3_Pressure.setEnabled(True) |
116 |
self.ui.lineEdit_N3_Elevation.setEnabled(True) |
117 |
elif index == 4: |
118 |
self.ui.label_Img_N4.setVisible(True) |
119 |
self.ui.label_N4.setVisible(True) |
120 |
self.ui.lineEdit_N4_Pressure.setEnabled(True) |
121 |
self.ui.lineEdit_N4_Elevation.setEnabled(True) |
122 |
elif index == 5: |
123 |
self.ui.label_Img_N5.setVisible(True) |
124 |
self.ui.label_N5.setVisible(True) |
125 |
self.ui.lineEdit_N5_Pressure.setEnabled(True) |
126 |
self.ui.lineEdit_N5_Elevation.setEnabled(True) |
127 |
elif index == 6: |
128 |
self.ui.label_Img_N6.setVisible(True) |
129 |
self.ui.label_N6.setVisible(True) |
130 |
self.ui.lineEdit_N6_Pressure.setEnabled(True) |
131 |
self.ui.lineEdit_N6_Elevation.setEnabled(True) |
132 |
elif index == 7: |
133 |
self.ui.label_Img_N7.setVisible(True) |
134 |
self.ui.label_N7.setVisible(True) |
135 |
self.ui.lineEdit_N7_Pressure.setEnabled(True) |
136 |
self.ui.lineEdit_N7_Elevation.setEnabled(True) |
137 |
elif index == 8: |
138 |
self.ui.label_Img_N8.setVisible(True) |
139 |
self.ui.label_N8.setVisible(True) |
140 |
self.ui.lineEdit_N8_Pressure.setEnabled(True) |
141 |
self.ui.lineEdit_N8_Elevation.setEnabled(True) |
142 |
elif index == 9: |
143 |
self.ui.label_Img_N9.setVisible(True) |
144 |
self.ui.label_N9.setVisible(True) |
145 |
self.ui.lineEdit_N9_Pressure.setEnabled(True) |
146 |
self.ui.lineEdit_N9_Elevation.setEnabled(True) |
147 |
elif index == 10: |
148 |
self.ui.label_Img_N10.setVisible(True) |
149 |
self.ui.label_N10.setVisible(True) |
150 |
self.ui.lineEdit_N10_Pressure.setEnabled(True) |
151 |
self.ui.lineEdit_N10_Elevation.setEnabled(True) |
152 |
elif index == 11: |
153 |
self.ui.label_Img_N11.setVisible(True) |
154 |
self.ui.label_N11.setVisible(True) |
155 |
self.ui.lineEdit_N11_Pressure.setEnabled(True) |
156 |
self.ui.lineEdit_N11_Elevation.setEnabled(True) |
157 |
elif index == 12: |
158 |
self.ui.label_Img_N12.setVisible(True) |
159 |
self.ui.label_N12.setVisible(True) |
160 |
self.ui.lineEdit_N12_Pressure.setEnabled(True) |
161 |
self.ui.lineEdit_N12_Elevation.setEnabled(True) |
162 |
|
163 |
def load_units(self): |
164 |
from Drawing import Drawing |
165 |
|
166 |
appDocData = AppDocData.instance() |
167 |
drawing = appDocData.activeDrawing |
168 |
if drawing:
|
169 |
for attr in drawing.attrs: |
170 |
if attr[0] == 'Units': |
171 |
self.ui.label_PressureUnit.setText(attr[1]['Pressure']) |
172 |
self.ui.label_ElevationUnit.setText(attr[1]['Length']) |
173 |
|
174 |
def accept(self): |
175 |
|
176 |
QDialog.accept(self)
|
177 |
|
178 |
def reject(self): |
179 |
QDialog.reject(self)
|