개정판 5bcb1a4f
issue #1057 : 스트림 라인의 배관 피팅 갯수 입력
Change-Id: Ib98c98b312c6b394679771b6724c486ae4c536ca
HYTOS/HYTOS/AppDocData.py | ||
---|---|---|
418 | 418 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
419 | 419 |
return res |
420 | 420 |
|
421 |
def getNominalDiameterByUid(self, uid): |
|
422 |
res = [] |
|
423 |
|
|
424 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
425 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
426 |
conn.execute('PRAGMA foreign_keys = ON') |
|
427 |
with conn: |
|
428 |
try: |
|
429 |
# Get a cursor object |
|
430 |
cursor = conn.cursor() |
|
431 |
|
|
432 |
sql = "select UID, Milimeter, Inch, Friction_Factor from NominalDiameter where uid = ?" |
|
433 |
param = (uid,) |
|
434 |
cursor.execute(sql, param) |
|
435 |
rows = cursor.fetchall() |
|
436 |
for row in rows: |
|
437 |
res.append((row[0], row[1], row[2], row[3])) |
|
438 |
# Catch the exception |
|
439 |
except Exception as ex: |
|
440 |
from App import App |
|
441 |
|
|
442 |
# Roll back any change if something goes wrong |
|
443 |
conn.rollback() |
|
444 |
|
|
445 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
446 |
sys.exc_info()[-1].tb_lineno) |
|
447 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
448 |
return res |
|
449 |
|
|
421 | 450 |
def getNominalDiameter(self): |
422 | 451 |
res = [] |
423 | 452 |
|
... | ... | |
775 | 804 |
, Type |
776 | 805 |
, Name |
777 | 806 |
, K |
807 |
, Image |
|
778 | 808 |
from ResistanceCoefficient |
779 | 809 |
where Method = ? |
780 | 810 |
order by rowid""" |
... | ... | |
783 | 813 |
cursor.execute(sql, param) |
784 | 814 |
rows = cursor.fetchall() |
785 | 815 |
for row in rows: |
786 |
res.append((row[0], row[1], row[2], row[3], row[4], row[5])) |
|
816 |
res.append((row[0], row[1], row[2], row[3], row[4], row[5], row[6]))
|
|
787 | 817 |
# Catch the exception |
788 | 818 |
except Exception as ex: |
789 | 819 |
from App import App |
HYTOS/HYTOS/FittingsDialog.py | ||
---|---|---|
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 |
import os |
9 | 9 |
import sys |
10 |
#from PyQt5 import QtCore, QtGui, QtWidgets |
|
11 |
#from PyQt5.QtWidgets import * |
|
12 |
|
|
10 |
# from PyQt5 import QtCore, QtGui, QtWidgets |
|
11 |
# from PyQt5.QtWidgets import * |
|
13 | 12 |
|
13 |
from PyQt5.QtCore import * |
|
14 | 14 |
from PyQt5 import QtCore, QtGui, QtWidgets |
15 | 15 |
from PyQt5.QtCore import pyqtSlot, QRectF |
16 | 16 |
from PyQt5.QtWidgets import * |
... | ... | |
21 | 21 |
import Fittings_UI |
22 | 22 |
import math |
23 | 23 |
|
24 |
|
|
25 |
def set_table_widget_item_properties(name, alignment, color=None): |
|
26 |
item = QTableWidgetItem(str(name)) |
|
27 |
item.setTextAlignment(alignment) |
|
28 |
if color: |
|
29 |
item.setBackground(color) |
|
30 |
|
|
31 |
return item |
|
32 |
|
|
33 |
|
|
24 | 34 |
class QFittingsDialog(QDialog): |
25 | 35 |
def __init__(self): |
26 | 36 |
QDialog.__init__(self) |
27 | 37 |
|
28 | 38 |
self.ui = Fittings_UI.Ui_Dialog() |
29 | 39 |
self.ui.setupUi(self) |
30 |
self.initUnits() |
|
31 | 40 |
|
41 |
self.pipe_diameter_unit = None |
|
32 | 42 |
self.fittings_length = 0 |
43 |
self.nps = 0 |
|
44 |
self.selected_dia_in = 0 |
|
45 |
self.friction_factor = 1 |
|
33 | 46 |
|
34 |
self.ui.lineEdit_Gate_Ball_Plug.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Gate_Ball_Plug)) |
|
35 |
self.ui.lineEdit_Butterfly.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Butterfly)) |
|
36 |
self.ui.lineEdit_90_Elbow.setValidator(QtGui.QIntValidator(self.ui.lineEdit_90_Elbow)) |
|
37 |
self.ui.lineEdit_Tee_Branch.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Tee_Branch)) |
|
38 |
self.ui.lineEdit_Miter.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Miter)) |
|
39 |
self.ui.lineEdit_Globe.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Globe)) |
|
40 |
self.ui.lineEdit_Check.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Check)) |
|
41 |
self.ui.lineEdit_45_Elbow.setValidator(QtGui.QIntValidator(self.ui.lineEdit_45_Elbow)) |
|
42 |
self.ui.lineEdit_Tee_Through.setValidator(QtGui.QIntValidator(self.ui.lineEdit_Tee_Through)) |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
#self.initTableWidgetImage() |
|
47 |
|
|
48 |
self.initialize_EquivalentLength() |
|
49 |
self.initialize_CraneK() |
|
50 |
self.initialize_2K() |
|
51 |
|
|
52 |
self.ui.pushButton_2K_Fitting_90_Elbow.clicked.connect(self.change_2K_selected_fittings) |
|
53 |
self.ui.pushButton_2K_Fitting_45_Elbow.clicked.connect(self.change_2K_selected_fittings) |
|
54 |
self.ui.pushButton_2K_Fitting_180_Elbow.clicked.connect(self.change_2K_selected_fittings) |
|
55 |
self.ui.pushButton_2K_Fitting_Tees.clicked.connect(self.change_2K_selected_fittings) |
|
56 |
self.ui.pushButton_2K_Fitting_Valves.clicked.connect(self.change_2K_selected_fittings) |
|
57 |
self.ui.pushButton_2K_Fitting_Pipe.clicked.connect(self.change_2K_selected_fittings) |
|
58 |
self.ui.pushButton_2K_Fitting_Check_Valves.clicked.connect(self.change_2K_selected_fittings) |
|
59 |
|
|
60 |
self.ui.comboBox_2K_90_Elbow_Bend_Count.currentIndexChanged.connect(self.change_count) |
|
61 |
self.ui.comboBox_2K_90_Elbow_Miter_Count.currentIndexChanged.connect(self.change_count) |
|
62 |
self.ui.comboBox_2K_45_Elbow_Miter_Count.currentIndexChanged.connect(self.change_count) |
|
63 |
self.ui.comboBox_2K_45_Elbow_Bend_Count.currentIndexChanged.connect(self.change_count) |
|
64 |
self.ui.comboBox_2K_180_Elbow_Bend_Count.currentIndexChanged.connect(self.change_count) |
|
65 |
self.ui.comboBox_2K_Tees_Elbow_Count.currentIndexChanged.connect(self.change_count) |
|
66 |
self.ui.comboBox_2K_Tees_Thtough_Count.currentIndexChanged.connect(self.change_count) |
|
67 |
self.ui.comboBox_2K_Valves_Gate_Ball_Plug_Count.currentIndexChanged.connect(self.change_count) |
|
68 |
self.ui.comboBox_2K_Valves_Globe_Count.currentIndexChanged.connect(self.change_count) |
|
69 |
self.ui.comboBox_2K_Valves_Others_Count.currentIndexChanged.connect(self.change_count) |
|
70 |
self.ui.comboBox_2K_Pipe_Count.currentIndexChanged.connect(self.change_count) |
|
71 |
self.ui.comboBox_2K_Check_Valves_Count.currentIndexChanged.connect(self.change_count) |
|
72 |
|
|
73 |
|
|
74 |
self.ui.pushButton_CraneK_Fitting_90_Elbow.clicked.connect(self.change_CraneK_selected_fittings) |
|
75 |
self.ui.pushButton_CraneK_Fitting_45_Elbow.clicked.connect(self.change_CraneK_selected_fittings) |
|
76 |
self.ui.pushButton_CraneK_Fitting_180.clicked.connect(self.change_CraneK_selected_fittings) |
|
77 |
self.ui.pushButton_CraneK_Fitting_Tees.clicked.connect(self.change_CraneK_selected_fittings) |
|
78 |
self.ui.pushButton_CraneK_Fitting_RE.clicked.connect(self.change_CraneK_selected_fittings) |
|
79 |
self.ui.pushButton_CraneK_Fitting_Valves.clicked.connect(self.change_CraneK_selected_fittings) |
|
80 |
self.ui.pushButton_CraneK_Fitting_Pipe.clicked.connect(self.change_CraneK_selected_fittings) |
|
81 |
self.ui.pushButton_CraneK_Fitting_Check_Valves.clicked.connect(self.change_CraneK_selected_fittings) |
|
82 |
self.ui.pushButton_CraneK_Fitting_Manual.clicked.connect(self.change_CraneK_selected_fittings) |
|
83 |
|
|
84 |
|
|
85 |
def initUnits(self): |
|
86 |
activeDrawing = AppDocData.instance().activeDrawing |
|
87 |
|
|
88 |
for attr in activeDrawing.attrs: |
|
47 |
self.init_units() |
|
48 |
self.initialize_equivalent_length() |
|
49 |
self.initialize_crane_k() |
|
50 |
self.initialize_2_k() |
|
51 |
|
|
52 |
def init_units(self): |
|
53 |
active_drawing = AppDocData.instance().activeDrawing |
|
54 |
|
|
55 |
for attr in active_drawing.attrs: |
|
89 | 56 |
if attr[0] == 'Units': |
90 |
self.flowrate_mass_unit = attr[1]['Flowrate_Mass'] |
|
91 |
self.flowrate_volume_unit = attr[1]['Flowrate_Volume'] |
|
92 |
self.density_unit = attr[1]['Density'] |
|
93 |
self.viscosity_unit = attr[1]['Viscosity'] |
|
94 |
self.velocity_unit = attr[1]['Velocity'] |
|
95 |
self.pressure_unit = attr[1]['Pressure'] |
|
96 |
self.length_unit = attr[1]['Length'] |
|
97 |
self.pipe_diameter_unit = attr[1]['Pipe_Diameter'] |
|
98 |
self.roughness_unit = attr[1]['Roughness'] |
|
99 |
self.temperature_unit = attr[1]['Temperature'] |
|
100 |
self.power_unit = attr[1]['Power'] |
|
57 |
self.pipe_diameter_unit = attr[1]['Pipe_Diameter'] |
|
58 |
|
|
59 |
def initialize_equivalent_length(self): |
|
60 |
self.ui.lineEdit_EquivalentLength_Gate_Ball_Plug_Count.setValidator( |
|
61 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Gate_Ball_Plug_Count)) |
|
62 |
self.ui.lineEdit_EquivalentLength_Butterfly_Count.setValidator( |
|
63 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Butterfly_Count)) |
|
64 |
self.ui.lineEdit_EquivalentLength_90_Elbow_Count.setValidator( |
|
65 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_90_Elbow_Count)) |
|
66 |
self.ui.lineEdit_EquivalentLength_Tee_Branch_Count.setValidator( |
|
67 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Tee_Branch_Count)) |
|
68 |
self.ui.lineEdit_EquivalentLength_Miter_Count.setValidator( |
|
69 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Miter_Count)) |
|
70 |
self.ui.lineEdit_EquivalentLength_Globe_Count.setValidator( |
|
71 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Globe_Count)) |
|
72 |
self.ui.lineEdit_EquivalentLength_Check_Count.setValidator( |
|
73 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Check_Count)) |
|
74 |
self.ui.lineEdit_EquivalentLength_45_Elbow_Count.setValidator( |
|
75 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_45_Elbow_Count)) |
|
76 |
self.ui.lineEdit_EquivalentLength_Tee_Through_Count.setValidator( |
|
77 |
QtGui.QIntValidator(self.ui.lineEdit_EquivalentLength_Tee_Through_Count)) |
|
78 |
|
|
79 |
self.ui.comboBox_EquivalentLength_Miter_Degree.clear() |
|
80 |
|
|
81 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('0', 0) |
|
82 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('15', 15) |
|
83 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('30', 30) |
|
84 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('45', 45) |
|
85 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('60', 60) |
|
86 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('75', 75) |
|
87 |
self.ui.comboBox_EquivalentLength_Miter_Degree.addItem('90', 90) |
|
88 |
|
|
89 |
self.ui.comboBox_EquivalentLength_Miter_Degree.setCurrentIndex(0) |
|
90 |
|
|
91 |
def initialize_crane_k(self): |
|
92 |
try: |
|
93 |
self.initialize_crane_k_selected_fitting() |
|
94 |
|
|
95 |
self.ui.label_CraneK_Main_Size_Unit.setText(self.pipe_diameter_unit) |
|
96 |
self.ui.label_CraneK_Sub_Size_Unit.setText(self.pipe_diameter_unit) |
|
97 |
|
|
98 |
self.ui.lineEdit_CraneK_180_Elbow_Standard_Count.setValidator( |
|
99 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_180_Elbow_Standard_Count)) |
|
100 |
self.ui.lineEdit_CraneK_180_Elbow_Bend_Count.setValidator( |
|
101 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_180_Elbow_Bend_Count)) |
|
102 |
self.ui.lineEdit_CraneK_180_Elbow_Miter_Count.setValidator( |
|
103 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_180_Elbow_Miter_Count)) |
|
104 |
self.ui.lineEdit_CraneK_90_Elbow_Standard_Count.setValidator( |
|
105 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_90_Elbow_Standard_Count)) |
|
106 |
self.ui.lineEdit_CraneK_90_Elbow_Bend_Count.setValidator( |
|
107 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_90_Elbow_Bend_Count)) |
|
108 |
self.ui.lineEdit_CraneK_90_Elbow_Miter_Count.setValidator( |
|
109 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_90_Elbow_Miter_Count)) |
|
110 |
self.ui.lineEdit_CraneK_Check_Valves_Swing_Count.setValidator( |
|
111 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Check_Valves_Swing_Count)) |
|
112 |
self.ui.lineEdit_CraneK_Check_Valves_Lift_Count.setValidator( |
|
113 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Check_Valves_Lift_Count)) |
|
114 |
self.ui.lineEdit_CraneK_Check_Valves_Tilting_Count.setValidator( |
|
115 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Check_Valves_Tilting_Count)) |
|
116 |
self.ui.lineEdit_CraneK_Check_Valves_Globe_Stop_Count.setValidator( |
|
117 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Check_Valves_Globe_Stop_Count)) |
|
118 |
self.ui.lineEdit_CraneK_Check_Valves_Angle_Stop_Count.setValidator( |
|
119 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Check_Valves_Angle_Stop_Count)) |
|
120 |
self.ui.lineEdit_CraneK_Pipe_Entrance_Count.setValidator( |
|
121 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Pipe_Entrance_Count)) |
|
122 |
self.ui.lineEdit_CraneK_Pipe_Exit_Count.setValidator( |
|
123 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Pipe_Exit_Count)) |
|
124 |
self.ui.lineEdit_CraneK_Tees_Count.setValidator( |
|
125 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Tees_Count)) |
|
126 |
self.ui.lineEdit_CraneK_45_Elbow_Standard_Count.setValidator( |
|
127 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_45_Elbow_Standard_Count)) |
|
128 |
self.ui.lineEdit_CraneK_45_Elbow_Miter_Count.setValidator( |
|
129 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_45_Elbow_Miter_Count)) |
|
130 |
self.ui.lineEdit_CraneK_Expander_Count.setValidator( |
|
131 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Expander_Count)) |
|
132 |
self.ui.lineEdit_CraneK_Reducer_Count.setValidator( |
|
133 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Reducer_Count)) |
|
134 |
self.ui.lineEdit_CraneK_Manual_Count.setValidator( |
|
135 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Manual_Count)) |
|
136 |
self.ui.lineEdit_CraneK_Valves_Globe_Count.setValidator( |
|
137 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Valves_Globe_Count)) |
|
138 |
self.ui.lineEdit_CraneK_Valves_Plug_Count.setValidator( |
|
139 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Valves_Plug_Count)) |
|
140 |
self.ui.lineEdit_CraneK_Valves_Foot_Count.setValidator( |
|
141 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Valves_Foot_Count)) |
|
142 |
self.ui.lineEdit_CraneK_Valves_Etc_Count.setValidator( |
|
143 |
QtGui.QIntValidator(self.ui.lineEdit_CraneK_Valves_Etc_Count)) |
|
144 |
self.ui.lineEdit_CraneK_Sub_Size.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_CraneK_Sub_Size)) |
|
145 |
self.ui.lineEdit_CraneK_Angle.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_CraneK_Angle)) |
|
146 |
|
|
147 |
self.controls_crane_k_set_names() |
|
148 |
|
|
149 |
# 90 Elbow |
|
150 |
self.ui.pushButton_Add_CraneK_90_Elbow_Standard.clicked.connect(self.add_crane_k) |
|
151 |
self.ui.pushButton_View_CraneK_90_Elbow_Standard.clicked.connect(self.show_crane_k_image) |
|
152 |
self.ui.pushButton_Add_CraneK_90_Elbow_Bend.clicked.connect(self.add_crane_k) |
|
153 |
self.ui.pushButton_View_CraneK_90_Elbow_Bend.clicked.connect(self.show_crane_k_image) |
|
154 |
self.ui.pushButton_Add_CraneK_90_Elbow_Miter.clicked.connect(self.add_crane_k) |
|
155 |
self.ui.pushButton_View_CraneK_90_Elbow_Miter.clicked.connect(self.show_crane_k_image) |
|
156 |
# 45 Elbow |
|
157 |
self.ui.pushButton_Add_CraneK_45_Elbow_Standard.clicked.connect(self.add_crane_k) |
|
158 |
self.ui.pushButton_View_CraneK_45_Elbow_Standard.clicked.connect(self.show_crane_k_image) |
|
159 |
self.ui.pushButton_Add_CraneK_45_Elbow_Miter.clicked.connect(self.add_crane_k) |
|
160 |
self.ui.pushButton_View_CraneK_45_Elbow_Miter.clicked.connect(self.show_crane_k_image) |
|
161 |
# 180 Elbow |
|
162 |
self.ui.pushButton_Add_CraneK_180_Elbow_Standard.clicked.connect(self.add_crane_k) |
|
163 |
self.ui.pushButton_View_CraneK_180_Elbow_Standard.clicked.connect(self.show_crane_k_image) |
|
164 |
self.ui.pushButton_Add_CraneK_180_Elbow_Bend.clicked.connect(self.add_crane_k) |
|
165 |
self.ui.pushButton_View_CraneK_180_Elbow_Bend.clicked.connect(self.show_crane_k_image) |
|
166 |
self.ui.pushButton_Add_CraneK_180_Elbow_Miter.clicked.connect(self.add_crane_k) |
|
167 |
self.ui.pushButton_View_CraneK_180_Elbow_Miter.clicked.connect(self.show_crane_k_image) |
|
168 |
# Tees |
|
169 |
self.ui.pushButton_Add_CraneK_Tees.clicked.connect(self.add_crane_k) |
|
170 |
self.ui.pushButton_View_CraneK_Tees.clicked.connect(self.show_crane_k_image) |
|
171 |
# Reducer & Expander |
|
172 |
self.ui.pushButton_Add_CraneK_Expander.clicked.connect(self.add_crane_k) |
|
173 |
self.ui.pushButton_View_CraneK_Expander.clicked.connect(self.show_crane_k_image) |
|
174 |
self.ui.pushButton_Add_CraneK_Reducer.clicked.connect(self.add_crane_k) |
|
175 |
self.ui.pushButton_View_CraneK_Reducer.clicked.connect(self.show_crane_k_image) |
|
176 |
# Valves |
|
177 |
self.ui.pushButton_Add_CraneK_Valves_Globe.clicked.connect(self.add_crane_k) |
|
178 |
self.ui.pushButton_View_CraneK_Valves_Globe.clicked.connect(self.show_crane_k_image) |
|
179 |
self.ui.pushButton_Add_CraneK_Valves_Plug.clicked.connect(self.add_crane_k) |
|
180 |
self.ui.pushButton_View_CraneK_Valves_Plug.clicked.connect(self.show_crane_k_image) |
|
181 |
self.ui.pushButton_Add_CraneK_Valves_Foot.clicked.connect(self.add_crane_k) |
|
182 |
self.ui.pushButton_View_CraneK_Valves_Foot.clicked.connect(self.show_crane_k_image) |
|
183 |
self.ui.pushButton_Add_CraneK_Valves_Etc.clicked.connect(self.add_crane_k) |
|
184 |
self.ui.pushButton_View_CraneK_Valves_Etc.clicked.connect(self.show_crane_k_image) |
|
185 |
# Pipe |
|
186 |
self.ui.pushButton_Add_CraneK_Pipe_Entrance.clicked.connect(self.add_crane_k) |
|
187 |
self.ui.pushButton_View_CraneK_Pipe_Entrance.clicked.connect(self.show_crane_k_image) |
|
188 |
self.ui.pushButton_Add_CraneK_Pipe_Exit.clicked.connect(self.add_crane_k) |
|
189 |
self.ui.pushButton_View_CraneK_Pipe_Exit.clicked.connect(self.show_crane_k_image) |
|
190 |
# Check Values |
|
191 |
self.ui.pushButton_Add_CraneK_Check_Valves_Swing.clicked.connect(self.add_crane_k) |
|
192 |
self.ui.pushButton_View_CraneK_Check_Valves_Swing.clicked.connect(self.show_crane_k_image) |
|
193 |
self.ui.pushButton_Add_CraneK_Check_Valves_Lift.clicked.connect(self.add_crane_k) |
|
194 |
self.ui.pushButton_View_CraneK_Check_Valves_Lift.clicked.connect(self.show_crane_k_image) |
|
195 |
self.ui.pushButton_Add_CraneK_Check_Valves_Tilting.clicked.connect(self.add_crane_k) |
|
196 |
self.ui.pushButton_View_CraneK_Check_Valves_Tilting.clicked.connect(self.show_crane_k_image) |
|
197 |
self.ui.pushButton_Add_CraneK_Check_Valves_Globe_Stop.clicked.connect(self.add_crane_k) |
|
198 |
self.ui.pushButton_View_CraneK_Check_Valves_Globe_Stop.clicked.connect(self.show_crane_k_image) |
|
199 |
self.ui.pushButton_Add_CraneK_Check_Valves_Angle_Stop.clicked.connect(self.add_crane_k) |
|
200 |
self.ui.pushButton_View_CraneK_Check_Valves_Angle_Stop.clicked.connect(self.show_crane_k_image) |
|
201 |
# Manual K |
|
202 |
self.ui.pushButton_Add_CraneK_Manual.clicked.connect(self.add_crane_k) |
|
203 |
self.ui.pushButton_View_CraneK_Manual.clicked.connect(self.show_crane_k_image) |
|
204 |
|
|
205 |
self.ui.tableWidget_CraneK_SelectedFitting.setContextMenuPolicy(Qt.CustomContextMenu) |
|
206 |
self.ui.tableWidget_CraneK_SelectedFitting.customContextMenuRequested.connect(self.del_crane_k) |
|
207 |
|
|
208 |
except Exception as ex: |
|
209 |
from App import App |
|
210 |
from AppDocData import MessageType |
|
211 |
|
|
212 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
213 |
sys.exc_info()[-1].tb_lineno) |
|
214 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
215 |
|
|
216 |
def del_2_k(self, position): |
|
217 |
try: |
|
218 |
menu = QMenu() |
|
219 |
delete_2_k = menu.addAction(self.tr("Delete")) |
|
220 |
delete_2_k.triggered.connect(lambda: self.delete_2_k_click_event()) |
|
221 |
menu.addAction(delete_2_k) |
|
222 |
|
|
223 |
menu.exec_(self.ui.tableWidget_2K_SelectedFitting.viewport().mapToGlobal(position)) |
|
224 |
except Exception as ex: |
|
225 |
from App import App |
|
226 |
from AppDocData import MessageType |
|
227 |
|
|
228 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
229 |
sys.exc_info()[-1].tb_lineno) |
|
230 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
231 |
|
|
232 |
def del_crane_k(self, position): |
|
233 |
try: |
|
234 |
menu = QMenu() |
|
235 |
delete_crane_k = menu.addAction(self.tr("Delete")) |
|
236 |
delete_crane_k.triggered.connect(lambda: self.delete_crane_k_click_event()) |
|
237 |
menu.addAction(delete_crane_k) |
|
238 |
|
|
239 |
menu.exec_(self.ui.tableWidget_CraneK_SelectedFitting.viewport().mapToGlobal(position)) |
|
240 |
except Exception as ex: |
|
241 |
from App import App |
|
242 |
from AppDocData import MessageType |
|
243 |
|
|
244 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
245 |
sys.exc_info()[-1].tb_lineno) |
|
246 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
247 |
|
|
248 |
def delete_2_k_click_event(self): |
|
249 |
try: |
|
250 |
row = self.ui.tableWidget_2K_SelectedFitting.currentRow() |
|
251 |
uid = self.ui.tableWidget_2K_SelectedFitting.item(row, 0).text() |
|
252 |
find_row = self.find_2_k_data(uid) |
|
253 |
if find_row is not None: |
|
254 |
self.del_2_k_data(find_row) |
|
255 |
except Exception as ex: |
|
256 |
from App import App |
|
257 |
from AppDocData import MessageType |
|
258 |
|
|
259 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
260 |
sys.exc_info()[-1].tb_lineno) |
|
261 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
262 |
|
|
263 |
def delete_crane_k_click_event(self): |
|
264 |
try: |
|
265 |
row = self.ui.tableWidget_CraneK_SelectedFitting.currentRow() |
|
266 |
uid = self.ui.tableWidget_CraneK_SelectedFitting.item(row, 0).text() |
|
267 |
find_row = self.find_crane_k_data(uid) |
|
268 |
if find_row is not None: |
|
269 |
self.del_crane_k_data(find_row) |
|
270 |
except Exception as ex: |
|
271 |
from App import App |
|
272 |
from AppDocData import MessageType |
|
273 |
|
|
274 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
275 |
sys.exc_info()[-1].tb_lineno) |
|
276 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
277 |
|
|
278 |
def show_2_k_image(self): |
|
279 |
try: |
|
280 |
category = None |
|
281 |
# 90 Elbow |
|
282 |
if self.sender() == self.ui.pushButton_View_2K_90_Elbow_Bend: |
|
283 |
category = '90 Elbow' |
|
284 |
image = self.ui.comboBox_2K_90_Elbow_Bend.currentData()[6] |
|
285 |
elif self.sender() == self.ui.pushButton_View_2K_90_Elbow_Miter: |
|
286 |
category = '90 Elbow' |
|
287 |
image = self.ui.comboBox_2K_90_Elbow_Miter.currentData()[6] |
|
288 |
# 45 Elbow |
|
289 |
elif self.sender() == self.ui.pushButton_View_2K_45_Elbow_Bend: |
|
290 |
category = '45 Elbow' |
|
291 |
image = self.ui.comboBox_2K_45_Elbow_Bend.currentData()[6] |
|
292 |
elif self.sender() == self.ui.pushButton_View_2K_45_Elbow_Miter: |
|
293 |
category = '45 Elbow' |
|
294 |
image = self.ui.comboBox_2K_45_Elbow_Miter.currentData()[6] |
|
295 |
# 180 Elbow |
|
296 |
elif self.sender() == self.ui.pushButton_View_2K_180_Elbow_Bend: |
|
297 |
category = '180 Elbow' |
|
298 |
image = self.ui.comboBox_2K_180_Elbow_Bend.currentData()[6] |
|
299 |
# Tees |
|
300 |
elif self.sender() == self.ui.pushButton_View_2K_Tees_Elbow: |
|
301 |
category = 'Tees' |
|
302 |
image = self.ui.comboBox_2K_Tees_Elbow.currentData()[6] |
|
303 |
elif self.sender() == self.ui.pushButton_View_2K_Tees_Through: |
|
304 |
category = 'Tees' |
|
305 |
image = self.ui.comboBox_2K_Tees_Through.currentData()[6] |
|
306 |
# Valves |
|
307 |
elif self.sender() == self.ui.pushButton_View_2K_Valves_Gate_Ball_Plug: |
|
308 |
category = 'Valves' |
|
309 |
image = self.ui.comboBox_2K_Valves_Gate_Ball_Plug.currentData()[6] |
|
310 |
elif self.sender() == self.ui.pushButton_View_2K_Valves_Globe: |
|
311 |
category = 'Valves' |
|
312 |
image = self.ui.comboBox_2K_Valves_Globe.currentData()[6] |
|
313 |
elif self.sender() == self.ui.pushButton_View_2K_Valves_Others: |
|
314 |
category = 'Valves' |
|
315 |
image = self.ui.comboBox_2K_Valves_Others.currentData()[6] |
|
316 |
# Pipe |
|
317 |
elif self.sender() == self.ui.pushButton_View_2K_Pipe: |
|
318 |
category = 'Pipe' |
|
319 |
image = self.ui.comboBox_2K_Pipe.currentData()[6] |
|
320 |
# Check Valves |
|
321 |
elif self.sender() == self.ui.pushButton_View_2K_Check_Valves: |
|
322 |
category = 'Check Valves' |
|
323 |
image = self.ui.comboBox_2K_Check_Valves.currentData()[6] |
|
324 |
|
|
325 |
if category == '90 Elbow': |
|
326 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
327 |
w = self.ui.label_2K_90_Elbow_Img.height() |
|
328 |
h = self.ui.label_2K_90_Elbow_Img.width() |
|
329 |
self.ui.label_2K_90_Elbow_Img.setPixmap( |
|
330 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
331 |
elif category == '45 Elbow': |
|
332 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
333 |
w = self.ui.label_2K_45_Elbow_Img.height() |
|
334 |
h = self.ui.label_2K_45_Elbow_Img.width() |
|
335 |
self.ui.label_2K_45_Elbow_Img.setPixmap( |
|
336 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
337 |
elif category == '180 Elbow': |
|
338 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
339 |
w = self.ui.label_2K_180_Elbow_Img.height() |
|
340 |
h = self.ui.label_2K_180_Elbow_Img.width() |
|
341 |
self.ui.label_2K_180_Elbow_Img.setPixmap( |
|
342 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
343 |
elif category == 'Tees': |
|
344 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
345 |
w = self.ui.label_2K_Tees_Img.height() |
|
346 |
h = self.ui.label_2K_Tees_Img.width() |
|
347 |
self.ui.label_2K_Tees_Img.setPixmap( |
|
348 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
349 |
elif category == 'Valves': |
|
350 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
351 |
w = self.ui.label_2K_Valves_Img.height() |
|
352 |
h = self.ui.label_2K_Valves_Img.width() |
|
353 |
self.ui.label_2K_Valves_Img.setPixmap( |
|
354 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
355 |
elif category == 'Pipe': |
|
356 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
357 |
w = self.ui.label_2K_Pipe_Img.height() |
|
358 |
h = self.ui.label_2K_Pipe_Img.width() |
|
359 |
self.ui.label_2K_Pipe_Img.setPixmap( |
|
360 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
361 |
elif category == 'Check Valves': |
|
362 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
363 |
w = self.ui.label_2K_Check_Valves_Img.height() |
|
364 |
h = self.ui.label_2K_Check_Valves_Img.width() |
|
365 |
self.ui.label_2K_Check_Valves_Img.setPixmap( |
|
366 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
367 |
|
|
368 |
except Exception as ex: |
|
369 |
from App import App |
|
370 |
from AppDocData import MessageType |
|
371 |
|
|
372 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
373 |
sys.exc_info()[-1].tb_lineno) |
|
374 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
375 |
|
|
376 |
def show_crane_k_image(self): |
|
377 |
try: |
|
378 |
category = None |
|
379 |
# 90 Elbow |
|
380 |
if self.sender() == self.ui.pushButton_View_CraneK_90_Elbow_Standard: |
|
381 |
category = '90 Elbow' |
|
382 |
image = self.ui.comboBox_CraneK_90_Elbow_Standard.currentData()[6] |
|
383 |
elif self.sender() == self.ui.pushButton_View_CraneK_90_Elbow_Bend: |
|
384 |
category = '90 Elbow' |
|
385 |
image = self.ui.comboBox_CraneK_90_Elbow_Bend.currentData()[6] |
|
386 |
elif self.sender() == self.ui.pushButton_View_CraneK_90_Elbow_Miter: |
|
387 |
category = '90 Elbow' |
|
388 |
image = self.ui.comboBox_CraneK_90_Elbow_Miter.currentData()[6] |
|
389 |
# 45 Elbow |
|
390 |
elif self.sender() == self.ui.pushButton_View_CraneK_45_Elbow_Standard: |
|
391 |
category = '45 Elbow' |
|
392 |
image = self.ui.comboBox_CraneK_45_Elbow_Standard.currentData()[6] |
|
393 |
elif self.sender() == self.ui.pushButton_View_CraneK_45_Elbow_Miter: |
|
394 |
category = '45 Elbow' |
|
395 |
image = self.ui.comboBox_CraneK_45_Elbow_Miter.currentData()[6] |
|
396 |
# 180 Elbow |
|
397 |
elif self.sender() == self.ui.pushButton_View_CraneK_180_Elbow_Standard: |
|
398 |
category = '180 Elbow' |
|
399 |
image = self.ui.comboBox_CraneK_180_Elbow_Standard.currentData()[6] |
|
400 |
elif self.sender() == self.ui.pushButton_View_CraneK_180_Elbow_Bend: |
|
401 |
category = '180 Elbow' |
|
402 |
image = self.ui.comboBox_CraneK_180_Elbow_Bend.currentData()[6] |
|
403 |
elif self.sender() == self.ui.pushButton_View_CraneK_180_Elbow_Miter: |
|
404 |
category = '180 Elbow' |
|
405 |
image = self.ui.comboBox_CraneK_180_Elbow_Miter.currentData()[6] |
|
406 |
# Tees |
|
407 |
elif self.sender() == self.ui.pushButton_View_CraneK_Tees: |
|
408 |
category = 'Tees' |
|
409 |
image = self.ui.comboBox_CraneK_Tees.currentData()[6] |
|
410 |
# Reducer & Expander |
|
411 |
elif self.sender() == self.ui.pushButton_View_CraneK_Expander: |
|
412 |
category = 'RE' |
|
413 |
image = self.ui.comboBox_CraneK_Expander.currentData()[6] |
|
414 |
elif self.sender() == self.ui.pushButton_View_CraneK_Reducer: |
|
415 |
category = 'RE' |
|
416 |
image = self.ui.comboBox_CraneK_Reducer.currentData()[6] |
|
417 |
# Valves |
|
418 |
elif self.sender() == self.ui.pushButton_View_CraneK_Valves_Globe: |
|
419 |
category = 'Valves' |
|
420 |
image = self.ui.comboBox_CraneK_Valves_Globe.currentData()[6] |
|
421 |
elif self.sender() == self.ui.pushButton_View_CraneK_Valves_Plug: |
|
422 |
category = 'Valves' |
|
423 |
image = self.ui.comboBox_CraneK_Valves_Plug.currentData()[6] |
|
424 |
elif self.sender() == self.ui.pushButton_View_CraneK_Valves_Foot: |
|
425 |
category = 'Valves' |
|
426 |
image = self.ui.comboBox_CraneK_Valves_Foot.currentData()[6] |
|
427 |
elif self.sender() == self.ui.pushButton_View_CraneK_Valves_Etc: |
|
428 |
category = 'Valves' |
|
429 |
image = self.ui.comboBox_CraneK_Valves_Etc.currentData()[6] |
|
430 |
# Pipe |
|
431 |
elif self.sender() == self.ui.pushButton_View_CraneK_Pipe_Entrance: |
|
432 |
category = 'Pipe' |
|
433 |
image = self.ui.comboBox_CraneK_Pipe_Entrance.currentData()[6] |
|
434 |
elif self.sender() == self.ui.pushButton_View_CraneK_Pipe_Exit: |
|
435 |
category = 'Pipe' |
|
436 |
image = self.ui.comboBox_CraneK_Pipe_Exit.currentData()[6] |
|
437 |
# Check Valves |
|
438 |
elif self.sender() == self.ui.pushButton_View_CraneK_Check_Valves_Swing: |
|
439 |
category = 'Check Valves' |
|
440 |
image = self.ui.comboBox_CraneK_Check_Valves_Swing.currentData()[6] |
|
441 |
elif self.sender() == self.ui.pushButton_View_CraneK_Check_Valves_Lift: |
|
442 |
category = 'Check Valves' |
|
443 |
image = self.ui.comboBox_CraneK_Check_Valves_Lift.currentData()[6] |
|
444 |
elif self.sender() == self.ui.pushButton_View_CraneK_Check_Valves_Tilting: |
|
445 |
category = 'Check Valves' |
|
446 |
image = self.ui.comboBox_CraneK_Check_Valves_Tilting.currentData()[6] |
|
447 |
elif self.sender() == self.ui.pushButton_View_CraneK_Check_Valves_Globe_Stop: |
|
448 |
category = 'Check Valves' |
|
449 |
image = self.ui.comboBox_CraneK_Check_Valves_Globe_Stop.currentData()[6] |
|
450 |
elif self.sender() == self.ui.pushButton_View_CraneK_Check_Valves_Angle_Stop: |
|
451 |
category = 'Check Valves' |
|
452 |
image = self.ui.comboBox_CraneK_Check_Valves_Angle_Stop.currentData()[6] |
|
453 |
# Manual K |
|
454 |
elif self.sender() == self.ui.pushButton_View_CraneK_Manual: |
|
455 |
category = 'Manual K' |
|
456 |
image = self.ui.comboBox_CraneK_Manual.currentData()[6] |
|
457 |
|
|
458 |
if category == '90 Elbow': |
|
459 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
460 |
w = self.ui.label_CraneK_90_Elbow_Img.height() |
|
461 |
h = self.ui.label_CraneK_90_Elbow_Img.width() |
|
462 |
self.ui.label_CraneK_90_Elbow_Img.setPixmap( |
|
463 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
464 |
elif category == '45 Elbow': |
|
465 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
466 |
w = self.ui.label_CraneK_45_Elbow_Img.height() |
|
467 |
h = self.ui.label_CraneK_45_Elbow_Img.width() |
|
468 |
self.ui.label_CraneK_45_Elbow_Img.setPixmap( |
|
469 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
470 |
elif category == '180 Elbow': |
|
471 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
472 |
w = self.ui.label_CraneK_180_Elbow_Img.height() |
|
473 |
h = self.ui.label_CraneK_180_Elbow_Img.width() |
|
474 |
self.ui.label_CraneK_180_Elbow_Img.setPixmap( |
|
475 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
476 |
elif category == 'Tees': |
|
477 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
478 |
w = self.ui.label_CraneK_Tees_Img.height() |
|
479 |
h = self.ui.label_CraneK_Tees_Img.width() |
|
480 |
self.ui.label_CraneK_Tees_Img.setPixmap( |
|
481 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
482 |
elif category == 'RE': |
|
483 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
484 |
w = self.ui.label_CraneK_RE_Img.height() |
|
485 |
h = self.ui.label_CraneK_RE_Img.width() |
|
486 |
self.ui.label_CraneK_RE_Img.setPixmap( |
|
487 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
488 |
elif category == 'Valves': |
|
489 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
490 |
w = self.ui.label_CraneK_Valves_Img.height() |
|
491 |
h = self.ui.label_CraneK_Valves_Img.width() |
|
492 |
self.ui.label_CraneK_Valves_Img.setPixmap( |
|
493 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
494 |
elif category == 'Pipe': |
|
495 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
496 |
w = self.ui.label_CraneK_Pipe_Img.height() |
|
497 |
h = self.ui.label_CraneK_Pipe_Img.width() |
|
498 |
self.ui.label_CraneK_Pipe_Img.setPixmap( |
|
499 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
500 |
elif category == 'Check Valves': |
|
501 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
502 |
w = self.ui.label_CraneK_Check_Valves_Img.height() |
|
503 |
h = self.ui.label_CraneK_Check_Valves_Img.width() |
|
504 |
self.ui.label_CraneK_Check_Valves_Img.setPixmap( |
|
505 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
506 |
elif category == 'Manual K': |
|
507 |
picture = QtGui.QPixmap(':/images/{}'.format(image)) |
|
508 |
w = self.ui.label_CraneK_Manual_K_Img.height() |
|
509 |
h = self.ui.label_CraneK_Manual_K_Img.width() |
|
510 |
self.ui.label_CraneK_Manual_K_Img.setPixmap( |
|
511 |
picture.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
512 |
|
|
513 |
except Exception as ex: |
|
514 |
from App import App |
|
515 |
from AppDocData import MessageType |
|
516 |
|
|
517 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
518 |
sys.exc_info()[-1].tb_lineno) |
|
519 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
520 |
|
|
521 |
def add_2_k(self): |
|
522 |
try: |
|
523 |
# 90 Elbow |
|
524 |
if self.sender() == self.ui.pushButton_Add_2K_90_Elbow_Bend: |
|
525 |
count = self.ui.lineEdit_2K_90_Elbow_Bend_Count.text() |
|
526 |
if count.isdigit(): |
|
527 |
data = self.ui.comboBox_2K_90_Elbow_Bend.currentData() |
|
528 |
find_row = self.find_2_k_data(data[0]) |
|
529 |
if find_row is None: |
|
530 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
531 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
532 |
self.add_2_k_data(row, data, count) |
|
533 |
else: |
|
534 |
self.update_2_k_data(find_row, count) |
|
535 |
elif self.sender() == self.ui.pushButton_Add_2K_90_Elbow_Miter: |
|
536 |
count = self.ui.lineEdit_2K_90_Elbow_Miter_Count.text() |
|
537 |
if count.isdigit(): |
|
538 |
data = self.ui.comboBox_2K_90_Elbow_Miter.currentData() |
|
539 |
find_row = self.find_2_k_data(data[0]) |
|
540 |
if find_row is None: |
|
541 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
542 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
543 |
self.add_2_k_data(row, data, count) |
|
544 |
else: |
|
545 |
self.update_2_k_data(find_row, count) |
|
546 |
# 45 Elbow |
|
547 |
elif self.sender() == self.ui.pushButton_Add_2K_45_Elbow_Bend: |
|
548 |
count = self.ui.lineEdit_2K_45_Elbow_Bend_Count.text() |
|
549 |
if count.isdigit(): |
|
550 |
data = self.ui.comboBox_2K_45_Elbow_Bend.currentData() |
|
551 |
find_row = self.find_2_k_data(data[0]) |
|
552 |
if find_row is None: |
|
553 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
554 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
555 |
self.add_2_k_data(row, data, count) |
|
556 |
else: |
|
557 |
self.update_2_k_data(find_row, count) |
|
558 |
elif self.sender() == self.ui.pushButton_Add_2K_45_Elbow_Miter: |
|
559 |
count = self.ui.lineEdit_2K_45_Elbow_Miter_Count.text() |
|
560 |
if count.isdigit(): |
|
561 |
data = self.ui.comboBox_2K_45_Elbow_Miter.currentData() |
|
562 |
find_row = self.find_2_k_data(data[0]) |
|
563 |
if find_row is None: |
|
564 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
565 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
566 |
self.add_2_k_data(row, data, count) |
|
567 |
else: |
|
568 |
self.update_2_k_data(find_row, count) |
|
569 |
# 180 Elbow |
|
570 |
elif self.sender() == self.ui.pushButton_Add_2K_180_Elbow_Bend: |
|
571 |
count = self.ui.lineEdit_2K_180_Elbow_Bend_Count.text() |
|
572 |
if count.isdigit(): |
|
573 |
data = self.ui.comboBox_2K_180_Elbow_Bend.currentData() |
|
574 |
find_row = self.find_2_k_data(data[0]) |
|
575 |
if find_row is None: |
|
576 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
577 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
578 |
self.add_2_k_data(row, data, count) |
|
579 |
else: |
|
580 |
self.update_2_k_data(find_row, count) |
|
581 |
# Tees |
|
582 |
elif self.sender() == self.ui.pushButton_Add_2K_Tees_Elbow: |
|
583 |
count = self.ui.lineEdit_2K_Tees_Elbow_Count.text() |
|
584 |
if count.isdigit(): |
|
585 |
data = self.ui.comboBox_2K_Tees_Elbow.currentData() |
|
586 |
find_row = self.find_2_k_data(data[0]) |
|
587 |
if find_row is None: |
|
588 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
589 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
590 |
self.add_2_k_data(row, data, count) |
|
591 |
else: |
|
592 |
self.update_2_k_data(find_row, count) |
|
593 |
elif self.sender() == self.ui.pushButton_Add_2K_Tees_Through: |
|
594 |
count = self.ui.lineEdit_2K_Tees_Through_Count.text() |
|
595 |
if count.isdigit(): |
|
596 |
data = self.ui.comboBox_2K_Tees_Through.currentData() |
|
597 |
find_row = self.find_2_k_data(data[0]) |
|
598 |
if find_row is None: |
|
599 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
600 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
601 |
self.add_2_k_data(row, data, count) |
|
602 |
else: |
|
603 |
self.update_2_k_data(find_row, count) |
|
604 |
# Valves |
|
605 |
elif self.sender() == self.ui.pushButton_Add_2K_Valves_Gate_Ball_Plug: |
|
606 |
count = self.ui.lineEdit_2K_Valves_Gate_Ball_Plug_Count.text() |
|
607 |
if count.isdigit(): |
|
608 |
data = self.ui.comboBox_2K_Valves_Gate_Ball_Plug.currentData() |
|
609 |
find_row = self.find_2_k_data(data[0]) |
|
610 |
if find_row is None: |
|
611 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
612 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
613 |
self.add_2_k_data(row, data, count) |
|
614 |
else: |
|
615 |
self.update_2_k_data(find_row, count) |
|
616 |
elif self.sender() == self.ui.pushButton_Add_2K_Valves_Globe: |
|
617 |
count = self.ui.lineEdit_2K_Valves_Globe_Count.text() |
|
618 |
if count.isdigit(): |
|
619 |
data = self.ui.comboBox_2K_Valves_Globe.currentData() |
|
620 |
find_row = self.find_2_k_data(data[0]) |
|
621 |
if find_row is None: |
|
622 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
623 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
624 |
self.add_2_k_data(row, data, count) |
|
625 |
else: |
|
626 |
self.update_2_k_data(find_row, count) |
|
627 |
elif self.sender() == self.ui.pushButton_Add_2K_Valves_Others: |
|
628 |
count = self.ui.lineEdit_2K_Valves_Others_Count.text() |
|
629 |
if count.isdigit(): |
|
630 |
data = self.ui.comboBox_2K_Valves_Others.currentData() |
|
631 |
find_row = self.find_2_k_data(data[0]) |
|
632 |
if find_row is None: |
|
633 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
634 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
635 |
self.add_2_k_data(row, data, count) |
|
636 |
else: |
|
637 |
self.update_2_k_data(find_row, count) |
|
638 |
# Pipe |
|
639 |
elif self.sender() == self.ui.pushButton_Add_2K_Pipe: |
|
640 |
count = self.ui.lineEdit_2K_Pipe_Count.text() |
|
641 |
if count.isdigit(): |
|
642 |
data = self.ui.comboBox_2K_Pipe.currentData() |
|
643 |
find_row = self.find_2_k_data(data[0]) |
|
644 |
if find_row is None: |
|
645 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
646 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
647 |
self.add_2_k_data(row, data, count) |
|
648 |
else: |
|
649 |
self.update_2_k_data(find_row, count) |
|
650 |
# Check Valves |
|
651 |
elif self.sender() == self.ui.pushButton_Add_2K_Check_Valves: |
|
652 |
count = self.ui.lineEdit_2K_Check_Valves_Count.text() |
|
653 |
if count.isdigit(): |
|
654 |
data = self.ui.comboBox_2K_Check_Valves.currentData() |
|
655 |
find_row = self.find_2_k_data(data[0]) |
|
656 |
if find_row is None: |
|
657 |
row = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
658 |
self.ui.tableWidget_2K_SelectedFitting.setRowCount(row + 1) |
|
659 |
self.add_2_k_data(row, data, count) |
|
660 |
else: |
|
661 |
self.update_2_k_data(find_row, count) |
|
662 |
except Exception as ex: |
|
663 |
from App import App |
|
664 |
from AppDocData import MessageType |
|
665 |
|
|
666 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
667 |
sys.exc_info()[-1].tb_lineno) |
|
668 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
669 |
|
|
670 |
def add_crane_k(self): |
|
671 |
try: |
|
672 |
# 90 Elbow |
|
673 |
if self.sender() == self.ui.pushButton_Add_CraneK_90_Elbow_Standard: |
|
674 |
count = self.ui.lineEdit_CraneK_90_Elbow_Standard_Count.text() |
|
675 |
if count.isdigit(): |
|
676 |
data = self.ui.comboBox_CraneK_90_Elbow_Standard.currentData() |
|
677 |
find_row = self.find_crane_k_data(data[0]) |
|
678 |
if find_row is None: |
|
679 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
680 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
681 |
self.add_crane_k_data(row, data, count) |
|
682 |
else: |
|
683 |
self.update_crane_k_data(find_row, count) |
|
684 |
elif self.sender() == self.ui.pushButton_Add_CraneK_90_Elbow_Bend: |
|
685 |
count = self.ui.lineEdit_CraneK_90_Elbow_Bend_Count.text() |
|
686 |
if count.isdigit(): |
|
687 |
data = self.ui.comboBox_CraneK_90_Elbow_Bend.currentData() |
|
688 |
find_row = self.find_crane_k_data(data[0]) |
|
689 |
if find_row is None: |
|
690 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
691 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
692 |
self.add_crane_k_data(row, data, count) |
|
693 |
else: |
|
694 |
self.update_crane_k_data(find_row, count) |
|
695 |
elif self.sender() == self.ui.pushButton_Add_CraneK_90_Elbow_Miter: |
|
696 |
count = self.ui.lineEdit_CraneK_90_Elbow_Miter_Count.text() |
|
697 |
if count.isdigit(): |
|
698 |
data = self.ui.comboBox_CraneK_90_Elbow_Miter.currentData() |
|
699 |
find_row = self.find_crane_k_data(data[0]) |
|
700 |
if find_row is None: |
|
701 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
702 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
703 |
self.add_crane_k_data(row, data, count) |
|
704 |
else: |
|
705 |
self.update_crane_k_data(find_row, count) |
|
706 |
# 45 Elbow |
|
707 |
elif self.sender() == self.ui.pushButton_Add_CraneK_45_Elbow_Standard: |
|
708 |
count = self.ui.lineEdit_CraneK_45_Elbow_Standard_Count.text() |
|
709 |
if count.isdigit(): |
|
710 |
data = self.ui.comboBox_CraneK_45_Elbow_Standard.currentData() |
|
711 |
find_row = self.find_crane_k_data(data[0]) |
|
712 |
if find_row is None: |
|
713 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
714 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
715 |
self.add_crane_k_data(row, data, count) |
|
716 |
else: |
|
717 |
self.update_crane_k_data(find_row, count) |
|
718 |
elif self.sender() == self.ui.pushButton_Add_CraneK_45_Elbow_Miter: |
|
719 |
count = self.ui.lineEdit_CraneK_45_Elbow_Miter_Count.text() |
|
720 |
if count.isdigit(): |
|
721 |
data = self.ui.comboBox_CraneK_45_Elbow_Miter.currentData() |
|
722 |
find_row = self.find_crane_k_data(data[0]) |
|
723 |
if find_row is None: |
|
724 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
725 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
726 |
self.add_crane_k_data(row, data, count) |
|
727 |
else: |
|
728 |
self.update_crane_k_data(find_row, count) |
|
729 |
# 180 Elbow |
|
730 |
elif self.sender() == self.ui.pushButton_Add_CraneK_180_Elbow_Standard: |
|
731 |
count = self.ui.lineEdit_CraneK_180_Elbow_Standard_Count.text() |
|
732 |
if count.isdigit(): |
|
733 |
data = self.ui.comboBox_CraneK_180_Elbow_Standard.currentData() |
|
734 |
find_row = self.find_crane_k_data(data[0]) |
|
735 |
if find_row is None: |
|
736 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
737 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
738 |
self.add_crane_k_data(row, data, count) |
|
739 |
else: |
|
740 |
self.update_crane_k_data(find_row, count) |
|
741 |
elif self.sender() == self.ui.pushButton_Add_CraneK_180_Elbow_Bend: |
|
742 |
count = self.ui.lineEdit_CraneK_180_Elbow_Bend_Count.text() |
|
743 |
if count.isdigit(): |
|
744 |
data = self.ui.comboBox_CraneK_180_Elbow_Bend.currentData() |
|
745 |
find_row = self.find_crane_k_data(data[0]) |
|
746 |
if find_row is None: |
|
747 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
748 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
749 |
self.add_crane_k_data(row, data, count) |
|
750 |
else: |
|
751 |
self.update_crane_k_data(find_row, count) |
|
752 |
elif self.sender() == self.ui.pushButton_Add_CraneK_180_Elbow_Miter: |
|
753 |
count = self.ui.lineEdit_CraneK_180_Elbow_Miter_Count.text() |
|
754 |
if count.isdigit(): |
|
755 |
data = self.ui.comboBox_CraneK_180_Elbow_Miter.currentData() |
|
756 |
find_row = self.find_crane_k_data(data[0]) |
|
757 |
if find_row is None: |
|
758 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
759 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
760 |
self.add_crane_k_data(row, data, count) |
|
761 |
else: |
|
762 |
self.update_crane_k_data(find_row, count) |
|
763 |
# Tees |
|
764 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Tees: |
|
765 |
count = self.ui.lineEdit_CraneK_Tees_Count.text() |
|
766 |
if count.isdigit(): |
|
767 |
data = self.ui.comboBox_CraneK_Tees.currentData() |
|
768 |
find_row = self.find_crane_k_data(data[0]) |
|
769 |
if find_row is None: |
|
770 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
771 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
772 |
self.add_crane_k_data(row, data, count) |
|
773 |
else: |
|
774 |
self.update_crane_k_data(find_row, count) |
|
775 |
# Reducer & Expander |
|
776 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Expander: |
|
777 |
count = self.ui.lineEdit_CraneK_Expander_Count.text() |
|
778 |
if count.isdigit(): |
|
779 |
data = self.ui.comboBox_CraneK_Expander.currentData() |
|
780 |
find_row = self.find_crane_k_data(data[0]) |
|
781 |
sub_size = self.ui.lineEdit_CraneK_Sub_Size.text() |
|
782 |
angle = self.ui.lineEdit_CraneK_Angle.text() |
|
783 |
if find_row is None: |
|
784 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
785 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
786 |
self.add_crane_k_data(row, data, count, sub_size, angle) |
|
787 |
else: |
|
788 |
self.update_crane_k_data(find_row, count, sub_size, angle) |
|
789 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Reducer: |
|
790 |
count = self.ui.lineEdit_CraneK_Reducer_Count.text() |
|
791 |
if count.isdigit(): |
|
792 |
data = self.ui.comboBox_CraneK_Reducer.currentData() |
|
793 |
find_row = self.find_crane_k_data(data[0]) |
|
794 |
sub_size = self.ui.lineEdit_CraneK_Sub_Size.text() |
|
795 |
angle = self.ui.lineEdit_CraneK_Angle.text() |
|
796 |
if find_row is None: |
|
797 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
798 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
799 |
self.add_crane_k_data(row, data, count, sub_size, angle) |
|
800 |
else: |
|
801 |
self.update_crane_k_data(find_row, count, sub_size, angle) |
|
802 |
# Valves |
|
803 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Valves_Globe: |
|
804 |
count = self.ui.lineEdit_CraneK_Valves_Globe_Count.text() |
|
805 |
if count.isdigit(): |
|
806 |
data = self.ui.comboBox_CraneK_Valves_Globe.currentData() |
|
807 |
find_row = self.find_crane_k_data(data[0]) |
|
808 |
if find_row is None: |
|
809 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
810 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
811 |
self.add_crane_k_data(row, data, count) |
|
812 |
else: |
|
813 |
self.update_crane_k_data(find_row, count) |
|
814 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Valves_Plug: |
|
815 |
count = self.ui.lineEdit_CraneK_Valves_Plug_Count.text() |
|
816 |
if count.isdigit(): |
|
817 |
data = self.ui.comboBox_CraneK_Valves_Plug.currentData() |
|
818 |
find_row = self.find_crane_k_data(data[0]) |
|
819 |
if find_row is None: |
|
820 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
821 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
822 |
self.add_crane_k_data(row, data, count) |
|
823 |
else: |
|
824 |
self.update_crane_k_data(find_row, count) |
|
825 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Valves_Foot: |
|
826 |
count = self.ui.lineEdit_CraneK_Valves_Foot_Count.text() |
|
827 |
if count.isdigit(): |
|
828 |
data = self.ui.comboBox_CraneK_Valves_Foot.currentData() |
|
829 |
find_row = self.find_crane_k_data(data[0]) |
|
830 |
if find_row is None: |
|
831 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
832 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
833 |
self.add_crane_k_data(row, data, count) |
|
834 |
else: |
|
835 |
self.update_crane_k_data(find_row, count) |
|
836 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Valves_Etc: |
|
837 |
count = self.ui.lineEdit_CraneK_Valves_Etc_Count.text() |
|
838 |
if count.isdigit(): |
|
839 |
data = self.ui.comboBox_CraneK_Valves_Etc.currentData() |
|
840 |
find_row = self.find_crane_k_data(data[0]) |
|
841 |
if find_row is None: |
|
842 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
843 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
844 |
self.add_crane_k_data(row, data, count) |
|
845 |
else: |
|
846 |
self.update_crane_k_data(find_row, count) |
|
847 |
# Pipe |
|
848 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Pipe_Entrance: |
|
849 |
count = self.ui.lineEdit_CraneK_Pipe_Entrance_Count.text() |
|
850 |
if count.isdigit(): |
|
851 |
data = self.ui.comboBox_CraneK_Pipe_Entrance.currentData() |
|
852 |
find_row = self.find_crane_k_data(data[0]) |
|
853 |
if find_row is None: |
|
854 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
855 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
856 |
self.add_crane_k_data(row, data, count) |
|
857 |
else: |
|
858 |
self.update_crane_k_data(find_row, count) |
|
859 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Pipe_Exit: |
|
860 |
count = self.ui.lineEdit_CraneK_Pipe_Exit_Count.text() |
|
861 |
if count.isdigit(): |
|
862 |
data = self.ui.comboBox_CraneK_Pipe_Exit.currentData() |
|
863 |
find_row = self.find_crane_k_data(data[0]) |
|
864 |
if find_row is None: |
|
865 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
866 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
867 |
self.add_crane_k_data(row, data, count) |
|
868 |
else: |
|
869 |
self.update_crane_k_data(find_row, count) |
|
870 |
# Check Values |
|
871 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Check_Valves_Swing: |
|
872 |
count = self.ui.lineEdit_CraneK_Check_Valves_Swing_Count.text() |
|
873 |
if count.isdigit(): |
|
874 |
data = self.ui.comboBox_CraneK_Check_Valves_Swing.currentData() |
|
875 |
find_row = self.find_crane_k_data(data[0]) |
|
876 |
if find_row is None: |
|
877 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
878 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
879 |
self.add_crane_k_data(row, data, count) |
|
880 |
else: |
|
881 |
self.update_crane_k_data(find_row, count) |
|
882 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Check_Valves_Lift: |
|
883 |
count = self.ui.lineEdit_CraneK_Check_Valves_Lift_Count.text() |
|
884 |
if count.isdigit(): |
|
885 |
data = self.ui.comboBox_CraneK_Check_Valves_Lift.currentData() |
|
886 |
find_row = self.find_crane_k_data(data[0]) |
|
887 |
if find_row is None: |
|
888 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
889 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
890 |
self.add_crane_k_data(row, data, count) |
|
891 |
else: |
|
892 |
self.update_crane_k_data(find_row, count) |
|
893 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Check_Valves_Tilting: |
|
894 |
count = self.ui.lineEdit_CraneK_Check_Valves_Tilting_Count.text() |
|
895 |
if count.isdigit(): |
|
896 |
data = self.ui.comboBox_CraneK_Check_Valves_Tilting.currentData() |
|
897 |
find_row = self.find_crane_k_data(data[0]) |
|
898 |
if find_row is None: |
|
899 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
900 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
901 |
self.add_crane_k_data(row, data, count) |
|
902 |
else: |
|
903 |
self.update_crane_k_data(find_row, count) |
|
904 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Check_Valves_Globe_Stop: |
|
905 |
count = self.ui.lineEdit_CraneK_Check_Valves_Globe_Stop_Count.text() |
|
906 |
if count.isdigit(): |
|
907 |
data = self.ui.comboBox_CraneK_Check_Valves_Globe_Stop.currentData() |
|
908 |
find_row = self.find_crane_k_data(data[0]) |
|
909 |
if find_row is None: |
|
910 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
911 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
912 |
self.add_crane_k_data(row, data, count) |
|
913 |
else: |
|
914 |
self.update_crane_k_data(find_row, count) |
|
915 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Check_Valves_Angle_Stop: |
|
916 |
count = self.ui.lineEdit_CraneK_Check_Valves_Angle_Stop_Count.text() |
|
917 |
if count.isdigit(): |
|
918 |
data = self.ui.comboBox_CraneK_Check_Valves_Angle_Stop.currentData() |
|
919 |
find_row = self.find_crane_k_data(data[0]) |
|
920 |
if find_row is None: |
|
921 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
922 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
923 |
self.add_crane_k_data(row, data, count) |
|
924 |
else: |
|
925 |
self.update_crane_k_data(find_row, count) |
|
926 |
# Manual K |
|
927 |
elif self.sender() == self.ui.pushButton_Add_CraneK_Manual: |
|
928 |
count = self.ui.lineEdit_CraneK_Manual_Count.text() |
|
929 |
if count.isdigit(): |
|
930 |
data = self.ui.comboBox_CraneK_Manual.currentData() |
|
931 |
find_row = self.find_crane_k_data(data[0]) |
|
932 |
if find_row is None: |
|
933 |
row = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
934 |
self.ui.tableWidget_CraneK_SelectedFitting.setRowCount(row + 1) |
|
935 |
self.add_crane_k_data(row, data, count) |
|
936 |
else: |
|
937 |
self.update_crane_k_data(find_row, count) |
|
938 |
|
|
939 |
# self.ui.tableWidget_CraneK_SelectedFitting.resizeColumnsToContents() |
|
940 |
self.ui.tableWidget_CraneK_SelectedFitting.resizeRowsToContents() |
|
941 |
# self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setStretchLastSection(True) |
|
942 |
except Exception as ex: |
|
943 |
from App import App |
|
944 |
from AppDocData import MessageType |
|
945 |
|
|
946 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
947 |
sys.exc_info()[-1].tb_lineno) |
|
948 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
949 |
|
|
950 |
def find_2_k_data(self, uid): |
|
951 |
find_row = None |
|
952 |
|
|
953 |
row_count = self.ui.tableWidget_2K_SelectedFitting.rowCount() |
|
954 |
for row in range(row_count): |
|
955 |
if self.ui.tableWidget_2K_SelectedFitting.item(row, 0).text() == uid: |
|
956 |
return row |
|
957 |
|
|
958 |
return find_row |
|
959 |
|
|
960 |
def find_crane_k_data(self, uid): |
|
961 |
find_row = None |
|
962 |
|
|
963 |
row_count = self.ui.tableWidget_CraneK_SelectedFitting.rowCount() |
|
964 |
for row in range(row_count): |
|
965 |
if self.ui.tableWidget_CraneK_SelectedFitting.item(row, 0).text() == uid: |
|
966 |
return row |
|
967 |
|
|
968 |
return find_row |
|
969 |
|
|
970 |
def update_2_k_data(self, row, count): |
|
971 |
try: |
|
972 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 5, set_table_widget_item_properties(count, |
|
973 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
974 |
|
|
975 |
k = self.ui.tableWidget_2K_SelectedFitting.item(row, 6).text() |
|
976 |
|
|
977 |
total_k = '{} x {} = {}'.format(count, float(k), int(count) * float(k)) |
|
978 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 7, set_table_widget_item_properties(total_k, |
|
979 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
980 |
except Exception as ex: |
|
981 |
from App import App |
|
982 |
from AppDocData import MessageType |
|
983 |
|
|
984 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
985 |
sys.exc_info()[-1].tb_lineno) |
|
986 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
101 | 987 |
|
988 |
def update_crane_k_data(self, row, count, sub_size=None, angle=None): |
|
989 |
try: |
|
990 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 5, set_table_widget_item_properties(count, |
|
991 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
992 |
|
|
993 |
if sub_size: |
|
994 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 7, |
|
995 |
set_table_widget_item_properties(sub_size, |
|
996 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
997 |
if angle: |
|
998 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 8, set_table_widget_item_properties(angle, |
|
999 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
1000 |
|
|
1001 |
k = self.ui.tableWidget_CraneK_SelectedFitting.item(row, 9).text() |
|
1002 |
|
|
1003 |
total_k = '{} x {} = {}'.format(count, float(k), int(count) * float(k)) |
|
1004 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 10, set_table_widget_item_properties(total_k, |
|
1005 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1006 |
except Exception as ex: |
|
1007 |
from App import App |
|
1008 |
from AppDocData import MessageType |
|
1009 |
|
|
1010 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1011 |
sys.exc_info()[-1].tb_lineno) |
|
1012 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1013 |
|
|
1014 |
def del_2_k_data(self, row): |
|
1015 |
try: |
|
1016 |
self.ui.tableWidget_2K_SelectedFitting.removeRow(row) |
|
1017 |
except Exception as ex: |
|
1018 |
from App import App |
|
1019 |
from AppDocData import MessageType |
|
1020 |
|
|
1021 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1022 |
sys.exc_info()[-1].tb_lineno) |
|
1023 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
102 | 1024 |
|
1025 |
def del_crane_k_data(self, row): |
|
1026 |
try: |
|
1027 |
self.ui.tableWidget_CraneK_SelectedFitting.removeRow(row) |
|
1028 |
except Exception as ex: |
|
1029 |
from App import App |
|
1030 |
from AppDocData import MessageType |
|
103 | 1031 |
|
104 |
def change_count(self): |
|
105 |
comboBox = self.sender() |
|
1032 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1033 |
sys.exc_info()[-1].tb_lineno) |
|
1034 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
106 | 1035 |
|
107 |
index = comboBox.currentIndex() |
|
108 |
text = comboBox.itemText(index) |
|
1036 |
def add_2_k_data(self, row, data, count): |
|
1037 |
# data[0] = uid |
|
1038 |
# data[1] = method CraneK, 2-K |
|
1039 |
# data[2] = category |
|
1040 |
# data[3] = type |
|
1041 |
# data[4] = name |
|
1042 |
# data[5] = k |
|
1043 |
try: |
|
1044 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 0, set_table_widget_item_properties(data[0], |
|
1045 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1046 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 1, set_table_widget_item_properties(data[1], |
|
1047 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1048 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 2, set_table_widget_item_properties(data[2], |
|
1049 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1050 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 3, set_table_widget_item_properties(data[3], |
|
1051 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1052 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 4, set_table_widget_item_properties(data[4], |
|
1053 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1054 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 5, set_table_widget_item_properties(count, |
|
1055 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
1056 |
k = data[5] |
|
1057 |
|
|
1058 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 6, set_table_widget_item_properties(k, |
|
1059 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1060 |
total_k = '{} x {} = {}'.format(count, k, |
|
1061 |
int(count) * k) |
|
1062 |
self.ui.tableWidget_2K_SelectedFitting.setItem(row, 7, set_table_widget_item_properties(total_k, |
|
1063 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
109 | 1064 |
|
110 |
if text == 'User Input': |
|
111 |
comboBox.setEditable(True) |
|
1065 |
except Exception as ex: |
|
1066 |
from App import App |
|
1067 |
from AppDocData import MessageType |
|
1068 |
|
|
1069 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1070 |
sys.exc_info()[-1].tb_lineno) |
|
1071 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1072 |
|
|
1073 |
def add_crane_k_data(self, row, data, count, sub_size=None, angle=None): |
|
1074 |
# data[0] = uid |
|
1075 |
# data[1] = method CraneK, 2-K |
|
1076 |
# data[2] = category |
|
1077 |
# data[3] = type |
|
1078 |
# data[4] = name |
|
1079 |
# data[5] = k |
|
1080 |
|
|
1081 |
try: |
|
1082 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 0, set_table_widget_item_properties(data[0], |
|
1083 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1084 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 1, set_table_widget_item_properties(data[1], |
|
1085 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1086 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 2, set_table_widget_item_properties(data[2], |
|
1087 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1088 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 3, set_table_widget_item_properties(data[3], |
|
1089 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1090 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 4, set_table_widget_item_properties(data[4], |
|
1091 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1092 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 5, set_table_widget_item_properties(count, |
|
1093 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
1094 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 6, set_table_widget_item_properties(self.nps, |
|
1095 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
1096 |
if sub_size: |
|
1097 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 7, |
|
1098 |
set_table_widget_item_properties(sub_size, |
|
1099 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
1100 |
if angle: |
|
1101 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 8, set_table_widget_item_properties(angle, |
|
1102 |
Qt.AlignHCenter | Qt.AlignVCenter)) |
|
1103 |
k = self.get_crane_k_resistance_coefficient(data[4], data[5], sub_size, angle) |
|
1104 |
|
|
1105 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 9, set_table_widget_item_properties(k, |
|
1106 |
Qt.AlignRight | Qt.AlignVCenter)) |
|
1107 |
total_k = '{} x {} = {}'.format(count, k, |
|
1108 |
int(count) * k) |
|
1109 |
self.ui.tableWidget_CraneK_SelectedFitting.setItem(row, 10, set_table_widget_item_properties(total_k, |
|
1110 |
Qt.AlignLeft | Qt.AlignVCenter)) |
|
1111 |
except Exception as ex: |
|
1112 |
from App import App |
|
1113 |
from AppDocData import MessageType |
|
1114 |
|
|
1115 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1116 |
sys.exc_info()[-1].tb_lineno) |
|
1117 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1118 |
|
|
1119 |
def get_crane_k_resistance_coefficient(self, name, k, sub_size=None, angle=None): |
|
1120 |
if name == 'Butterfly Valve': |
|
1121 |
if self.selected_dia_in <= 8: |
|
1122 |
return self.friction_factor * 45 |
|
1123 |
elif 10 <= self.selected_dia_in <= 14: |
|
1124 |
return self.friction_factor * 35 |
|
1125 |
elif 16 <= self.selected_dia_in: |
|
1126 |
return self.friction_factor * 25 |
|
1127 |
elif name == 'Tilting-disk Check Valve (α=5 ˚)': |
|
1128 |
if self.selected_dia_in <= 8: |
|
1129 |
return self.friction_factor * 40 |
|
1130 |
elif 10 <= self.selected_dia_in <= 14: |
|
1131 |
return self.friction_factor * 30 |
|
1132 |
elif 16 <= self.selected_dia_in: |
|
1133 |
return self.friction_factor * 20 |
|
1134 |
elif name == 'Tilting-disk Check Valve (α=15 ˚)': |
|
1135 |
if self.selected_dia_in <= 8: |
|
1136 |
return self.friction_factor * 120 |
|
1137 |
elif 10 <= self.selected_dia_in <= 14: |
|
1138 |
return self.friction_factor * 90 |
|
1139 |
elif 16 <= self.selected_dia_in: |
|
1140 |
return self.friction_factor * 60 |
|
1141 |
elif name == 'Reducer': |
|
1142 |
# I128 = self.selected_dia_in |
|
1143 |
# J128 = self.friction_factor |
|
1144 |
# J203 = sub_size |
|
1145 |
# K203 = angle |
|
1146 |
# =IF(K203 <= 45, 0.8 * SIN(RADIANS(K203 / 2)) * (1 - (J203 / I128) ^ 2) / (J203 / I128) ^ 4, |
|
1147 |
# 0.5 * (1 - (J203 / I128) ^ 2) * POWER(SIN(RADIANS(K203 / 2)), 0.5) / (J203 / I128) ^ 4) |
|
1148 |
pass |
|
1149 |
elif name == 'Expander': |
|
1150 |
# I128 = self.selected_dia_in |
|
1151 |
# J128 = self.friction_factor |
|
1152 |
# J204 = sub_size |
|
1153 |
# K204 = angle |
|
1154 |
# =IF(K204 <= 45, 2.6 * SIN(RADIANS(K204 / 2)) * (1 - (I128 / J204) ^ 2) ^ 2 / (I128 / J204) ^ 4, |
|
1155 |
# (1 - (I128 / J204) ^ 2) ^ 2 / (I128 / J204) ^ 4) |
|
1156 |
pass |
|
112 | 1157 |
else: |
113 |
comboBox.setEditable(False) |
|
114 |
|
|
115 |
def change_2K_selected_fittings(self): |
|
116 |
self.controls_2K_all_visible(False) |
|
117 |
|
|
118 |
if self.sender() == self.ui.pushButton_2K_Fitting_90_Elbow: |
|
119 |
self.ui.groupBox_2K_90_Elbow.setVisible(True) |
|
120 |
elif self.sender() == self.ui.pushButton_2K_Fitting_45_Elbow: |
|
121 |
self.ui.groupBox_2K_45_Elbow.setVisible(True) |
|
122 |
elif self.sender() == self.ui.pushButton_2K_Fitting_180_Elbow: |
|
123 |
self.ui.groupBox_2K_180_Elbow.setVisible(True) |
|
124 |
elif self.sender() == self.ui.pushButton_2K_Fitting_Tees: |
|
125 |
self.ui.groupBox_2K_Tees.setVisible(True) |
|
126 |
elif self.sender() == self.ui.pushButton_2K_Fitting_Valves: |
|
127 |
self.ui.groupBox_2K_Valves.setVisible(True) |
|
128 |
elif self.sender() == self.ui.pushButton_2K_Fitting_Pipe: |
|
129 |
self.ui.groupBox_2K_Pipe.setVisible(True) |
|
130 |
elif self.sender() == self.ui.pushButton_2K_Fitting_Check_Valves: |
|
131 |
self.ui.groupBox_2K_Check_Valves.setVisible(True) |
|
132 |
|
|
133 |
def change_CraneK_selected_fittings(self): |
|
134 |
self.controls_CraneK_all_visible(False) |
|
135 |
|
|
136 |
if self.sender() == self.ui.pushButton_CraneK_Fitting_90_Elbow: |
|
137 |
self.ui.groupBox_CraneK_90_Elbow.setVisible(True) |
|
138 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_45_Elbow: |
|
139 |
self.ui.groupBox_CraneK_45_Elbow.setVisible(True) |
|
140 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_180: |
|
141 |
self.ui.groupBox_CraneK_180_Elbow.setVisible(True) |
|
142 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_Tees: |
|
143 |
self.ui.groupBox_CraneK_Tees.setVisible(True) |
|
144 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_RE: |
|
145 |
self.ui.groupBox_CraneK_RE.setVisible(True) |
|
146 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_Valves: |
|
147 |
self.ui.groupBox_CraneK_Valves.setVisible(True) |
|
148 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_Pipe: |
|
149 |
self.ui.groupBox_CraneK_Pipe.setVisible(True) |
|
150 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_Check_Valves: |
|
151 |
self.ui.groupBox_CraneK_Check_Valves.setVisible(True) |
|
152 |
elif self.sender() == self.ui.pushButton_CraneK_Fitting_Manual: |
|
153 |
self.ui.groupBox_CraneK_Manual.setVisible(True) |
|
154 |
|
|
155 |
def initTableWidgetImage(self): |
|
156 |
dev = 1 |
|
157 |
#textImage = QtGui.QPixmap(":/images/bend_180.jpg") |
|
158 |
|
|
159 |
|
|
160 |
#w = self.ui.label_Img.height() |
|
161 |
#h = self.ui.label_Img.width() |
|
162 |
#self.ui.label_Img.setPixmap(textImage.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.FastTransformation)) |
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
def initialize_EquivalentLength(self): |
|
167 |
self.ui.comboBox_Degree.clear() |
|
168 |
|
|
169 |
self.ui.comboBox_Degree.addItem('0', 0) |
|
170 |
self.ui.comboBox_Degree.addItem('15', 15) |
|
171 |
self.ui.comboBox_Degree.addItem('30', 30) |
|
172 |
self.ui.comboBox_Degree.addItem('45', 45) |
|
173 |
self.ui.comboBox_Degree.addItem('60', 60) |
|
174 |
self.ui.comboBox_Degree.addItem('75', 75) |
|
175 |
self.ui.comboBox_Degree.addItem('90', 90) |
|
176 |
|
|
177 |
self.ui.comboBox_Degree.setCurrentIndex(0) |
|
178 |
|
|
179 |
def initialize_CraneK(self): |
|
180 |
self.controls_CraneK_all_visible(False) |
|
181 |
self.controls_CraneK_setNames() |
|
182 |
self.controls_CraneK_setCount() |
|
183 |
|
|
184 |
def controls_CraneK_all_visible(self, isVisible): |
|
185 |
self.ui.groupBox_CraneK_90_Elbow.setVisible(isVisible) |
|
186 |
self.ui.groupBox_CraneK_45_Elbow.setVisible(isVisible) |
|
187 |
self.ui.groupBox_CraneK_180_Elbow.setVisible(isVisible) |
|
188 |
self.ui.groupBox_CraneK_Tees.setVisible(isVisible) |
|
189 |
self.ui.groupBox_CraneK_RE.setVisible(isVisible) |
|
190 |
self.ui.groupBox_CraneK_Valves.setVisible(isVisible) |
|
191 |
self.ui.groupBox_CraneK_Pipe.setVisible(isVisible) |
|
192 |
self.ui.groupBox_CraneK_Check_Valves.setVisible(isVisible) |
|
193 |
self.ui.groupBox_CraneK_Manual.setVisible(isVisible) |
|
194 |
|
|
195 |
def controls_CraneK_setNames(self): |
|
1158 |
return k * self.friction_factor |
|
1159 |
|
|
1160 |
def initialize_2_k_selected_fitting(self): |
|
1161 |
self.ui.tableWidget_2K_SelectedFitting.setColumnCount(8) |
|
1162 |
self.ui.tableWidget_2K_SelectedFitting.hideColumn(0) # uid |
|
1163 |
self.ui.tableWidget_2K_SelectedFitting.hideColumn(1) # method |
|
1164 |
# self.ui.tableWidget_2K_SelectedFitting.hideColumn(2) # category |
|
1165 |
# self.ui.tableWidget_2K_SelectedFitting.hideColumn(3) # type |
|
1166 |
self.ui.tableWidget_2K_SelectedFitting.setEditTriggers(QAbstractItemView.NoEditTriggers) |
|
1167 |
|
|
1168 |
col_names = ['UID', 'Method', 'Category', 'Type', 'Name', 'Count', 'K', 'Total K'] |
|
1169 |
self.ui.tableWidget_2K_SelectedFitting.setHorizontalHeaderLabels(col_names) |
|
1170 |
self.ui.tableWidget_2K_SelectedFitting.verticalHeader().setVisible(False) |
|
1171 |
|
|
1172 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setStretchLastSection(True) |
|
1173 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeToContents) |
|
1174 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(1, QHeaderView.ResizeToContents) |
|
1175 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(2, QHeaderView.ResizeToContents) |
|
1176 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(3, QHeaderView.ResizeToContents) |
|
1177 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(4, QHeaderView.ResizeToContents) |
|
1178 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(5, QHeaderView.ResizeToContents) |
|
1179 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(6, QHeaderView.ResizeToContents) |
|
1180 |
self.ui.tableWidget_2K_SelectedFitting.horizontalHeader().setSectionResizeMode(7, QHeaderView.ResizeToContents) |
|
1181 |
|
|
1182 |
def initialize_crane_k_selected_fitting(self): |
|
1183 |
self.ui.tableWidget_CraneK_SelectedFitting.setColumnCount(11) |
|
1184 |
self.ui.tableWidget_CraneK_SelectedFitting.hideColumn(0) # uid |
|
1185 |
self.ui.tableWidget_CraneK_SelectedFitting.hideColumn(1) # method |
|
1186 |
# self.ui.tableWidget_CraneK_SelectedFitting.hideColumn(2) # category |
|
1187 |
# self.ui.tableWidget_CraneK_SelectedFitting.hideColumn(3) # type |
|
1188 |
self.ui.tableWidget_CraneK_SelectedFitting.setEditTriggers(QAbstractItemView.NoEditTriggers) |
|
1189 |
|
|
1190 |
col_names = ['UID', 'Method', 'Category', 'Type', 'Name', 'Count', 'Size(M)', 'Size(S)', 'Angle', 'K', |
|
1191 |
'Total K'] |
|
1192 |
self.ui.tableWidget_CraneK_SelectedFitting.setHorizontalHeaderLabels(col_names) |
|
1193 |
self.ui.tableWidget_CraneK_SelectedFitting.verticalHeader().setVisible(False) |
|
1194 |
|
|
1195 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setStretchLastSection(True) |
|
1196 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(0, |
|
1197 |
QHeaderView.ResizeToContents) |
|
1198 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(1, |
|
1199 |
QHeaderView.ResizeToContents) |
|
1200 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(2, |
|
1201 |
QHeaderView.ResizeToContents) |
|
1202 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(3, |
|
1203 |
QHeaderView.ResizeToContents) |
|
1204 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(4, |
|
1205 |
QHeaderView.ResizeToContents) |
|
1206 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(5, |
|
1207 |
QHeaderView.ResizeToContents) |
|
1208 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(6, |
|
1209 |
QHeaderView.ResizeToContents) |
|
1210 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(7, |
|
1211 |
QHeaderView.ResizeToContents) |
|
1212 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(8, |
|
1213 |
QHeaderView.ResizeToContents) |
|
1214 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(9, |
|
1215 |
QHeaderView.ResizeToContents) |
|
1216 |
self.ui.tableWidget_CraneK_SelectedFitting.horizontalHeader().setSectionResizeMode(10, |
|
1217 |
QHeaderView.ResizeToContents) |
|
1218 |
|
|
1219 |
def controls_crane_k_set_names(self): |
|
196 | 1220 |
from AppDocData import AppDocData |
197 | 1221 |
|
198 |
resistanceCoefficientList = AppDocData.instance().getResistanceCoefficientByMethod('CraneK')
|
|
199 |
for resistanceCoefficient in resistanceCoefficientList:
|
|
1222 |
resistance_coefficient_list = AppDocData.instance().getResistanceCoefficientByMethod('CraneK')
|
|
1223 |
for resistanceCoefficient in resistance_coefficient_list:
|
|
200 | 1224 |
category = resistanceCoefficient[2] |
201 | 1225 |
type = resistanceCoefficient[3] |
202 | 1226 |
name = resistanceCoefficient[4] |
... | ... | |
220 | 1244 |
self.ui.comboBox_CraneK_180_Elbow_Bend.addItem(name, resistanceCoefficient) |
221 | 1245 |
elif type == 'Miter': |
222 | 1246 |
self.ui.comboBox_CraneK_180_Elbow_Miter.addItem(name, resistanceCoefficient) |
223 |
elif category == 'Tee': |
|
1247 |
elif category == 'Tees':
|
|
224 | 1248 |
if type == 'Standard': |
225 | 1249 |
self.ui.comboBox_CraneK_Tees.addItem(name, resistanceCoefficient) |
226 | 1250 |
elif category == 'Reducer/Expander': |
... | ... | |
228 | 1252 |
self.ui.comboBox_CraneK_Reducer.addItem(name, resistanceCoefficient) |
229 | 1253 |
elif type == 'Expander': |
230 | 1254 |
self.ui.comboBox_CraneK_Expander.addItem(name, resistanceCoefficient) |
231 |
elif category == 'Etc Valve': |
|
1255 |
elif category == 'Etc Valves':
|
|
232 | 1256 |
if type == 'Etc': |
233 | 1257 |
self.ui.comboBox_CraneK_Valves_Etc.addItem(name, resistanceCoefficient) |
234 |
elif category == 'Foot Valve': |
|
1258 |
elif category == 'Foot Valves':
|
|
235 | 1259 |
if type == 'Foot': |
236 | 1260 |
self.ui.comboBox_CraneK_Valves_Foot.addItem(name, resistanceCoefficient) |
237 |
elif category == 'Globe Valve': |
|
1261 |
elif category == 'Globe Valves':
|
|
238 | 1262 |
if type == 'Globe': |
239 | 1263 |
self.ui.comboBox_CraneK_Valves_Globe.addItem(name, resistanceCoefficient) |
240 | 1264 |
elif category == 'Manual': |
... | ... | |
245 | 1269 |
self.ui.comboBox_CraneK_Pipe_Entrance.addItem(name, resistanceCoefficient) |
246 | 1270 |
elif type == 'Exit': |
247 | 1271 |
self.ui.comboBox_CraneK_Pipe_Exit.addItem(name, resistanceCoefficient) |
248 |
elif category == 'Plug Valve': |
|
1272 |
elif category == 'Plug Valves':
|
|
249 | 1273 |
if type == 'Plug': |
250 | 1274 |
self.ui.comboBox_CraneK_Valves_Plug.addItem(name, resistanceCoefficient) |
251 |
elif category == 'Check Valve': |
|
1275 |
elif category == 'Check Valves':
|
|
252 | 1276 |
if type == 'Swing': |
253 | 1277 |
self.ui.comboBox_CraneK_Check_Valves_Swing.addItem(name, resistanceCoefficient) |
254 | 1278 |
elif type == 'Lift': |
... | ... | |
260 | 1284 |
elif type == 'Angled Stop': |
261 | 1285 |
self.ui.comboBox_CraneK_Check_Valves_Angle_Stop.addItem(name, resistanceCoefficient) |
262 | 1286 |
|
263 |
def controls_CraneK_setCount(self): |
|
264 |
count = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'User Input'] |
|
265 |
for i in count: |
|
266 |
self.ui.comboBox_CraneK_90_Elbow_Standard_Count.addItem(str(i)) |
|
267 |
self.ui.comboBox_CraneK_90_Elbow_Bend_Count.addItem(str(i)) |
|
268 |
self.ui.comboBox_CraneK_90_Elbow_Miter_Count.addItem(str(i)) |
|
269 |
self.ui.comboBox_CraneK_45_Elbow_Miter_Count.addItem(str(i)) |
|
270 |
self.ui.comboBox_CraneK_45_Elbow_Standard_Count.addItem(str(i)) |
|
271 |
self.ui.comboBox_CraneK_180_Elbow_Standard_Count.addItem(str(i)) |
|
272 |
self.ui.comboBox_CraneK_180_Elbow_Bend_Count.addItem(str(i)) |
내보내기 Unified diff