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)
|
# Bryan Schumaker (8/14/2010)
|
||||||
|
|
||||||
import ocarina
|
import ocarina
|
||||||
|
import webkit
|
||||||
from ocarina import body
|
from ocarina import body
|
||||||
|
|
||||||
|
path = ocarina.libsaria.path
|
||||||
audio = ocarina.libsaria.audio
|
audio = ocarina.libsaria.audio
|
||||||
gtk = ocarina.gtk
|
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):
|
#web.load_html_string("<html> \
|
||||||
def __init__(self, url):
|
# <a href=\"http://www.pandora.com\">Pandora</a><br> \
|
||||||
gtk.ScrolledWindow.__init__(self)
|
# <a href=\"http://www.grooveshark.com\">Groove Shark</a> \
|
||||||
self.url = url
|
# </html>", "http:///")
|
||||||
self.web = None
|
html = path.join(path.cwd(), "html")
|
||||||
self.show()
|
radio = path.join(html, "web_radio.html")
|
||||||
|
web.open(radio)
|
||||||
|
|
||||||
def visible(self):
|
page.show_all()
|
||||||
if self.web == None:
|
#page.show()
|
||||||
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()
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
global webkit
|
body.add_page("Web Radio", page)
|
||||||
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)
|
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
for child in children:
|
body.remove_page("Web Radio")
|
||||||
body.remove_page(child)
|
|
||||||
|
|
||||||
def check_version():
|
def check_version():
|
||||||
if ocarina.__major__ != 4:
|
if ocarina.__major__ != 4:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user