ocarina/ocarina/body/page.py
Bryan Schumaker dfa3eb0af1 Move Page() class to new file
This helps with my cleanup
2011-05-01 12:03:42 -04:00

44 lines
1.0 KiB
Python

# Bryan Schumaker (4 / 17 / 2011)
import gtk
import header
import footer
class Page(gtk.VBox):
def __init__(self, content, add_header, add_footer):
gtk.VBox.__init__(self)
self.content = content
self.attrs = content.__dict__
self.vis_func = self.attrs.get("visible", None)
self.invis_func = self.attrs.get("invisible", None)
self.add_header = add_header
self.add_footer = add_footer
self.show()
def filter(self, text):
self.content.filter(text)
def reset(self):
self.content.reset()
def goto(self):
self.content.goto()
def visible(self):
if self.add_header == True:
self.pack_start(header.header, False, False)
self.pack_start(self.content, True, True)
if self.add_footer == True:
self.pack_start(footer.footer, False, False)
if self.vis_func:
self.vis_func()
def invisible(self):
if self.add_header == True:
self.remove(header.header)
self.remove(self.content)
if self.add_footer == True:
self.remove(footer.footer)
if self.invis_func:
self.invis_func()