Change logic for adding known but unordered profiles
[wifi-radar.git] / wifi-radar
bloba1b08476c134e56a958ea075f0cbd3f6eaf2d22d
1 #!/usr/bin/python -OO
2 # -*- coding: utf-8 -*-
4 # A utility for managing WiFi profiles on GNU/Linux.
6 # Copyright (C) 2004-2005 Ahmad Baitalmal <ahmad@baitalmal.com>
7 # Copyright (C) 2005 Nicolas Brouard <nicolas.brouard@mandrake.org>
8 # Copyright (C) 2005-2009 Brian Elliott Finley <brian@thefinleys.com>
9 # Copyright (C) 2006 David Decotigny <com.d2@free.fr>
10 # Copyright (C) 2006 Simon Gerber <gesimu@gmail.com>
11 # Copyright (C) 2006-2007 Joey Hurst <jhurst@lucubrate.org>
12 # Copyright (C) 2006, 2009 Ante Karamatic <ivoks@ubuntu.com>
13 # Copyright (C) 2009-2010,2014 Sean Robinson <robinson@tuxfamily.org>
14 # Copyright (C) 2010 Prokhor Shuchalov <p@shuchalov.ru>
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; version 2 of the License.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License in LICENSE.GPL for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to:
27 # Free Software Foundation, Inc.
28 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
30 # http://wifi-radar.tuxfamily.org/
32 # See CREDITS file for more contributors.
33 # See HISTORY file for, well, changes.
35 # NOTE: Remove the '-OO' from '#!/usr/bin/python -OO' in the first line to
36 # turn on console debugging.
39 from __future__ import print_function, unicode_literals
41 # Set up a logging framework as early as possible.
42 import logging
43 logger = logging.getLogger('wifiradar')
44 generic_formatter = logging.Formatter(
45 fmt='%(asctime)s.%(msecs)d %(levelname)s %(name)s: %(message)s',
46 datefmt='%Y-%m-%d %H:%M:%S')
47 consoleLogHandler = logging.StreamHandler()
48 consoleLogHandler.setFormatter(generic_formatter)
49 logger.addHandler(consoleLogHandler)
50 # Start permissive and raise the level later.
51 if __debug__:
52 logger.setLevel(logging.DEBUG)
54 import os
55 import sys
57 import wifiradar
58 from wifiradar.misc import _, WIFI_RADAR_VERSION
59 import wifiradar.gui.g2 as ui
60 import wifiradar.gui.g2.transients as transients
63 # Where the conf file should live could be different for your distro. Please change
64 # at install time with "make install sysconfdir=/etc/wifi-radar" or similar. -BEF-
66 CONF_FILE = '/etc/wifi-radar/wifi-radar.conf'
69 ####################################################################################################
70 # Make so we can be imported
71 if __name__ == '__main__':
72 if len(sys.argv) > 1 and (sys.argv[1] == '--version' or sys.argv[1] == '-v'):
73 print(_('WiFi Radar version {VERSION}').format(VERSION=WIFI_RADAR_VERSION))
74 elif len(sys.argv) > 1 and (sys.argv[1] == '--help' or sys.argv[1] == '-h'):
75 print(_('WiFi Radar version {VERSION}\n'
76 'For help, check man pages for wifi-radar and '
77 'wifi-radar.conf,\n'
78 'or visit http://wifi-radar.tuxfamily.org/').format(
79 VERSION=WIFI_RADAR_VERSION))
80 else:
81 wifiradar.Main(CONF_FILE)