Config of gramplet keeps track of details if it is in a split pane

svn: r14294
This commit is contained in:
Doug Blank 2010-02-09 13:14:37 +00:00
parent fcdee6708a
commit f382665850

View File

@ -735,7 +735,12 @@ class GrampletPane(gtk.ScrolledWindow):
def __init__(self, configfile, pageview, dbstate, uistate, **kwargs):
gtk.ScrolledWindow.__init__(self)
self.configfile = os.path.join(const.VERSION_DIR, "%s.ini" % configfile)
self.column_count = kwargs.get("column_count", 2) # default for new user
# default for new user; may be overridden in config:
self.column_count = kwargs.get("column_count", 2)
# width of window, if sidebar; may be overridden in config:
self.pane_width = kwargs.get("pane_width", 250 * self.column_count)
self.pane_other_width = kwargs.get("pane_other_width", -1)
self.pane_position = kwargs.get("pane_position", -1)
self.default_gramplets = kwargs.get("default_gramplets",
["Top Surnames Gramplet", "Welcome Gramplet"])
self.dbstate = dbstate
@ -865,6 +870,12 @@ class GrampletPane(gtk.ScrolledWindow):
if sec == "Gramplet View Options":
if "column_count" in cp.options(sec):
self.column_count = int(cp.get(sec, "column_count"))
if "pane_width" in cp.options(sec):
self.pane_width = int(cp.get(sec, "pane_width"))
if "pane_other_width" in cp.options(sec):
self.pane_other_width = int(cp.get(sec, "pane_other_width"))
if "pane_position" in cp.options(sec):
self.pane_position = int(cp.get(sec, "pane_position"))
else:
data = {"title": sec}
for opt in cp.options(sec):
@ -897,7 +908,10 @@ class GrampletPane(gtk.ScrolledWindow):
fp.write(";; Gramps gramplets file" + NL)
fp.write((";; Automatically created at %s" % time.strftime("%Y/%m/%d %H:%M:%S")) + NL + NL)
fp.write("[Gramplet View Options]" + NL)
fp.write(("column_count=%d" + NL + NL) % self.column_count)
fp.write(("column_count=%d" + NL) % self.column_count)
fp.write(("pane_position=%d" + NL) % self.pane_position)
fp.write(("pane_other_width=%d" + NL) % self.pane_other_width)
fp.write(("pane_width=%d" + NL + NL) % self.pane_width)
# showing gramplets:
for col in range(self.column_count):
row = 0