Move scanner UI out of the main package
[wifihood] / wifiscanner / wifiscanner
index ee9b20b..03ff1ad 100755 (executable)
@@ -1,90 +1,8 @@
 #!/usr/bin/python
 
-import wifimap
-
-import gtk
-import hildon
-
-import gobject
-
-def hello(widget, data):
-    data.do_start()
-
-def bye(widget, data):
-    data.do_stop()
-
-def enable_agps(widget):
-    if widget.get_active() :
-        print "%s state is active" % widget
-
-def scana(widget, data):
-    if not data._timer :
-        data._timer = gobject.timeout_add( 5000 , data.scan )
-    else :
-        hildon.hildon_banner_show_information( widget , "icon_path" , "Scanning was already active" )
-
-def scano(widget, data):
-    if data._timer :
-        hildon.hildon_banner_show_information( widget , "icon_path" , "Timer was running, stopping it" )
-        gobject.source_remove( data._timer )
-        data._timer = None
-        data.stop()
-    else :
-        hildon.hildon_banner_show_information( widget , "icon_path" , "Scanning is not active" )
-
-def main():
-
-    window = hildon.Window()
-    program = hildon.Program.get_instance()
-    program.add_window(window)
-
-    gpsdev = wifimap.Scanner( window )
-
-    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")
-
-    # FIXME : Temporary holder !!!
-    table = gtk.Table (2, 2, False)
-
-    # set the spacing to 10 on x and 10 on y 
-    table.set_row_spacings(10)
-    table.set_col_spacings(10)
-
-    button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Switch On!")
-    button.connect("clicked", hello, gpsdev)
-    table.attach(button, 0, 1, 0, 1)
-
-    button_off = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Switch Off!")
-    button_off.connect("clicked", bye, gpsdev)
-    table.attach(button_off, 1, 2, 0, 1)
-
-    button_scan = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Start scanning now !!")
-    button_scan.connect("clicked", scana, gpsdev)
-    table.attach(button_scan, 0, 1, 1, 2)
-
-    button_stop = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH, hildon.BUTTON_ARRANGEMENT_VERTICAL, "Stop scanning now !!")
-    button_stop.connect("clicked", scano, gpsdev)
-    table.attach(button_stop, 1, 2, 1, 2)
-
-    bottom_frame.add(table)
-
-    toggle_button = gtk.CheckButton(label="Use Assisted GPS")
-    toggle_button.connect("toggled", enable_agps)
-    top_frame.add(toggle_button)
-
-    vbox.pack_start(top_frame)
-    vbox.pack_end(bottom_frame)
-    window.add(vbox)
-
-    window.show_all()
-
-    gpsdev.start()
-
-    gtk.main()
+import wifiscanner
 
 if __name__ == "__main__":
-    main()
+    window = wifiscanner.Wifiscanner()
+    window.run()