ocarina/src/extra/oGtk/box.py

43 lines
818 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Mar 14, 2010 10:59:25 PM$"
import gtk
import guibuilder
def getAttrs(attrs):
homogeneous = False
spacing = 0
for a in attrs:
if a == "homog" and attrs[a] == "True":
homogeneous = True
elif a == "spacing":
spacing = int(attrs[a])
return homogeneous, spacing
class HBox(gtk.HBox):
def __init__(self,attrs):
h,s = getAttrs(attrs)
gtk.HBox.__init__(self,h,s)
self.show()
class VBox(gtk.VBox):
def __init__(self,attrs):
h,s = getAttrs(attrs)
gtk.VBox.__init__(self,h,s)
self.show()
def make_hbox(attrs):return HBox(attrs)
def make_vbox(attrs):return VBox(attrs)
guibuilder.parts["hbox"] = make_hbox
guibuilder.parts["vbox"] = make_vbox