-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
50 lines (38 loc) · 1.33 KB
/
main.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
# MAE 3403 PyDuct Design Project
# 5/5/17
# Charlie Johnson
# Nick Nelsen
# Stephen Ziske
# github.com/TunaLobster/pyduct
import sys
from PyQt5.QtWidgets import QDialog, QApplication
from PyQt5.QtWidgets import QFileDialog
from pyduct import calculate
from pyduct_ui import Ui_Dialog
class main_window(QDialog):
def __init__(self):
super(main_window, self).__init__()
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.assign_widgets()
self.show()
# Setup Callbacks for all buttons or other clickable devices
def assign_widgets(self):
self.ui.pushButton.clicked.connect(self.getFileName)
self.ui.buttonBox.accepted.connect(self.runPyduct)
self.ui.buttonBox.rejected.connect(self.ExitApp)
def getFileName(self): # Get file from user
filename = QFileDialog.getOpenFileName()
self.ui.lineEdit.setText(str(filename[0]))
def runPyduct(self):
print('Running...') # Says the program is running
calculate(str(self.ui.lineEdit.text())) # Runs pyduct.py and gets all the values, then prints them
def ExitApp(self):
app.exit()
if __name__ == "__main__":
app = QApplication.instance()
if not app:
app = QApplication(sys.argv)
app.aboutToQuit.connect(app.deleteLater)
main_win = main_window()
app.exec_()