-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (28 loc) · 1.24 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
"""Application entry point. It is responsible for setting up the environment and launching the GUI."""
import argparse
import logging
import sys
import gi
gi.require_version("Gtk", "3.0")
# Read configuration, ignore unused import
# noinspection PyUnresolvedReferences
import config
# NOTE: before this line only standard library modules can be imported
from settings import program_settings
from gui.main import main as gui_main
from data_logger import DataLogger
LOGGER = logging.getLogger()
def excepthook(exc_type, value, traceback):
LOGGER.critical("Uncaught exception", exc_info=(exc_type, value, traceback))
if __name__ == '__main__':
try:
sys.excepthook = excepthook
parser = argparse.ArgumentParser(description='Muon system voltage controller.')
parser.add_argument('devices', metavar='DEVICES', help='Path to a CSV file containing device addresses')
parser.add_argument('--profile', metavar='PATH',
help='Path to a CSV file containing parameters of voltage cells')
args = parser.parse_args()
data_logger = DataLogger(program_settings.data_log_file)
gui_main(args, data_logger)
except KeyboardInterrupt:
LOGGER.warning('Process interrupted')