-
Notifications
You must be signed in to change notification settings - Fork 0
/
xflr5_to_xrotor.py
97 lines (85 loc) · 3.85 KB
/
xflr5_to_xrotor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import sys
from PyQt5 import QtWidgets, uic
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas,NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
# UIデザイン
from UI_py.mainwindow import Ui_MainWindow
from UI_py.aero_section_tab import Ui_section
from UI_py.error_dialog import Ui_error_dialog
# スロット
from Slot.slot_mainwindow import Slot_MainWindow
from Slot.slot_section import Slot_Section
from Slot.slot_errorDialog import Slot_ErrorDialog
# エラーメッセージダイアログ
class ErrorDialog(QtWidgets.QDialog, Ui_error_dialog, Slot_ErrorDialog):
def __init__(self, *args, obj=None, **kwargs):
super(ErrorDialog, self).__init__(*args, **kwargs)
# グラフ描画クラス
class MplCanvas(FigureCanvas):
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes1 = fig.add_subplot(121)
self.axes2 = fig.add_subplot(122)
super(MplCanvas, self).__init__(fig)
self.plotted_line1 = None
self.plotted_scatter1 = None
self.plotted_scatter2 = None
self.plotted_line2_1 = None
self.plotted_line2_2 = None
# タブの要素
class TabSection(QtWidgets.QTabWidget, Ui_section, Slot_Section):
def __init__(self, *args, obj=None, **kwargs):
super(TabSection, self).__init__(*args, **kwargs)
self.polar_file = ''
self.zero_lift_alpha = 0
self.dcl_dalpha = 0
self.dcl_dalpha_stall = 0
self.max_cl = 0
self.min_cl = 0
self.cl_increment_to_stall = 0
self.min_cd = 0
self.cl_at_min_cd = 0
self.dcd_ddcl = 0
self.re = 0
self.r_R = 0
self.setupUi(self)
self.connectSlot()
# グラフ描画部分
self.canvas = MplCanvas(self, width=5, height=4, dpi=100)
toolbar = NavigationToolbar(self.canvas, self)
layout = QtWidgets.QGridLayout()
layout.addWidget(toolbar)
layout.addWidget(self.canvas)
self.aero_graph.setLayout(layout)
# シグナルをスロットに接続
def connectSlot(self):
self.import_aero_buttom_2.clicked.connect(self.importPolar)
self.import_aero_buttom_2.clicked.connect(self.CalculateModel)
self.input_aerofile_path_lineEdit.editingFinished.connect(self.getLineInputs)
self.zero_lift_alpha_lineEdit.editingFinished.connect(self.getLineInputs)
self.dcl_dalpha_lineEdit.editingFinished.connect(self.getLineInputs)
self.dcl_dalpha_at_stall_lineEdit.editingFinished.connect(self.getLineInputs)
self.max_cl_lineEdit.editingFinished.connect(self.getLineInputs)
self.min_cl_lineEdit.editingFinished.connect(self.getLineInputs)
self.cl_increment_to_stall_lineEdit.editingFinished.connect(self.getLineInputs)
self.min_cd_lineEdit.editingFinished.connect(self.getLineInputs)
self.cl_at_min_cd_lineEdit.editingFinished.connect(self.getLineInputs)
self.re_lineEdit.editingFinished.connect(self.getLineInputs)
self.dcd_ddcl_lineEdit.editingFinished.connect(self.getLineInputs)
self.r_R_lineEdit.editingFinished.connect(self.getLineInputs)
# メインウィンドウ
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, Slot_MainWindow):
def __init__(self, *args, obj=None, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setupUi(self)
self.connectSlot()
# シグナルをスロットに接続
def connectSlot(self):
self.add_section_button.clicked.connect(lambda x : self.addSection(TabSection))
self.delete_section_button.clicked.connect(self.delSection)
self.build_button.clicked.connect(self.build)
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()