X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=wifiscanner%2Fwifiscanner;h=7fe9bc7b80eae40c17f4368eb82387bc88894d74;hb=a19180f508361eba59c489d9b1be9a406cd14085;hp=49d68888c7a84da6d6def951bae0a4a3f351b29a;hpb=c35542b28282842b0e9eb911633d5240ec10ace4;p=wifihood diff --git a/wifiscanner/wifiscanner b/wifiscanner/wifiscanner index 49d6888..7fe9bc7 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 , config.store_log ) + scanner.start( int( 1000 * config.scan_period ) , config.store_log ) if button._id : button.disconnect( button._id ) button._id = button.connect("clicked", global_stop, scanner, config) @@ -43,14 +43,14 @@ def stop_scan(button, scanner): button.set_label("Start scanning") -class scanner ( wifimap.ReplayScanner ) : +class scanner ( wifimap.Scanner ) : def scan ( self ) : - wifimap.ReplayScanner.scan( self ) + wifimap.Scanner.scan( self ) self.report() def report ( self ) : - self.status.set_label( wifimap.ReplayScanner.report(self) ) + self.status.set_label( wifimap.Scanner.report(self) ) start, end = self.buffer.get_bounds() self.buffer.delete( start , end ) for mac,rss in self.scanlist.iteritems() : @@ -63,8 +63,10 @@ class scanner ( wifimap.ReplayScanner ) : if self.newaps : pointsize += 2 self.map.plot( pixmap , ( float(self.info[4]) , float(self.info[5]) ) , "red" , pointsize ) - for ap in self.aps.values() : - self.map.plot( pixmap , ( ap[1]/ap[0] , ap[2]/ap[0] ) , "green" , 1 ) + for mac,ap in self.aps.iteritems() : + if self.oldpos.get( mac ) : + self.map.line( pixmap , self.oldpos[mac] , ( ap[1]/ap[0] , ap[2]/ap[0] ) , "green" ) + self.map.plot( pixmap , ( ap[1]/ap[0] , ap[2]/ap[0] ) , "green" , 2 ) self.map.get_pixbuf().get_from_drawable( pixmap , pixmap.get_colormap() , 0, 0 , 0 , 0 , self.map.win_x, self.map.win_y ) self.map.show() @@ -73,7 +75,8 @@ class AbstractWifiscanner : def __init__ ( self ) : - _scanner = scanner( "wlan0" ) + config = wifimap.config.Configuration( 'scanner' ) + _scanner = scanner( config , "wlan0" ) self.connect("delete_event", gtk.main_quit, None) @@ -100,7 +103,7 @@ class AbstractWifiscanner : scrollview = gtk.ScrolledWindow() notebook.append_page( scrollview , gtk.Label("Scanning") ) - self.map = MapWindow() + self.map = MapWindow( config ) notebook.append_page( self.map , gtk.Label("Map") ) buttons = gtk.VBox(homogeneous=False, spacing=0) @@ -112,7 +115,7 @@ class AbstractWifiscanner : # Buttons creation button = self.Button( "Switch GPS On") - button._id = button.connect("clicked", global_start, _scanner, self.map.config) + button._id = button.connect("clicked", global_start, _scanner, config) buttons.pack_start(button, expand=False) button_scan = self.Button( "Start scanning") @@ -142,9 +145,9 @@ if hildon : class MapWindow ( gtk.Frame ) : def __init__(self): - gtk.Frame.__init__( self ) + gtk.Frame.__init__( self , config ) - self.config = wifimap.config.Configuration( 'scanner' ) + self.config = config self.add( wifimap.simpleMapWidget( self.config ) ) class Wifiscanner ( AbstractWifiscanner , hildon.StackableWindow ) : @@ -200,9 +203,9 @@ else : class MapWindow ( gtk.Frame ) : def __init__(self): - gtk.Frame.__init__( self ) + gtk.Frame.__init__( self , config ) - self.config = wifimap.config.Configuration( 'scanner' ) + self.config = config self.add( wifimap.simpleMapWidget( self.config , (640,400) ) ) class Wifiscanner ( AbstractWifiscanner , gtk.Window ) :