X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=wifiscanner%2Fwifiview.py;h=b2d942ce42e5f0dfc0bcfb15f718c0a360eb11ef;hb=d36caad4ed7907927231e275439323cb2b391fff;hp=850deee2844b809e921cc7be2a7cf0cae77ed523;hpb=9540490c0bfddb921a7fbf0a0b3aa479ae804e89;p=wifihood diff --git a/wifiscanner/wifiview.py b/wifiscanner/wifiview.py index 850deee..b2d942c 100755 --- a/wifiscanner/wifiview.py +++ b/wifiscanner/wifiview.py @@ -84,6 +84,12 @@ class mapWidget ( wifimap.view.AbstractmapWidget , gtk.Image ) : def draw_paths( self ) : + center_x , center_y = self.win_x / 2 , self.win_y / 2 + + # To get the central pixel in the window center, we must shift to the tile origin + center_x -= self.refpix_x + center_y -= self.refpix_y + pixmap,mask = self.get_pixbuf().render_pixmap_and_mask() red = pixmap.new_gc() red.foreground = pixmap.get_colormap().alloc_color("red") @@ -111,6 +117,30 @@ class mapWidget ( wifimap.view.AbstractmapWidget , gtk.Image ) : self.get_pixbuf().get_from_drawable( pixmap , pixmap.get_colormap() , 0, 0 , 0 , 0 , self.win_x, self.win_y ) + def plot_APs( self ) : + + center_x , center_y = self.win_x / 2 , self.win_y / 2 + + # To get the central pixel in the window center, we must shift to the tile origin + center_x -= self.refpix_x + center_y -= self.refpix_y + + pixmap,mask = self.get_pixbuf().render_pixmap_and_mask() + blue = pixmap.new_gc() + blue.foreground = pixmap.get_colormap().alloc_color("blue") + + db = wifimap.db.database( os.path.join( self.conf.homedir , self.conf.dbname ) ) + db.open() + # NOTE : Intervals for query are just educated guesses to fit in window + lat , lon = self.conf.lat , self.conf.lon + for ap in db.db.execute( "SELECT * FROM ap where lat/n>%f and lat/n<%f and lon/n>%f and lon/n<%f" % ( lat - 0.003 , lat + 0.003 , lon - 0.007 , lon + 0.007 ) ) : + if ap[3] > 1 : + dest_x , dest_y = self.gps2pix( ( ap[4]/ap[3] , ap[5]/ap[3] ) , ( center_x , center_y ) ) + pixmap.draw_rectangle(blue, True , dest_x , dest_y , 3 , 3 ) + db.close() + + self.get_pixbuf().get_from_drawable( pixmap , pixmap.get_colormap() , 0, 0 , 0 , 0 , self.win_x, self.win_y ) + if hildon :