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:
parent
8674fd8f17
commit
c5a7508573
|
@ -1,6 +1,6 @@
|
||||||
# Bryan Schumaker (8 / 12 / 2010)
|
# Bryan Schumaker (8 / 12 / 2010)
|
||||||
|
|
||||||
get = dict.get
|
get = dict.get
|
||||||
|
|
||||||
class TagNode(dict):
|
class TagNode(dict):
|
||||||
def __init__(self, id):
|
def __init__(self, id):
|
||||||
|
@ -15,7 +15,19 @@ class TagNode(dict):
|
||||||
|
|
||||||
self["filepath"] = filepath
|
self["filepath"] = filepath
|
||||||
self["playcount"] = 0
|
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):
|
def walk(self):
|
||||||
yield self
|
yield self
|
||||||
|
|
|
@ -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
|
|
@ -11,6 +11,8 @@ tabs = None
|
||||||
contents = dict()
|
contents = dict()
|
||||||
cur_page = 0
|
cur_page = 0
|
||||||
|
|
||||||
|
bottom = None
|
||||||
|
|
||||||
|
|
||||||
class TabPage(gtk.VBox):
|
class TabPage(gtk.VBox):
|
||||||
def __init__(self, content):
|
def __init__(self, content):
|
||||||
|
@ -20,15 +22,25 @@ class TabPage(gtk.VBox):
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def visible(self):
|
def visible(self):
|
||||||
|
global bottom
|
||||||
|
if bottom is not None:
|
||||||
|
self.pack_end(bottom, False, False)
|
||||||
if hasattr(self.content, "visible"):
|
if hasattr(self.content, "visible"):
|
||||||
self.content.visible()
|
self.content.visible()
|
||||||
|
|
||||||
def invisible(self):
|
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"):
|
if hasattr(self.content, "invisible"):
|
||||||
self.content.invisible()
|
self.content.invisible()
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
import info
|
||||||
|
global bottom
|
||||||
|
info.init()
|
||||||
|
bottom = info.get_info()
|
||||||
global tabs
|
global tabs
|
||||||
tabs = gtk.Notebook()
|
tabs = gtk.Notebook()
|
||||||
tabs.set_tab_pos(gtk.POS_LEFT)
|
tabs.set_tab_pos(gtk.POS_LEFT)
|
||||||
|
@ -60,7 +72,7 @@ def remove_page(text):
|
||||||
def switch_page(notebook, page, page_num):
|
def switch_page(notebook, page, page_num):
|
||||||
global cur_page
|
global cur_page
|
||||||
old = notebook.get_nth_page(cur_page)
|
old = notebook.get_nth_page(cur_page)
|
||||||
old.invisible()
|
|
||||||
new = notebook.get_nth_page(page_num)
|
new = notebook.get_nth_page(page_num)
|
||||||
|
old.invisible()
|
||||||
new.visible()
|
new.visible()
|
||||||
cur_page = page_num
|
cur_page = page_num
|
||||||
|
|
Loading…
Reference in New Issue