diff --git a/ocarina/info.py b/ocarina/info.py index fbb0d598..8b5d82b4 100644 --- a/ocarina/info.py +++ b/ocarina/info.py @@ -1,6 +1,7 @@ # Bryan Schumaker (8/22/2010) import ocarina +import pango gtk = ocarina.gtk libsaria = ocarina.libsaria button = None @@ -53,6 +54,7 @@ class InfoBar(Bar): self.title = gtk.Label("Ocarina 4.1") self.title.show() + self.title.set_ellipsize(pango.ELLIPSIZE_END) self.pack(self.title, True, True) self.pack(label.TimeLabel()) @@ -60,13 +62,11 @@ class InfoBar(Bar): self.pack(button.PauseButton()) self.pack(button.StopButton()) self.pack(button.NextButton()) - #self.pack(button.VolumeButton()) self.pack(button.UpButton(up_button)) libsaria.event.invite("POSTLOAD", self.change_title) def change_title(self, filepath): - #id = libsaria.collection.lib_get_cur_id() id = libsaria.collection.lib_find_id(filepath) title = lib_get_attr(id, "title") artist = libsaria.collection.lib_get_attr(id, "artist") @@ -86,7 +86,6 @@ class InfoTab(gtk.Notebook): hbox.pack_start(button.PauseButton()) hbox.pack_start(button.StopButton()) hbox.pack_start(button.NextButton()) - #hbox.pack_start(button.VolumeButton()) hbox.pack_start(button.DownButton(down_button)) self.set_action_widget(hbox, gtk.PACK_END) @@ -103,6 +102,34 @@ class InfoTab(gtk.Notebook): self.cur_page = page_num +class NowPlaying(gtk.Table): + def __init__(self): + gtk.Table.__init__(self, 3, 2, False) + self.artist = gtk.Label("") + self.album = gtk.Label("") + self.title = gtk.Label("") + self.attach(gtk.Label("Artist"), 0, 1, 0, 1, gtk.SHRINK, 5, 5) + self.attach(gtk.Label("Album"), 0, 1, 1, 2, gtk.SHRINK, 5, 5) + self.attach(gtk.Label("Title"), 0, 1, 2, 3, gtk.SHRINK, 5, 5) + self.attach(self.artist, 1, 2, 0, 1, gtk.SHRINK|gtk.EXPAND|gtk.FILL, 5, 5) + self.attach(self.album, 1, 2, 1, 2, gtk.SHRINK|gtk.EXPAND|gtk.FILL, 5, 5) + self.attach(self.title, 1, 2, 2, 3, gtk.SHRINK|gtk.EXPAND|gtk.FILL, 5, 5) + + self.artist.set_ellipsize(pango.ELLIPSIZE_END) + self.album.set_ellipsize(pango.ELLIPSIZE_END) + self.title.set_ellipsize(pango.ELLIPSIZE_END) + + self.show_all() + libsaria.event.invite("POSTLOAD", self.change_labels) + + def change_labels(self, filepath): + id = libsaria.collection.lib_find_id(filepath) + if id: + self.title.set_text(lib_get_attr(id, "title")) + self.artist.set_text(lib_get_attr(id, "artist")) + self.album.set_text(lib_get_attr(id, "album")) + + class TwoWayPane(InfoBar): def __init__(self): InfoBar.__init__(self, self.up_button) @@ -134,7 +161,7 @@ def init(): info = TwoWayPane() filter = FilterBar() - add_info_page("Test", gtk.Label("test label!")) + add_info_page("Now Playing", NowPlaying()) def get_info(): global info