def addBg(self):
"""Adds a new background to the list of backgrounds."""
self.bgs += [gtk.Table(4, 3, False)]
createLabel(self.bgs[-1], text="Corner Rounding (px)", gridX=0, gridY=0, xPadding=10)
createEntry(self.bgs[-1], maxSize=7, width=9, text=BG_ROUNDING, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred, name="rounded")
createLabel(self.bgs[-1], text="Background Color", gridX=0, gridY=1, xPadding=10)
temp = gtk.Entry(7)
temp.set_width_chars(9)
temp.set_name("bgColEntry")
temp.set_text(self.defaults["bgColor"])
temp.connect("changed", self.changeOccurred)
temp.connect("activate", self.colorTyped)
self.bgs[-1].attach(temp, 1, 2, 1, 2, xoptions=gtk.EXPAND)
temp = gtk.ColorButton(gtk.gdk.color_parse(self.defaults["bgColor"]))
temp.set_use_alpha(True)
temp.set_name("bgCol")
temp.connect("color-set", self.colorChange)
self.bgs[-1].attach(temp, 2, 3, 1, 2, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)
createLabel(self.bgs[-1], text="Border Width (px)", gridX=0, gridY=2, xPadding=10)
createEntry(self.bgs[-1], maxSize=7, width=9, text=BG_BORDER, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred, name="border")
createLabel(self.bgs[-1], text="Border Color", gridX=0, gridY=3, xPadding=10)
temp = gtk.Entry(7)
temp.set_width_chars(9)
temp.set_name("borderColEntry")
temp.connect("activate", self.colorTyped)
temp.set_text(self.defaults["borderColor"])
temp.connect("changed", self.changeOccurred)
self.bgs[-1].attach(temp, 1, 2, 3, 4, xoptions=gtk.EXPAND)
temp = gtk.ColorButton(gtk.gdk.color_parse(self.defaults["borderColor"]))
temp.set_use_alpha(True)
temp.set_name("borderCol")
temp.connect("color-set", self.colorChange)
self.bgs[-1].attach(temp, 2, 3, 3, 4, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)
# Note: Only set init to True when initialising background styles.
# This prevents unwanted calls to changeOccurred()
评论列表
文章目录