diff --git a/libsaria/collection/tree.py b/libsaria/collection/tree.py index 5d5f10c4..7f8d72ae 100644 --- a/libsaria/collection/tree.py +++ b/libsaria/collection/tree.py @@ -1,6 +1,6 @@ # Bryan Schumaker (8 / 12 / 2010) -get = dict.get +get = dict.get class TagNode(dict): def __init__(self, id): @@ -15,7 +15,19 @@ class TagNode(dict): self["filepath"] = filepath self["playcount"] = 0 - self["length"] = audio.length + + length = audio.length + sf = 0 + sec = length % 60 + if sec >= 10: + sf = "" + min = (length - sec) / 60 + mf = 0 + if min >= 10: + mf = "" + + self["seconds"] = audio.length + self["length"] = "%s%s:%s%s" % (mf, min, sf, sec) def walk(self): yield self diff --git a/ocarina/info.py b/ocarina/info.py new file mode 100644 index 00000000..89ee9b4f --- /dev/null +++ b/ocarina/info.py @@ -0,0 +1,23 @@ +# Bryan Schumaker (8/22/2010) + +import ocarina +gtk = ocarina.gtk + +info = gtk.VBox() +info.show() + +hsep = gtk.HSeparator() +hsep.show() + +info.pack_start(hsep) + + +def init(): + global info + label = gtk.Label("Test label") + label.show() + info.pack_start(label) + +def get_info(): + global info + return info diff --git a/ocarina/tabs.py b/ocarina/tabs.py index 94106a2e..b9f4dd10 100644 --- a/ocarina/tabs.py +++ b/ocarina/tabs.py @@ -11,6 +11,8 @@ tabs = None contents = dict() cur_page = 0 +bottom = None + class TabPage(gtk.VBox): def __init__(self, content): @@ -20,15 +22,25 @@ class TabPage(gtk.VBox): self.show() def visible(self): + global bottom + if bottom is not None: + self.pack_end(bottom, False, False) if hasattr(self.content, "visible"): self.content.visible() def invisible(self): + global bottom + if bottom is not None and bottom.get_parent() is not None: + self.remove(bottom) if hasattr(self.content, "invisible"): self.content.invisible() def init(): + import info + global bottom + info.init() + bottom = info.get_info() global tabs tabs = gtk.Notebook() tabs.set_tab_pos(gtk.POS_LEFT) @@ -60,7 +72,7 @@ def remove_page(text): def switch_page(notebook, page, page_num): global cur_page old = notebook.get_nth_page(cur_page) - old.invisible() new = notebook.get_nth_page(page_num) + old.invisible() new.visible() cur_page = page_num