From: javiplx Date: Sat, 14 May 2011 10:25:04 +0000 (+0000) Subject: Implement honouring the logwritting configuration flag X-Git-Tag: hildon-wrapped~16 X-Git-Url: http://vcs.maemo.org/git/?p=wifihood;a=commitdiff_plain;h=c35542b28282842b0e9eb911633d5240ec10ace4 Implement honouring the logwritting configuration flag git-svn-id: file:///svnroot/wifihood/trunk@162 c51dfc6a-5949-4919-9c8e-f207a149c383 --- diff --git a/wifiscanner/wifimap/replay.py b/wifiscanner/wifimap/replay.py index 0130e60..2db65cf 100644 --- a/wifiscanner/wifimap/replay.py +++ b/wifiscanner/wifimap/replay.py @@ -37,7 +37,7 @@ class ReplayScanner ( gobject.GObject ) : self.newaps = False self.aps = {} - def start ( self , timeout=5000 ) : + def start ( self , timeout=5000 , writelog=False ) : self.scan_timeout = timeout self.db.open() self._fd = open( self._file ) diff --git a/wifiscanner/wifimap/scanner.py b/wifiscanner/wifimap/scanner.py index c6488c1..b45346f 100644 --- a/wifiscanner/wifimap/scanner.py +++ b/wifiscanner/wifimap/scanner.py @@ -22,20 +22,24 @@ class Scanner ( gps.GPSObject , wifiscan.WifiScanner ) : self.homedir = conf.homedir self.db = db.database( os.path.join( self.homedir , conf.dbname ) ) + self.write = False + # Values to be set by wireless scans self.newap = 0 self.newaps = False self.aps = [] - def start ( self , timeout=5000 ) : + def start ( self , timeout=5000 , writelog=False ) : gps.GPSObject.start( self ) wifiscan.WifiScanner.start( self , timeout ) self.db.open() + self.write = writelog def stop ( self ) : gps.GPSObject.stop( self ) wifiscan.WifiScanner.stop( self ) self.db.close() + self.write = False def scan ( self ) : wifiscan.WifiScanner.scan( self ) @@ -54,7 +58,8 @@ class Scanner ( gps.GPSObject , wifiscan.WifiScanner ) : if newap : self.newap += newap self.newaps = True - self.write_logs() + if self.write : + self.write_logs() def write_logs ( self ) : fd = open( os.path.join( self.homedir , "wiscan_gui.info" ) , 'a' ) diff --git a/wifiscanner/wifiscanner b/wifiscanner/wifiscanner index ec1b676..49d6888 100755 --- a/wifiscanner/wifiscanner +++ b/wifiscanner/wifiscanner @@ -9,7 +9,7 @@ except : hildon = False def global_start(button, scanner, config): - scanner.start( config.scan_period ) + scanner.start( config.scan_period , config.store_log ) if button._id : button.disconnect( button._id ) button._id = button.connect("clicked", global_stop, scanner, config)