Began bottom pane

I only need to create one bottom pane instance now.  When the tabs are
changed, the object will be removed from the old tab and added to the
new one.  This will preserve the state of the pane between tabs.
This commit is contained in:
Bryan Schumaker 2010-08-22 12:40:39 -04:00
parent 8674fd8f17
commit c5a7508573
3 changed files with 50 additions and 3 deletions

View File

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

23
ocarina/info.py Normal file
View File

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

View File

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