Web radio improvements
The web radio now exists as a single tab. I eventually need some way of moving to and from radio stations.
This commit is contained in:
parent
a6090a4247
commit
e894ce10fc
|
@ -1,50 +1,41 @@
|
|||
# Bryan Schumaker (8/14/2010)
|
||||
|
||||
import ocarina
|
||||
import webkit
|
||||
from ocarina import body
|
||||
|
||||
path = ocarina.libsaria.path
|
||||
audio = ocarina.libsaria.audio
|
||||
gtk = ocarina.gtk
|
||||
webkit = None
|
||||
|
||||
children = []
|
||||
page = gtk.ScrolledWindow()
|
||||
box = gtk.VBox()
|
||||
sel = gtk.ComboBoxEntry()
|
||||
web = webkit.WebView()
|
||||
|
||||
#box.pack_start(sel)
|
||||
#box.pack_start(web)
|
||||
#page.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
#page.add_with_viewport(box)
|
||||
page.add(web)
|
||||
#page.show_all()
|
||||
|
||||
class WebPage(gtk.ScrolledWindow):
|
||||
def __init__(self, url):
|
||||
gtk.ScrolledWindow.__init__(self)
|
||||
self.url = url
|
||||
self.web = None
|
||||
self.show()
|
||||
#web.load_html_string("<html> \
|
||||
# <a href=\"http://www.pandora.com\">Pandora</a><br> \
|
||||
# <a href=\"http://www.grooveshark.com\">Groove Shark</a> \
|
||||
# </html>", "http:///")
|
||||
html = path.join(path.cwd(), "html")
|
||||
radio = path.join(html, "web_radio.html")
|
||||
web.open(radio)
|
||||
|
||||
def visible(self):
|
||||
if self.web == None:
|
||||
self.web = webkit.WebView()
|
||||
self.web.open(self.url)
|
||||
#self.web.connect("load-finished", self.load_finished)
|
||||
self.web.connect("document-load-finished", self.doc_load_finished)
|
||||
self.add(self.web)
|
||||
self.web.show()
|
||||
|
||||
def doc_load_finished(self, view, webframe):
|
||||
ocarina.libsaria.controls.pause()
|
||||
page.show_all()
|
||||
#page.show()
|
||||
|
||||
def start():
|
||||
global webkit
|
||||
global children
|
||||
import webkit
|
||||
|
||||
pandora = WebPage("http://www.pandora.com")
|
||||
children.append("Pandora")
|
||||
body.add_page("Pandora", pandora)
|
||||
|
||||
groove = WebPage("http://www.grooveshark.com")
|
||||
children.append("Groove Shark")
|
||||
body.add_page("Groove Shark", groove)
|
||||
body.add_page("Web Radio", page)
|
||||
|
||||
def stop():
|
||||
for child in children:
|
||||
body.remove_page(child)
|
||||
body.remove_page("Web Radio")
|
||||
|
||||
def check_version():
|
||||
if ocarina.__major__ != 4:
|
||||
|
|
Loading…
Reference in New Issue
Block a user