-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathrf_monitor.py
More file actions
88 lines (69 loc) · 2.38 KB
/
rf_monitor.py
File metadata and controls
88 lines (69 loc) · 2.38 KB
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
#! /usr/bin/env python
#
#
# RF Monitor
#
#
# Copyright 2015 Al Brown
#
# RF signal monitor
#
#
# This program 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, or (at your option)
# any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
import argparse
import os
import sys
from rfmonitor.constants import APP_NAME
def __arguments():
parser = argparse.ArgumentParser(prog="rfmonitor.py",
description='RF signal monitor')
parser.add_argument('-c', '--cli',
help='Command line mode', action='store_true')
groupCli = parser.add_argument_group('Command line mode')
groupCli.add_argument('-p', '--port',
help='GPS serial port')
groupCli.add_argument('-b', '--baud', type=int,
help='GPS serial baud rate')
groupCli.add_argument('-j', '--json', action='store_true',
help='Output JSON updates (suppresses other output)')
groupCli.add_argument('-w', '--web', type=str,
help='Web server push address')
parser.add_argument('file', nargs='?',
help='Load file')
args = parser.parse_args()
if args.cli and args.file is None:
sys.stderr.write('Filename required in command line mode')
exit(1)
if args.file is not None and not os.path.exists(args.file):
sys.stderr.write('File not found')
exit(1)
return args
if __name__ == '__main__':
print APP_NAME + "\n"
args = __arguments()
if args.cli:
from rfmonitor.cli import Cli
cli = Cli(args)
else:
import wx
from rfmonitor.gui import RfMonitor, FrameMain
os.environ['UBUNTU_MENUPROXY'] = '0'
app = RfMonitor()
app.SetClassName(APP_NAME)
wx.Locale().Init2()
frame = FrameMain()
if args.file is not None:
frame.open(args.file)
app.MainLoop()