Footer add page
I can now add generic pages to the footer displayed on each main tab.
This commit is contained in:
parent
070ea3e465
commit
d74d294ea1
|
@ -7,22 +7,35 @@ libsaria = ocarina.libsaria
|
|||
|
||||
from components import label
|
||||
from components import button
|
||||
from components import pbar
|
||||
from components import image
|
||||
|
||||
footer = None
|
||||
bar = None
|
||||
title = None
|
||||
footer = gtk.VBox()
|
||||
bar = gtk.HBox()
|
||||
title = gtk.Label()
|
||||
tabs = gtk.Notebook()
|
||||
act_bar = gtk.HBox()
|
||||
|
||||
pages = dict()
|
||||
|
||||
def change_title(filepath):
|
||||
id = file_to_id(filepath)
|
||||
title, artist = get_attrs(id, "title", "artist")
|
||||
self.title.set_text("%s by %s" % (title, artist))
|
||||
id = libsaria.sources.file_to_id(filepath)
|
||||
(ttl, artst) = libsaria.sources.get_attrs(id, "title", "artist")
|
||||
title.set_text("%s by %s" % (ttl, artst))
|
||||
|
||||
def bar_add(widget, expand = False, fill = False):
|
||||
bar.pack_start(widget, expand, fill)
|
||||
|
||||
def act_bar_add(widget, expand = False, fill = False):
|
||||
act_bar.pack_start(widget, expand, fill)
|
||||
|
||||
def add_page(title, widget):
|
||||
label = gtk.Label(title)
|
||||
pages[title] = widget
|
||||
tabs.append_page(widget, label)
|
||||
|
||||
def make_bar():
|
||||
global title
|
||||
title = gtk.Label(ocarina.__vers__)
|
||||
title.set_text(ocarina.__vers__)
|
||||
title.set_ellipsize(pango.ELLIPSIZE_END)
|
||||
title.show()
|
||||
|
||||
|
@ -37,21 +50,55 @@ def make_bar():
|
|||
bar_add(button.NextButton())
|
||||
|
||||
bar.show()
|
||||
|
||||
def init():
|
||||
global footer
|
||||
global bar
|
||||
global title
|
||||
|
||||
footer = gtk.VBox()
|
||||
sep = gtk.HSeparator()
|
||||
bar = gtk.HBox()
|
||||
|
||||
footer.pack_start(sep)
|
||||
footer.show_all()
|
||||
|
||||
make_bar()
|
||||
footer.pack_start(bar)
|
||||
|
||||
def make_action_bar():
|
||||
act_bar_add(label.TimeLabel())
|
||||
act_bar_add(pbar.PBar(), True, True)
|
||||
act_bar_add(button.PlayButton())
|
||||
act_bar_add(button.PauseButton())
|
||||
act_bar_add(button.StopButton())
|
||||
act_bar_add(button.NextButton())
|
||||
act_bar.show()
|
||||
|
||||
def make_now_playing_page():
|
||||
page = gtk.HBox(False, 5)
|
||||
page.pack_start(image.AlbumArt(), False, False)
|
||||
|
||||
tags = gtk.ScrolledWindow()
|
||||
tags.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
view = gtk.Viewport()
|
||||
view.set_shadow_type(gtk.SHADOW_NONE)
|
||||
tag_box = gtk.VBox(True)
|
||||
tag_box.pack_start(label.TitleLabel())
|
||||
tag_box.pack_start(label.ArtistLabel())
|
||||
tag_box.pack_start(label.AlbumLabel())
|
||||
view.add(tag_box)
|
||||
tags.add(view)
|
||||
page.pack_start(tags)
|
||||
|
||||
attrs = gtk.VBox()
|
||||
attrs.pack_start(label.YearLabel())
|
||||
attrs.pack_start(label.LengthLabel())
|
||||
attrs.pack_start(label.CountLabel())
|
||||
page.pack_start(attrs)
|
||||
|
||||
page.show_all()
|
||||
add_page("Now Playing", page)
|
||||
|
||||
|
||||
def make_tabs():
|
||||
make_action_bar()
|
||||
tabs.set_action_widget(act_bar, gtk.PACK_END)
|
||||
make_now_playing_page()
|
||||
tabs.show_all()
|
||||
footer.pack_start(tabs)
|
||||
|
||||
def init():
|
||||
sep = gtk.HSeparator()
|
||||
footer.pack_start(sep)
|
||||
footer.show_all()
|
||||
make_bar()
|
||||
make_tabs()
|
||||
libsaria.event.invite("POSTLOAD", change_title)
|
||||
init()
|
||||
|
|
Loading…
Reference in New Issue