-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (29 loc) · 1.13 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
import sys
import matplotlib
# Make sure that we are using Qt5
matplotlib.use('Qt5Agg')
from mainWindow import *
# Back up the reference to the exceptionhook
sys._excepthook = sys.excepthook
# Exception hook is used to print out the exception
# This is necessary for Qt 5 applications because Qt uses an event loop which will not trigger a traceback
def my_exception_hook(exctype, value, traceback):
# Print the error and traceback
print(exctype, value, traceback)
# Call the normal Exception hook after
sys._excepthook(exctype, value, traceback)
sys.exit(1)
# Set the exception hook to our wrapping function
sys.excepthook = my_exception_hook
def main():
# Set application, organization name and version
# This is used for the QSettings (when an empty constructor is given)
QCoreApplication.setApplicationName(constants.applicationName)
QCoreApplication.setOrganizationName(constants.organizationName)
QCoreApplication.setApplicationVersion(constants.version)
app = QApplication(sys.argv)
form = MainWindow()
form.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()