-
Notifications
You must be signed in to change notification settings - Fork 48
/
pyrat.run
executable file
·47 lines (41 loc) · 1.55 KB
/
pyrat.run
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 pyrat
from PyQt5 import QtCore
QtCore.pyqtRemoveInputHook()
import sys, os, argparse
from pyrat.lib.ste.ste_io import check_ratformat
def main():
parser = argparse.ArgumentParser(description="PyRAT - Radar Tools")
parser.add_argument("-b", "--batch", help="Run in batch mode (not starting the viewer)", action="store_true")
parser.add_argument("-d", "--debug", help="Run in debug mode", action="store_true")
parser.add_argument("FILE", help="file to open on startup (RATHDF or RAT type)", nargs='?', default="default.rat")
args = parser.parse_args()
if args.batch is True:
from pyrat.tools import HistoryConsole
vars = globals().copy()
vars.update(locals())
shell = HistoryConsole(vars)
shell.push("from pyrat import *")
launcher = "pyrat_init("
if args.debug:
launcher += "debug=True"
launcher += ")"
shell.push(launcher)
if os.path.exists(args.FILE):
if check_ratformat(args.FILE):
shell.push("load.rat('" + args.FILE + "')")
else:
shell.push("load.rathdf('" + args.FILE + "')")
shell.interact(" \n You are in PyRAT batch mode\n")
sys.exit()
else:
pyrat.pyrat_init(debug=args.debug)
if os.path.exists(args.FILE):
if check_ratformat(args.FILE):
pyrat.load.rat(args.FILE)
else:
pyrat.load.rathdf(args.FILE)
pyrat.show()
sys.exit()
if __name__ == "__main__":
main()