plugins: Web radio drop down selector

The drop down selector provides a way of changing stations while on
another station.  It's much more convenient.
This commit is contained in:
Bryan Schumaker 2011-02-01 22:45:09 -05:00
parent 377c1a496d
commit 6863318d5b
1 changed files with 21 additions and 7 deletions

View File

@ -11,25 +11,39 @@ path = libsaria.path
audio = libsaria.audio
gtk = ocarina.gtk
page = gtk.ScrolledWindow()
box = gtk.VBox()
sel = gtk.ComboBoxEntry()
sel = gtk.combo_box_new_text()
page = gtk.ScrolledWindow()
web = webkit.WebView()
#box.pack_start(sel)
#box.pack_start(web)
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_with_viewport(box)
page.add(web)
html = path.join(path.cwd(), "html")
radio = path.join(html, "web_radio.html")
web.open(radio)
page.show_all()
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", page, False, False)
body.add_page("Web Radio", box, False, False)
def stop():
body.remove_page("Web Radio")