forked from garyjohnson/ci_screen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·47 lines (33 loc) · 1.12 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
#!/usr/bin/env python
import os
import sys
import signal
import model
import logging
import pqaut.server as pqaut
from PyQt5.Qt import QApplication, qmlRegisterType
import screens.status_screen as status_screen
import main_window
def exit_on_ctrl_c():
signal.signal(signal.SIGINT, signal.SIG_DFL)
if __name__ == '__main__':
exit_on_ctrl_c()
if '--automation_server' in sys.argv:
pqaut.start_automation_server()
app = QApplication(sys.argv)
qmlRegisterType(status_screen.StatusScreen, 'Screens', 1, 0, 'StatusScreen')
qmlRegisterType(model.project.Project, 'Model', 1, 0, 'Project')
qmlRegisterType(model.projects_model.ProjectsModel, 'Model', 1, 0, 'ProjectsModel')
window = main_window.MainWindow()
window.showFullScreen()
sys.exit(app.exec_())
log_levels = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
}
log_level_name = os.environ.get('CI_LOG', 'ERROR')
logging.basicConfig(level=log_levels[log_level_name])
logger = logging.getLogger(__name__)
logger.info('ci_screen log level is {}'.format(log_level_name))