diff --git a/src/gen/plug/_gramplet.py b/src/gen/plug/_gramplet.py index 75dad10a2..0e38ee7ff 100644 --- a/src/gen/plug/_gramplet.py +++ b/src/gen/plug/_gramplet.py @@ -376,12 +376,21 @@ class Gramplet(object): Add an option to the GUI gramplet. """ from PluginUtils import make_gui_option - #tooltips, dbstate, uistate, track widget, label = make_gui_option( - option, self.dbstate, self.uistate, []) - self.option_dict.update({option.get_label(): (widget, option)}) + option, self.dbstate, self.uistate, []) + self.option_dict.update({option.get_label(): [widget, option]}) self.option_order.append(option.get_label()) + def get_gui_option(self, label): + """ + Reconstruct a deleted widget. + """ + from PluginUtils import make_gui_option + dummy, option = self.option_dict[label] + widget, label = make_gui_option( + option, self.dbstate, self.uistate, []) + return widget + def save_update_options(self, obj): """ Save a gramplet's options to file. diff --git a/src/gui/widgets/grampletpane.py b/src/gui/widgets/grampletpane.py index 9b8d4fab4..62c4483c7 100644 --- a/src/gui/widgets/grampletpane.py +++ b/src/gui/widgets/grampletpane.py @@ -600,6 +600,7 @@ class GuiGramplet(object): def make_gui_options(self): if not self.pui: return if len(self.pui.option_order) == 0: return + frame = gtk.Frame() topbox = gtk.VBox() hbox = gtk.HBox() labels = gtk.VBox() @@ -611,12 +612,16 @@ class GuiGramplet(object): label = gtk.Label(item + ":") label.set_alignment(1.0, 0.5) labels.add(label) - options.add(self.pui.option_dict[item][0]) # widget + # The original may have been deleted when the dialog closed: + #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) topbox.add(save_button) - topbox.show_all() save_button.connect('clicked', self.pui.save_update_options) - return topbox + frame.add(topbox) + frame.show_all() + return frame def link(self, text, link_type, data, size=None, tooltip=None): buffer = self.buffer