Began new tab interface
Right now, I am calling it body.py. When I am done, I won't have to go through ocarina/__init__.py to access the tabs. Instead, I will just have to import ocarina.body.
This commit is contained in:
parent
933e961d34
commit
ea4b4cad37
11
ocarina.py
11
ocarina.py
|
@ -8,6 +8,7 @@ before = now()
|
|||
import libsaria
|
||||
import ocarina
|
||||
from ocarina import window
|
||||
from ocarina import body
|
||||
|
||||
from ocarina import collection
|
||||
|
||||
|
@ -15,12 +16,16 @@ width = libsaria.init_pref("ocarina.window.width", 800)
|
|||
height = libsaria.init_pref("ocarina.window.height", 600)
|
||||
|
||||
window.init(width, height)
|
||||
body.init()
|
||||
window.set_title("%s Your Music Everywhere" % ocarina.__vers__)
|
||||
window.set_icon("images/ocarina.png")
|
||||
window.add(ocarina.get_tabs())
|
||||
window.add(body.body)
|
||||
#window.add(ocarina.get_tabs())
|
||||
|
||||
ocarina.add_tab("Playlist", collection.Playlist())
|
||||
ocarina.add_tab("Library", collection.Library())
|
||||
body.add_page("Playlist", collection.Playlist())
|
||||
body.add_page("Library", collection.Library())
|
||||
#ocarina.add_tab("Playlist", collection.Playlist())
|
||||
#ocarina.add_tab("Library", collection.Library())
|
||||
|
||||
|
||||
after = now()
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# Bryan Schumaker (11/24/2010)
|
||||
|
||||
import ocarina
|
||||
gtk = ocarina.gtk
|
||||
Label = gtk.Label
|
||||
|
||||
body = None
|
||||
contents = dict()
|
||||
|
||||
class TabPage(gtk.VBox):
|
||||
def __init__(self, content):
|
||||
gtk.VBox.__init__(self)
|
||||
self.content = content
|
||||
#self.pack_start(content)
|
||||
self.show()
|
||||
|
||||
def visible(self):
|
||||
if hasattr(self.content, "visible"):
|
||||
self.content.visible()
|
||||
|
||||
def invisible(self):
|
||||
if hasattr(self.content, "invisible"):
|
||||
self.content.invisible()
|
||||
|
||||
def init():
|
||||
global body
|
||||
body = gtk.Notebook()
|
||||
body.set_tab_pos(gtk.POS_LEFT)
|
||||
body.connect("switch-page", switch_page)
|
||||
body.show()
|
||||
|
||||
def add_page(text, content):
|
||||
label = Label(text)
|
||||
label.set_angle(90)
|
||||
page = TabPage(content)
|
||||
contents[text] = page
|
||||
body.append_page(page, label)
|
||||
body.set_tab_label_packing(page, True, True, gtk.PACK_START)
|
||||
|
||||
def switch_page(notebook, page, pagenum):
|
||||
pass
|
|
@ -1,6 +1,7 @@
|
|||
# Bryan Schumaker (8/14/2010)
|
||||
|
||||
import ocarina
|
||||
from ocarina import body
|
||||
|
||||
audio = ocarina.libsaria.audio
|
||||
gtk = ocarina.gtk
|
||||
|
@ -26,7 +27,7 @@ class WebPage(gtk.ScrolledWindow):
|
|||
self.web.show()
|
||||
|
||||
def doc_load_finished(self, view, webframe):
|
||||
audio.pause()
|
||||
ocarina.libsaria.controls.pause()
|
||||
|
||||
def start():
|
||||
global webkit
|
||||
|
@ -35,11 +36,11 @@ def start():
|
|||
|
||||
pandora = WebPage("http://www.pandora.com")
|
||||
children.append("Pandora")
|
||||
ocarina.add_tab("Pandora", pandora)
|
||||
body.add_page("Pandora", pandora)
|
||||
|
||||
groove = WebPage("http://www.grooveshark.com")
|
||||
children.append("Groove Shark")
|
||||
ocarina.add_tab("Groove Shark", groove)
|
||||
body.add_page("Groove Shark", groove)
|
||||
|
||||
def stop():
|
||||
for child in children:
|
||||
|
|
Loading…
Reference in New Issue