ocarina/ocarina/footer.py

58 lines
1.1 KiB
Python

# Bryan Schumaker (11/25/2010)
import ocarina
gtk = ocarina.gtk
pango = ocarina.pango
libsaria = ocarina.libsaria
from components import label
from components import button
footer = None
bar = None
title = None
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))
def bar_add(widget, expand = False, fill = False):
bar.pack_start(widget, expand, fill)
def make_bar():
global title
title = gtk.Label(ocarina.__vers__)
title.set_ellipsize(pango.ELLIPSIZE_END)
title.show()
bar_add(title, True, True)
bar_add(label.TimeLabel())
bar_add(label.LengthLabel2())
bar_add(button.RewindButton())
bar_add(button.ForwardButton())
bar_add(button.PlayButton())
bar_add(button.PauseButton())
bar_add(button.StopButton())
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)
libsaria.event.invite("POSTLOAD", change_title)
init()