self.update_handler = None
self.satellites = None
self.cell_info = None
+ self.ngps = 0
+ self.status = None
def set_method ( self , method="gps" ) :
if method == "agps" :
# banner = hildon.hildon_banner_show_information( self._parent , "icon_path" , "Got GPS fix" )
# banner.set_timeout( 1500 )
self.gps_state = "FIX"
+ self.ngps += 1
+ self.refresh_infowin()
elif self.device.status == location.GPS_DEVICE_STATUS_DGPS_FIX :
# if self.gps_state == "NO_FIX" :
# banner = hildon.hildon_banner_show_information( self._parent , "icon_path" , "Got differential GPS fix" )
# banner = hildon.hildon_banner_show_information( self._parent , "icon_path" , "GPS info : %s" % self.gps_info )
# banner.set_timeout( 300 )
+ def set_infowin ( self , statuswin ) :
+ self.status = statuswin
+
+ def refresh_infowin ( self ) :
+ self.status.set_label( "%d gps" % self.ngps )
+
# mode = device.fix[0]
# if mode == location.GPS_DEVICE_MODE_NOT_SEEN : # This means ??
osso_rpc = osso.Rpc(self.osso_context)
scan_out = osso_rpc.rpc_run("org.javiplx.wifiscan", "/org/javiplx/wifiscan", "org.javiplx.wifiscan", "wakeup", wait_reply = True)
self._timer = None
+ self.nscan = 0
+ self.nfp = 0
+ self.aplist = {}
def start ( self ) :
osso_rpc = osso.Rpc(self.osso_context)
osso_rpc = osso.Rpc(self.osso_context)
try :
scan_out = osso_rpc.rpc_run("org.javiplx.wifiscan", "/org/javiplx/wifiscan", "org.javiplx.wifiscan", "scan", wait_reply = True)
+ self.nscan +=1
except Exception , ex :
osso.SystemNote(self.osso_context).system_note_infoprint("Exception scanning %s" % ex )
return True
out_str = ""
for net in scan_out.split() :
+ self.nfp += 1
items = net.rsplit(":", 1)
out_str += " %s %s" % ( items[0] , items[1] )
+ self.aplist[ items[0] ] = 1
+ self.refresh_infowin()
if self._debug :
# Use osso or hildon for notes ???
osso.SystemNote(self.osso_context).system_note_infoprint("Found %d APs" % len(scan_out) )
return True
+ def refresh_infowin ( self ) :
+ self.status.set_label( "%d gps\t%d scan\t%d fp\t%d ap" % ( self.ngps , self.nscan , self.nfp , len(self.aplist.keys()) ) )
+
gobject.type_register(Scanner)
window.connect("delete_event", gtk.main_quit, None)
vbox = gtk.VBox(homogeneous=False, spacing=0)
- top_frame = gtk.Frame(label="top")
- bottom_frame = gtk.Frame(label="bottom")
+ top_frame = gtk.Frame()
+ bottom_frame = gtk.Frame()
bottom_box = gtk.HBox(homogeneous=False, spacing=0)
hbox = gtk.HBox(homogeneous=False, spacing=0)
hbox.pack_start( scrollview )
buttons = gtk.VBox(homogeneous=False, spacing=0)
- hbox.pack_end( buttons )
+ hbox.pack_end(buttons, expand=False)
button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Switch On!")
button.handler_id = button.connect("clicked", hello, gpsdev)
buttons.pack_start(toggle_button, expand=False)
status = gtk.Label( "status bar ..." )
+ gpsdev.set_infowin( status )
bottom_box.pack_start( status , expand=False , padding=20 )
bottom_frame.add( bottom_box )
vbox.pack_start(top_frame)
- vbox.pack_end(bottom_frame)
+ vbox.pack_end(bottom_frame, expand=False)
window.add(vbox)
window.show_all()