diff --git a/ocarina/body.py b/ocarina/body.py index 973cad85..1593c4d2 100644 --- a/ocarina/body.py +++ b/ocarina/body.py @@ -28,12 +28,14 @@ class Page(gtk.VBox): def visible(self): self.pack_start(page_header, False, False) self.pack_start(self.content, True, True) + self.pack_start(page_footer, False, False) if self.vis_func: self.vis_func() def invisible(self): self.remove(page_header) self.remove(self.content) + self.remove(page_footer) if self.invis_func: self.invis_func() @@ -43,7 +45,9 @@ def init(): global page_footer import header + import footer page_header = header.header + page_footer = footer.footer body = gtk.Notebook() body.set_tab_pos(gtk.POS_LEFT) diff --git a/ocarina/footer.py b/ocarina/footer.py new file mode 100644 index 00000000..a0067dc9 --- /dev/null +++ b/ocarina/footer.py @@ -0,0 +1,57 @@ +# 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() diff --git a/ocarina/header.py b/ocarina/header.py index 968d41e7..8bc6bd13 100644 --- a/ocarina/header.py +++ b/ocarina/header.py @@ -8,6 +8,10 @@ gtk = ocarina.gtk header = None bar = None + +def bar_add(widget, expand = False, fill = False): + bar.pack_start(widget, expand, fill) + def init(): global header global bar @@ -19,14 +23,10 @@ def init(): header.pack_start(sep) header.show_all() - add(entry.FilterEntry(), True, True) - add(button.OpenButton()) - add(button.ExportButton()) - add(button.ClearButton()) - add(button.RandomButton()) - add(button.VolumeButton()) - -def add(widget, expand = False, fill = False): - bar.pack_start(widget, expand, fill) - + bar_add(entry.FilterEntry(), True, True) + bar_add(button.OpenButton()) + bar_add(button.ExportButton()) + bar_add(button.ClearButton()) + bar_add(button.RandomButton()) + bar_add(button.VolumeButton()) init() diff --git a/ocarina/info.py b/ocarina/info.py index 9fa0ba92..4a150e43 100644 --- a/ocarina/info.py +++ b/ocarina/info.py @@ -16,53 +16,6 @@ file_to_id = libsaria.sources.file_to_id 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 InfoBar(Bar): - def __init__(self, up_button): - Bar.__init__(self, True) - global button - global libsaria - - self.title = gtk.Label(ocarina.__vers__) - self.title.show() - self.title.set_ellipsize(pango.ELLIPSIZE_END) - - self.pack(self.title, True, True) - self.pack(label.TimeLabel()) - self.pack(label.LengthLabel2()) - self.pack(button.RewindButton()) - self.pack(button.ForwardButton()) - self.pack(button.PlayButton()) - self.pack(button.PauseButton()) - self.pack(button.StopButton()) - self.pack(button.NextButton()) - self.pack(button.UpButton(up_button)) - - libsaria.event.invite("POSTLOAD", self.change_title) - - def change_title(self, filepath): - id = file_to_id(filepath) - title, artist = get_attrs(id, "title", "artist") - self.title.set_text("%s by %s" % (title, artist)) - class InfoTab(gtk.Notebook): def __init__(self, down_button): @@ -144,8 +97,6 @@ class TwoWayPane(InfoBar): def init(): - global info - global filter global button global entry global pbar