-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastonx.py
executable file
·99 lines (81 loc) · 2.81 KB
/
astonx.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2011-2014 Roderick Bovee
#
# This file is part of Aston.
#
# Aston is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Aston is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Aston. If not, see <http://www.gnu.org/licenses/>.
'''Loads and runs the Aston application.'''
#pylint: disable=C0103
import sys
if len(sys.argv) > 1:
import argparse
parser = argparse.ArgumentParser(description='Chromatogram processor.')
parser.add_argument('-v', '--version', action='store_true')
subp = parser.add_subparsers(dest='cmd')
parser_gui = subp.add_parser('gui')
parser_gui.add_argument('-d', '--directory')
parser_conv = subp.add_parser('convert')
parser_conv.add_argument('infile')
parser_conv.add_argument('outfile')
parser_plot = subp.add_parser('plot')
parser_conv.add_argument('file')
parser_conv.add_argument('-p', '--plotfile')
parser_info = subp.add_parser('info')
parser_conv.add_argument('file')
args = parser.parse_args()
startx = args.cmd == 'gui'
else:
startx = True
if startx:
# for compatibility with Python 2
import sip
sip.setapi('QVariant', 2)
# to make some error messages go away
import matplotlib
matplotlib.use('Qt5Agg')
import numpy
numpy.seterr(divide='raise', invalid='raise', over='raise')
import warnings
import sqlalchemy.exc
warnings.simplefilter('error', RuntimeWarning)
warnings.simplefilter('ignore', sqlalchemy.exc.SAWarning)
# for multiprocessing to work on Windows
import multiprocessing
multiprocessing.freeze_support()
# all the other imports
import sys
import PyQt5
from aston.qtgui.MainWindow import AstonWindow
qt = PyQt5.QtWidgets.QApplication(sys.argv)
# translation stuff
import locale
from aston.resources import resfile
try:
locale.setlocale(locale.LC_ALL, '')
if locale.getlocale()[0] is not None:
lang = locale.getlocale()[0]
tlate = PyQt5.QtCore.QTranslator(qt)
tlate.load('aston_' + lang + '.qm', resfile('aston/qtgui', 'i18n'))
qt.installTranslator(tlate)
except locale.Error:
pass
# set up the main window and start
aston = AstonWindow()
aston.show()
sys.exit(qt.exec_())
else:
# do command line things
# TODO
pass