1 # -*- coding: utf-8 -*-
3 # __init__.py - main logic for operating WiFi Radar
5 # Part of WiFi Radar: A utility for managing WiFi profiles on GNU/Linux.
7 # Copyright (C) 2004-2005 Ahmad Baitalmal <ahmad@baitalmal.com>
8 # Copyright (C) 2005 Nicolas Brouard <nicolas.brouard@mandrake.org>
9 # Copyright (C) 2005-2009 Brian Elliott Finley <brian@thefinleys.com>
10 # Copyright (C) 2006 David Decotigny <com.d2@free.fr>
11 # Copyright (C) 2006 Simon Gerber <gesimu@gmail.com>
12 # Copyright (C) 2006-2007 Joey Hurst <jhurst@lucubrate.org>
13 # Copyright (C) 2006, 2009 Ante Karamatic <ivoks@ubuntu.com>
14 # Copyright (C) 2009-2010,2014 Sean Robinson <seankrobinson@gmail.com>
15 # Copyright (C) 2010 Prokhor Shuchalov <p@shuchalov.ru>
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; version 2 of the License.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License in LICENSE.GPL for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 from multiprocessing
import Pipe
41 from subprocess
import Popen
42 from threading
import Event
, Thread
44 from wifiradar
.connections
import ConnectionManager
45 from wifiradar
.pubsub
import Dispatcher
, Message
46 import wifiradar
.gui
.g2
as ui
47 import wifiradar
.gui
.g2
.transients
as transients
49 # Set up a logging framework.
50 logger
= logging
.getLogger("wifiradar")
57 logger
.setLevel(logging
.DEBUG
)
59 logger
.setLevel(config
.get_opt_as_int('DEFAULT', 'loglevel'))
62 fileLogHandler
= logging
.handlers
.RotatingFileHandler(config
.get_opt('DEFAULT', 'logfile'), maxBytes
=64*1024, backupCount
=5)
66 fileLogHandler
.setFormatter(generic_formatter
)
67 logger
.addHandler(fileLogHandler
)
68 dispatcher
= Dispatcher()
73 apQueue
= queue
.Queue(100)
74 commQueue
= queue
.Queue(2)
76 connman_thread
= Thread(None, misc
.scanning_thread
, None, (config
, apQueue
, commQueue
, exit_event
))
77 connman_thread
.start()
78 main_radar_window
= ui
.RadarWindow(config
, apQueue
, commQueue
, exit_event
)
79 main_radar_window
.main()