diff --git a/src/gui/plug/_guioptions.py b/src/gui/plug/_guioptions.py index 3f29e5021..cd853b5cf 100644 --- a/src/gui/plug/_guioptions.py +++ b/src/gui/plug/_guioptions.py @@ -1468,10 +1468,7 @@ class GuiMenuOptions(object): widget, label = make_gui_option(option, dialog.dbstate, dialog.uistate, dialog.track) - - if widget is None: - print "UNKNOWN OPTION: ", option - else: + if widget is not None: if label: dialog.add_frame_option(category, option.get_label(), @@ -1487,6 +1484,24 @@ class GuiMenuOptions(object): option = self.menu.get_option_by_name(name) self.options_dict[name] = option.get_value() + def init_selection(self, dbstate, uistate): + """ + Initialize selection options for GUI. + """ + pass + + def save_selection(self): + """ + Move selection options to handler. + """ + pass + + def build_selection(self): + """ + Move selection options to handler. + """ + pass + def make_gui_option(option, dbstate, uistate, track): """ Stand-alone function so that Options can be used in other @@ -1529,6 +1544,8 @@ def make_gui_option(option, dbstate, uistate, track): widget = GuiPlaceListOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.BooleanListOption): widget = GuiBooleanListOption(option, dbstate, uistate, track) + elif isinstance(option, gen.plug.menu.Option): + return None, None # No Gui representation for this elif option.__class__ in external_options: widget = external_options[option.__class__](option, dbstate, uistate, track) diff --git a/src/gui/plug/report/_reportdialog.py b/src/gui/plug/report/_reportdialog.py index b2982bcaf..93e0b763b 100644 --- a/src/gui/plug/report/_reportdialog.py +++ b/src/gui/plug/report/_reportdialog.py @@ -89,6 +89,7 @@ class ReportDialog(ManagedWindow.ManagedWindow): self.firstpage_added = False self.raw_name = name self.dbstate = dbstate + self.uistate = uistate self.db = dbstate.db self.report_name = trans_name @@ -104,7 +105,7 @@ class ReportDialog(ManagedWindow.ManagedWindow): self.options = option_class(self.raw_name, self.db) except TypeError: self.options = option_class - + self.options.init_selection(self.dbstate, self.uistate) self.options.load_previous_values() def build_window_key(self, obj): @@ -168,6 +169,7 @@ class ReportDialog(ManagedWindow.ManagedWindow): self.window.vbox.add(self.notebook) self.setup_report_options_frame() + self.setup_selection_frame() self.setup_other_frames() self.notebook.set_current_page(0) @@ -306,6 +308,13 @@ class ReportDialog(ManagedWindow.ManagedWindow): style = self.options.handler.get_default_stylesheet_name() self.build_style_menu(style) + def setup_selection_frame(self): + widget = self.options.build_selection() + if widget: + l = gtk.Label("%s" % _("Selection Options")) + l.set_use_markup(True) + self.notebook.append_page(widget, l) + def setup_report_options_frame(self): """Set up the report options frame of the dialog. This function relies on several report_xxx() customization @@ -545,6 +554,7 @@ class ReportDialog(ManagedWindow.ManagedWindow): self.parse_user_options() # Save options + self.options.save_selection() self.options.handler.save_options() def on_cancel(self, *obj):