Added page footer

This is the second half of my old ocarina.info file.  So far it is just
the toolbar.
This commit is contained in:
Bryan Schumaker 2010-11-25 14:18:45 -05:00
parent 27a964c58a
commit eec2404b8a
4 changed files with 71 additions and 59 deletions

View File

@ -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)

57
ocarina/footer.py Normal file
View File

@ -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()

View File

@ -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()

View File

@ -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