81 lines
1.6 KiB
Python
81 lines
1.6 KiB
Python
# Bryan Schumaker (8/22/2010)
|
|
|
|
import ocarina
|
|
gtk = ocarina.gtk
|
|
libsaria = ocarina.libsaria
|
|
button = None
|
|
|
|
lib_get_cur_id = libsaria.collection.lib_get_cur_id
|
|
lib_get_attr = libsaria.collection.lib_get_attr
|
|
|
|
filter = None
|
|
info = None
|
|
|
|
class Bar(gtk.VBox):
|
|
def __init__(self, sep_on_top):
|
|
gtk.VBox.__init__(self)
|
|
self.show()
|
|
self.sep = gtk.HSeparator()
|
|
self.sep.show()
|
|
self.contents = gtk.HBox()
|
|
self.contents.show()
|
|
if sep_on_top == True:
|
|
self.pack_start(self.sep)
|
|
self.pack_start(self.contents)
|
|
else:
|
|
self.pack_start(self.contents)
|
|
self.pack_start(self.sep)
|
|
|
|
def pack(self, widget, expand=False, fill=False):
|
|
self.contents.pack_start(widget, expand, fill)
|
|
|
|
|
|
class FilterBar(Bar):
|
|
def __init__(self):
|
|
Bar.__init__(self, False)
|
|
global button
|
|
global libsaria
|
|
|
|
self.pack(button.OpenButton())
|
|
|
|
|
|
class InfoBar(Bar):
|
|
def __init__(self):
|
|
Bar.__init__(self, True)
|
|
global button
|
|
global libsaria
|
|
|
|
self.title = gtk.Label("Ocarina 4.1")
|
|
self.title.show()
|
|
self.pack(self.title, True, True)
|
|
self.pack(button.PlayButton())
|
|
self.pack(button.PauseButton())
|
|
|
|
libsaria.event.invite("POSTLOAD", self.change_title)
|
|
|
|
def change_title(self, filepath):
|
|
id = libsaria.collection.lib_get_cur_id()
|
|
title = lib_get_attr(id, "title")
|
|
artist = libsaria.collection.lib_get_attr(id, "artist")
|
|
self.title.set_text("%s by %s" % (title,artist))
|
|
|
|
|
|
def init():
|
|
global info
|
|
global filter
|
|
global button
|
|
|
|
import button
|
|
info = InfoBar()
|
|
filter = FilterBar()
|
|
|
|
|
|
def get_info():
|
|
global info
|
|
return info
|
|
|
|
|
|
def get_filter():
|
|
global filter
|
|
return filter
|