-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.py
49 lines (33 loc) · 1.3 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
import sys
from util import constants
# If debugging application then automatically generate the UI if necessary
if constants.debug:
import pyqt5ac
pyqt5ac.main(config='pyqt5ac_config.yml')
from gui.mainWindow import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets 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 customExceptionHook(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 = customExceptionHook
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()