# Bryan Schumaker (8/14/2010) import ocarina import webkit from ocarina import body __NAME__ = "Web Radio" libsaria = ocarina.libsaria path = libsaria.path audio = libsaria.audio gtk = ocarina.gtk box = gtk.VBox() sel = gtk.combo_box_new_text() page = gtk.ScrolledWindow() web = webkit.WebView() sel.append_text("Select a station:") sel.append_text("Groove Shark") sel.append_text("Pandora") sel.set_active(0) page.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) page.add(web) html = path.join(path.cwd(), "html") radio = path.join(html, "web_radio.html") web.open(radio) box.pack_start(sel, False, False) box.pack_start(page) box.show_all() urls = [radio, "http://www.grooveshark.com", "http://www.pandora.com"] def combo_box_changed(box): model = box.get_model() index = box.get_active() if index != None: web.open(urls[index]) sel.connect("changed", combo_box_changed) def start(): body.add_page("Web Radio", box, False, False) def stop(): body.remove_page("Web Radio") def check_version(): if libsaria.__major__ != 4: return False if libsaria.__minor__ == 4: return True return False