Workaround for redisplay widget issue; added pane orientation

svn: r14354
This commit is contained in:
Doug Blank 2010-02-13 17:45:28 +00:00
parent 6cf43dd3d8
commit 48ff4b42d5

View File

@ -612,10 +612,7 @@ class GuiGramplet(object):
label = gtk.Label(item + ":") label = gtk.Label(item + ":")
label.set_alignment(1.0, 0.5) label.set_alignment(1.0, 0.5)
labels.add(label) labels.add(label)
# The original may have been deleted when the dialog closed: options.add(self.pui.option_dict[item][0]) # widget
#options.add(self.pui.option_dict[item][0]) # widget
# so we regenerate:
options.add(self.pui.get_gui_option(item)) # widget
save_button = gtk.Button(stock=gtk.STOCK_SAVE) save_button = gtk.Button(stock=gtk.STOCK_SAVE)
topbox.add(save_button) topbox.add(save_button)
save_button.connect('clicked', self.pui.save_update_options) save_button.connect('clicked', self.pui.save_update_options)
@ -808,6 +805,7 @@ class GrampletPane(gtk.ScrolledWindow):
self.column_count = kwargs.get("column_count", 2) self.column_count = kwargs.get("column_count", 2)
# width of window, if sidebar; may be overridden in config: # width of window, if sidebar; may be overridden in config:
self.pane_position = kwargs.get("pane_position", -1) self.pane_position = kwargs.get("pane_position", -1)
self.pane_orientation = kwargs.get("pane_orientation", "horizontal")
self.default_gramplets = kwargs.get("default_gramplets", self.default_gramplets = kwargs.get("default_gramplets",
["Top Surnames Gramplet", "Welcome Gramplet"]) ["Top Surnames Gramplet", "Welcome Gramplet"])
self.dbstate = dbstate self.dbstate = dbstate
@ -958,6 +956,8 @@ class GrampletPane(gtk.ScrolledWindow):
self.column_count = int(cp.get(sec, "column_count")) self.column_count = int(cp.get(sec, "column_count"))
if "pane_position" in cp.options(sec): if "pane_position" in cp.options(sec):
self.pane_position = int(cp.get(sec, "pane_position")) self.pane_position = int(cp.get(sec, "pane_position"))
if "pane_orientation" in cp.options(sec):
self.pane_orientation = cp.get(sec, "pane_orientation")
else: else:
data = {"title": sec} data = {"title": sec}
for opt in cp.options(sec): for opt in cp.options(sec):
@ -996,6 +996,7 @@ class GrampletPane(gtk.ScrolledWindow):
fp.write("[Gramplet View Options]" + NL) fp.write("[Gramplet View Options]" + NL)
fp.write(("column_count=%d" + 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_position=%d" + NL) % self.pane_position)
fp.write(("pane_orientation=%s" + NL) % self.pane_orientation)
fp.write(NL) fp.write(NL)
# showing gramplets: # showing gramplets:
for col in range(self.column_count): for col in range(self.column_count):
@ -1306,6 +1307,15 @@ class GrampletPane(gtk.ScrolledWindow):
return _('Gramplet Layout'), table return _('Gramplet Layout'), table
def build_panel(self, gramplet): def build_panel(self, gramplet):
# BEGIN WORKAROUND:
# This is necessary because gtk doesn't redisplay these widgets correctly
# so we replace them with new ones
if gramplet.pui:
gramplet.pui.save_options()
gramplet.pui.update_options = {}
gramplet.pui.option_order = []
gramplet.pui.build_options()
# END WORKAROUND
self._config.register("%s.title" % gramplet.title, self._config.register("%s.title" % gramplet.title,
str, gramplet.get_title, gramplet.set_title) str, gramplet.get_title, gramplet.set_title)
self._config.register("%s.height" % gramplet.title, self._config.register("%s.height" % gramplet.title,