10 def hello(widget, data):
13 def bye(widget, data):
16 def enable_agps(widget):
17 if widget.get_active() :
18 print "%s state is active" % widget
20 def scana(widget, data):
22 data._timer = gobject.timeout_add( 5000 , data.scan )
24 hildon.hildon_banner_show_information( widget , "icon_path" , "Scanning was already active" )
26 def scano(widget, data):
28 hildon.hildon_banner_show_information( widget , "icon_path" , "Timer was running, stopping it" )
29 gobject.source_remove( data._timer )
33 hildon.hildon_banner_show_information( widget , "icon_path" , "Scanning is not active" )
37 window = hildon.Window()
38 program = hildon.Program.get_instance()
39 program.add_window(window)
41 gpsdev = wifimap.Scanner( window )
43 window.connect("delete_event", gtk.main_quit, None)
45 vbox = gtk.VBox(homogeneous=False, spacing=0)
46 top_frame = gtk.Frame(label="top")
47 bottom_frame = gtk.Frame(label="bottom")
49 # FIXME : Temporary holder !!!
50 table = gtk.Table (2, 2, False)
52 # set the spacing to 10 on x and 10 on y
53 table.set_row_spacings(10)
54 table.set_col_spacings(10)
56 button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Switch On!")
57 button.connect("clicked", hello, gpsdev)
58 table.attach(button, 0, 1, 0, 1)
60 button_off = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Switch Off!")
61 button_off.connect("clicked", bye, gpsdev)
62 table.attach(button_off, 1, 2, 0, 1)
64 button_scan = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Start scanning now !!")
65 button_scan.connect("clicked", scana, gpsdev)
66 table.attach(button_scan, 0, 1, 1, 2)
68 button_stop = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Stop scanning now !!")
69 button_stop.connect("clicked", scano, gpsdev)
70 table.attach(button_stop, 1, 2, 1, 2)
72 bottom_frame.add(table)
74 toggle_button = gtk.CheckButton(label="Use Assisted GPS")
75 toggle_button.connect("toggled", enable_agps)
76 top_frame.add(toggle_button)
78 vbox.pack_start(top_frame)
79 vbox.pack_end(bottom_frame)
88 if __name__ == "__main__":