Convert DetDescendantReport and DetAncestralReport to use MenuOption.
svn: r9606
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2007-12-27  Brian Matherly <brian@gramps-project.org> | ||||||
|  | 	* src/plugins/DetDescendantReport.py: | ||||||
|  | 	* src/plugins/DetAncestralReport.py: | ||||||
|  | 	Convert to use MenuOption | ||||||
|  |  | ||||||
| 2007-12-27  Douglas S. Blank  <dblank@cs.brynmawr.edu> | 2007-12-27  Douglas S. Blank  <dblank@cs.brynmawr.edu> | ||||||
| 	* src/PluginUtils/_Options.py: Bug #1486, type error on option read | 	* src/PluginUtils/_Options.py: Bug #1486, type error on option read | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,15 +44,12 @@ import gtk | |||||||
| # | # | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| import gen.lib | import gen.lib | ||||||
| from PluginUtils import register_report | from PluginUtils import register_report, NumberOption, BooleanOption | ||||||
| from ReportBase import Report, ReportUtils, ReportOptions, \ | from ReportBase import Report, ReportUtils, MenuReportOptions, \ | ||||||
|      CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI |      CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI | ||||||
| from ReportBase import Bibliography, Endnotes | from ReportBase import Bibliography, Endnotes | ||||||
|  |  | ||||||
| import BaseDoc | import BaseDoc | ||||||
| import Utils |  | ||||||
| import DateHandler | import DateHandler | ||||||
| from QuestionDialog import ErrorDialog |  | ||||||
| from BasicUtils import name_displayer as _nd | from BasicUtils import name_displayer as _nd | ||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| @@ -653,91 +650,97 @@ class DetAncestorReport(Report): | |||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| # | # | ||||||
| # | # DetAncestorOptions | ||||||
| # | # | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| class DetAncestorOptions(ReportOptions): | class DetAncestorOptions(MenuReportOptions): | ||||||
|  |  | ||||||
|     """ |     """ | ||||||
|     Defines options and provides handling interface. |     Defines options and provides handling interface. | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|     def __init__(self,name,person_id=None): |     def __init__(self,name,person_id=None): | ||||||
|         ReportOptions.__init__(self,name,person_id) |         MenuReportOptions.__init__(self,name,person_id) | ||||||
|  |          | ||||||
|  |     def add_menu_options(self,menu): | ||||||
|  |         category_name = _("Report Options") | ||||||
|  |          | ||||||
|  |         gen = NumberOption(_("Generations"),10,1,100) | ||||||
|  |         gen.set_help(_("The number of generations to include in the report")) | ||||||
|  |         menu.add_option(category_name,"gen",gen) | ||||||
|  |          | ||||||
|  |         pagebbg = BooleanOption(_("Page break between generations"),False) | ||||||
|  |         pagebbg.set_help( | ||||||
|  |                      _("Whether to start a new page after each generation.")) | ||||||
|  |         menu.add_option(category_name,"pagebbg",pagebbg) | ||||||
|  |          | ||||||
|  |         category_name = _("Content") | ||||||
|  |  | ||||||
|         # Options specific for this report |         usecall = BooleanOption(_("Use callname for common name"),False) | ||||||
|         self.options_dict = { |         usecall.set_help(_("Whether to use the call name as the first name.")) | ||||||
|             'gen'           : 10, |         menu.add_option(category_name,"usecall",usecall) | ||||||
|             'pagebbg'       : 0, |          | ||||||
|             'fulldates'     : 1, |         fulldates = BooleanOption( | ||||||
|             'listc'         : 1, |                               _("Use full dates instead of only the year"),True) | ||||||
|             'incnotes'      : 1, |         fulldates.set_help(_("Whether to use full dates instead of just year.")) | ||||||
|             'incattrs'      : 0, |         menu.add_option(category_name,"fulldates",fulldates) | ||||||
|             'usecall'       : 1, |          | ||||||
|             'repplace'      : 0, |         listc = BooleanOption(_("List children"),True) | ||||||
|             'repdate'       : 0, |         listc.set_help(_("Whether to list children.")) | ||||||
|             'computeage'    : 1, |         menu.add_option(category_name,"listc",listc) | ||||||
|             'omitda'        : 1, |          | ||||||
|             'desref'        : 1, |         computeage = BooleanOption(_("Compute age"),True) | ||||||
|             'incphotos'     : 0, |         computeage.set_help(_("Whether to compute age.")) | ||||||
|             'incnames'      : 0, |         menu.add_option(category_name,"computeage",computeage) | ||||||
|             'incevents'     : 0, |          | ||||||
|             'incaddresses'  : 0, |         omitda = BooleanOption(_("Omit duplicate ancestors"),True) | ||||||
|             'incsources'    : 0, |         omitda.set_help(_("Whether to omit duplicate ancestors.")) | ||||||
|         } |         menu.add_option(category_name,"omitda",omitda) | ||||||
|         self.options_help = { |  | ||||||
|             'gen'           : ("=int","Generations", |         desref = BooleanOption(_("Add descendant reference in child list"),True) | ||||||
|                             "The number of generations to include in the report", |         desref.set_help( | ||||||
|                             True), |                     _("Whether to add descendant references in child list.")) | ||||||
|             'pagebbg'       : ("=0/1","Page Break Between Generations", |         menu.add_option(category_name,"desref",desref) | ||||||
|                             ["No line break", "Insert line break"], |  | ||||||
|                             False), |         category_name = _("Include") | ||||||
|             'fulldates'     : ("=0/1","Whether to use full dates instead of just year.", |          | ||||||
|                             ["Do not use full dates","Use full dates"], |         incnotes = BooleanOption(_("Include notes"),True) | ||||||
|                             True), |         incnotes.set_help(_("Whether to include notes.")) | ||||||
|             'listc'         : ("=0/1","Whether to list children.", |         menu.add_option(category_name,"incnotes",incnotes) | ||||||
|                             ["Do not list children","List children"], |  | ||||||
|                             True), |         incattrs = BooleanOption(_("Include attributes"),False) | ||||||
|             'incnotes'      : ("=0/1","Whether to include notes.", |         incattrs.set_help(_("Whether to include attributes.")) | ||||||
|                             ["Do not include notes","Include notes"], |         menu.add_option(category_name,"incattrs",incattrs) | ||||||
|                             True), |          | ||||||
|             'incattrs'      : ("=0/1","Whether to include attributes.", |         incphotos = BooleanOption(_("Include Photo/Images from Gallery"),False) | ||||||
|                             ["Do not include attributes","Include attributes"], |         incphotos.set_help(_("Whether to include images.")) | ||||||
|                             True), |         menu.add_option(category_name,"incphotos",incphotos) | ||||||
|             'usecall'       : ("=0/1","Whether to use the call name as the first name.", |  | ||||||
|                             ["Do not use call name","Use call name"], |         incnames = BooleanOption(_("Include alternative names"),False) | ||||||
|                             True), |         incnames.set_help(_("Whether to include other names.")) | ||||||
|             'repplace'      : ("=0/1","Whether to replace missing Places with blanks.", |         menu.add_option(category_name,"incnames",incnames) | ||||||
|                             ["Do not replace missing Places","Replace missing Places"], |  | ||||||
|                             True), |         incevents = BooleanOption(_("Include events"),False) | ||||||
|             'repdate'       : ("=0/1","Whether to replace missing Dates with blanks.", |         incevents.set_help(_("Whether to include events.")) | ||||||
|                             ["Do not replace missing Dates","Replace missing Dates"], |         menu.add_option(category_name,"incevents",incevents) | ||||||
|                             True), |  | ||||||
|             'computeage'    : ("=0/1","Whether to compute age.", |         incaddresses = BooleanOption(_("Include addresses"),False) | ||||||
|                             ["Do not compute age","Compute age"], |         incaddresses.set_help(_("Whether to include addresses.")) | ||||||
|                             True), |         menu.add_option(category_name,"incaddresses",incaddresses) | ||||||
|             'omitda'        : ("=0/1","Whether to omit duplicate ancestors.", |  | ||||||
|                             ["Do not omit duplicates","Omit duplicates"], |         incsources = BooleanOption(_("Include sources"),False) | ||||||
|                             True), |         incsources.set_help(_("Whether to include source references.")) | ||||||
|             'desref'        : ("=0/1","Whether to add descendant references in child list.", |         menu.add_option(category_name,"incsources",incsources) | ||||||
|                             ["Do not add references","Add references"], |          | ||||||
|                             True), |         category_name = _("Missing information")         | ||||||
|             'incphotos'     : ("=0/1","Whether to include images.", |  | ||||||
|                             ["Do not include images","Include images"], |         repplace = BooleanOption(_("Replace missing places with ______"),False) | ||||||
|                             True), |         repplace.set_help(_("Whether to replace missing Places with blanks.")) | ||||||
|             'incnames'      : ("=0/1","Whether to include other names.", |         menu.add_option(category_name,"repplace",repplace) | ||||||
|                             ["Do not include other names","Include other names"], |  | ||||||
|                             True), |         repdate = BooleanOption(_("Replace missing dates with ______"),False) | ||||||
|             'incevents'     : ("=0/1","Whether to include events.", |         repdate.set_help(_("Whether to replace missing Dates with blanks.")) | ||||||
|                             ["Do not include events","Include events"], |         menu.add_option(category_name,"repdate",repdate) | ||||||
|                             True), |  | ||||||
|             'incaddresses': ("=0/1","Whether to include addresses.", |  | ||||||
|                             ["Do not include addresses","Include addresses"], |  | ||||||
|                             True), |  | ||||||
|             'incsources'    : ("=0/1","Whether to include source references.", |  | ||||||
|                             ["Do not include sources","Include sources"], |  | ||||||
|                             True), |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|     def make_default_style(self,default_style): |     def make_default_style(self,default_style): | ||||||
|         """Make the default output style for the Detailed Ancestral Report""" |         """Make the default output style for the Detailed Ancestral Report""" | ||||||
| @@ -827,120 +830,6 @@ class DetAncestorOptions(ReportOptions): | |||||||
|  |  | ||||||
|         Endnotes.add_endnote_styles(default_style) |         Endnotes.add_endnote_styles(default_style) | ||||||
|  |  | ||||||
|     def add_user_options(self,dialog): |  | ||||||
|         """ |  | ||||||
|         Override the base class add_user_options task to add a menu that allows |  | ||||||
|         the user to select the sort method. |  | ||||||
|         """ |  | ||||||
|         self.max_gen = gtk.SpinButton(gtk.Adjustment(1,1,100,1)) |  | ||||||
|         self.max_gen.set_value(self.options_dict['gen']) |  | ||||||
|          |  | ||||||
|         self.cb_pagebreak = gtk.CheckButton (_("Page break between generations")) |  | ||||||
|         self.cb_pagebreak.set_active (self.options_dict['pagebbg']) |  | ||||||
|  |  | ||||||
|         # Full date usage |  | ||||||
|         self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year")) |  | ||||||
|         self.full_date_option.set_active(self.options_dict['fulldates']) |  | ||||||
|  |  | ||||||
|         # Children List |  | ||||||
|         self.list_children_option = gtk.CheckButton(_("List children")) |  | ||||||
|         self.list_children_option.set_active(self.options_dict['listc']) |  | ||||||
|  |  | ||||||
|         # Print notes |  | ||||||
|         self.include_notes_option = gtk.CheckButton(_("Include notes")) |  | ||||||
|         self.include_notes_option.set_active(self.options_dict['incnotes']) |  | ||||||
|      |  | ||||||
|         # Print attributes |  | ||||||
|         self.include_attributes_option = gtk.CheckButton(_("Include attributes")) |  | ||||||
|         self.include_attributes_option.set_active(self.options_dict['incattrs']) |  | ||||||
|  |  | ||||||
|         # Print callname |  | ||||||
|         self.usecall = gtk.CheckButton(_("Use callname for common name")) |  | ||||||
|         self.usecall.set_active(self.options_dict['usecall']) |  | ||||||
|  |  | ||||||
|         # Replace missing Place with ___________ |  | ||||||
|         self.place_option = gtk.CheckButton(_("Replace missing places with ______")) |  | ||||||
|         self.place_option.set_active(self.options_dict['repplace']) |  | ||||||
|  |  | ||||||
|         # Replace missing dates with __________ |  | ||||||
|         self.date_option = gtk.CheckButton(_("Replace missing dates with ______")) |  | ||||||
|         self.date_option.set_active(self.options_dict['repdate']) |  | ||||||
|  |  | ||||||
|         # Add "Died at the age of NN" in text |  | ||||||
|         self.age_option = gtk.CheckButton(_("Compute age")) |  | ||||||
|         self.age_option.set_active(self.options_dict['computeage']) |  | ||||||
|  |  | ||||||
|         # Omit duplicate persons, occurs when distant cousins marry |  | ||||||
|         self.dupPersons_option = gtk.CheckButton(_("Omit duplicate ancestors")) |  | ||||||
|         self.dupPersons_option.set_active(self.options_dict['omitda']) |  | ||||||
|  |  | ||||||
|         #Add descendant reference in child list |  | ||||||
|         self.childRef_option = gtk.CheckButton(_("Add descendant reference in child list")) |  | ||||||
|         self.childRef_option.set_active(self.options_dict['desref']) |  | ||||||
|  |  | ||||||
|         #Add photo/image reference |  | ||||||
|         self.image_option = gtk.CheckButton(_("Include Photo/Images from Gallery")) |  | ||||||
|         self.image_option.set_active(self.options_dict['incphotos']) |  | ||||||
|  |  | ||||||
|         # Print alternative names |  | ||||||
|         self.include_names_option = gtk.CheckButton(_("Include alternative names")) |  | ||||||
|         self.include_names_option.set_active(self.options_dict['incnames']) |  | ||||||
|  |  | ||||||
|         # Print events |  | ||||||
|         self.include_events_option = gtk.CheckButton(_("Include events")) |  | ||||||
|         self.include_events_option.set_active(self.options_dict['incevents']) |  | ||||||
|          |  | ||||||
|         # Print addresses |  | ||||||
|         self.include_addresses_option = gtk.CheckButton(_("Include addresses")) |  | ||||||
|         self.include_addresses_option.set_active(self.options_dict['incaddresses']) |  | ||||||
|  |  | ||||||
|         # Print sources |  | ||||||
|         self.include_sources_option = gtk.CheckButton(_("Include sources")) |  | ||||||
|         self.include_sources_option.set_active(self.options_dict['incsources']) |  | ||||||
|  |  | ||||||
|         # Add new options. The first argument is the tab name for grouping options. |  | ||||||
|         # if you want to put everyting in the generic "Options" category, use |  | ||||||
|         # self.add_option(text,widget) instead of self.add_frame_option(category,text,widget) |  | ||||||
|         dialog.add_option(_('Generations'),self.max_gen) |  | ||||||
|         dialog.add_option ('', self.cb_pagebreak) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.usecall) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.full_date_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.list_children_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.age_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.dupPersons_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.childRef_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.image_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_notes_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_attributes_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_names_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_events_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_addresses_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_sources_option) |  | ||||||
|         dialog.add_frame_option(_('Missing information'),'',self.place_option) |  | ||||||
|         dialog.add_frame_option(_('Missing information'),'',self.date_option) |  | ||||||
|  |  | ||||||
|     def parse_user_options(self,dialog): |  | ||||||
|         """ |  | ||||||
|         Parses the custom options that we have added. |  | ||||||
|         """ |  | ||||||
|         self.options_dict['gen'] = self.max_gen.get_value_as_int() |  | ||||||
|         self.options_dict['pagebbg'] = int(self.cb_pagebreak.get_active ()) |  | ||||||
|         self.options_dict['fulldates'] = int(self.full_date_option.get_active()) |  | ||||||
|         self.options_dict['listc'] = int(self.list_children_option.get_active()) |  | ||||||
|         self.options_dict['incnotes'] = int(self.include_notes_option.get_active()) |  | ||||||
|         self.options_dict['incattrs'] = int(self.include_attributes_option.get_active()) |  | ||||||
|         self.options_dict['usecall'] = int(self.usecall.get_active()) |  | ||||||
|         self.options_dict['repplace'] = int(self.place_option.get_active()) |  | ||||||
|         self.options_dict['repdate'] = int(self.date_option.get_active()) |  | ||||||
|         self.options_dict['computeage'] = int(self.age_option.get_active()) |  | ||||||
|         self.options_dict['omitda'] = int(self.dupPersons_option.get_active()) |  | ||||||
|         self.options_dict['desref'] = int(self.childRef_option.get_active()) |  | ||||||
|         self.options_dict['incphotos'] = int(self.image_option.get_active()) |  | ||||||
|         self.options_dict['incnames'] = int(self.include_names_option.get_active()) |  | ||||||
|         self.options_dict['incevents'] = int(self.include_events_option.get_active()) |  | ||||||
|         self.options_dict['incaddresses'] = int(self.include_addresses_option.get_active()) |  | ||||||
|         self.options_dict['incsources'] = int(self.include_sources_option.get_active()) |  | ||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| # | # | ||||||
| # | # | ||||||
|   | |||||||
| @@ -45,17 +45,13 @@ import gtk | |||||||
| # | # | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| import gen.lib | import gen.lib | ||||||
| import Utils | from PluginUtils import register_report, NumberOption, BooleanOption | ||||||
| import Errors | from ReportBase import Report, ReportUtils, MenuReportOptions, \ | ||||||
| from PluginUtils import register_report |  | ||||||
| from ReportBase import Report, ReportUtils, ReportOptions, \ |  | ||||||
|      CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI |      CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI | ||||||
| from ReportBase import Bibliography, Endnotes | from ReportBase import Bibliography, Endnotes | ||||||
| import BaseDoc | import BaseDoc | ||||||
| import const |  | ||||||
| import DateHandler | import DateHandler | ||||||
| from BasicUtils import name_displayer as _nd | from BasicUtils import name_displayer as _nd | ||||||
| from QuestionDialog import ErrorDialog |  | ||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| # | # | ||||||
| @@ -617,95 +613,101 @@ class DetDescendantReport(Report): | |||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| # | # | ||||||
| # | # DetDescendantOptions | ||||||
| # | # | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| class DetDescendantOptions(ReportOptions): | class DetDescendantOptions(MenuReportOptions): | ||||||
|  |  | ||||||
|     """ |     """ | ||||||
|     Defines options and provides handling interface. |     Defines options and provides handling interface. | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|     def __init__(self,name,person_id=None): |     def __init__(self,name,person_id=None): | ||||||
|         ReportOptions.__init__(self,name,person_id) |         MenuReportOptions.__init__(self,name,person_id) | ||||||
|  |          | ||||||
|  |     def add_menu_options(self,menu): | ||||||
|  |         category_name = _("Report Options") | ||||||
|  |          | ||||||
|  |         gen = NumberOption(_("Generations"),10,1,100) | ||||||
|  |         gen.set_help(_("The number of generations to include in the report")) | ||||||
|  |         menu.add_option(category_name,"gen",gen) | ||||||
|  |          | ||||||
|  |         pagebbg = BooleanOption(_("Page break between generations"),False) | ||||||
|  |         pagebbg.set_help( | ||||||
|  |                      _("Whether to start a new page after each generation.")) | ||||||
|  |         menu.add_option(category_name,"pagebbg",pagebbg) | ||||||
|  |          | ||||||
|  |         category_name = _("Content") | ||||||
|  |  | ||||||
|         # Options specific for this report |         usecall = BooleanOption(_("Use callname for common name"),False) | ||||||
|         self.options_dict = { |         usecall.set_help(_("Whether to use the call name as the first name.")) | ||||||
|             'gen'           : 10, |         menu.add_option(category_name,"usecall",usecall) | ||||||
|             'pagebbg'       : 0, |          | ||||||
|             'fulldates'     : 1, |         fulldates = BooleanOption( | ||||||
|             'listc'         : 1, |                               _("Use full dates instead of only the year"),True) | ||||||
|             'incnotes'      : 1, |         fulldates.set_help(_("Whether to use full dates instead of just year.")) | ||||||
|             'incattrs'      : 0, |         menu.add_option(category_name,"fulldates",fulldates) | ||||||
|             'usecall'       : 1, |          | ||||||
|             'repplace'      : 0, |         listc = BooleanOption(_("List children"),True) | ||||||
|             'repdate'       : 0, |         listc.set_help(_("Whether to list children.")) | ||||||
|             'computeage'    : 1, |         menu.add_option(category_name,"listc",listc) | ||||||
|             'omitda'        : 1, |          | ||||||
|             'desref'        : 1, |         computeage = BooleanOption(_("Compute age"),True) | ||||||
|             'incphotos'     : 0, |         computeage.set_help(_("Whether to compute age.")) | ||||||
|             'incnames'      : 0, |         menu.add_option(category_name,"computeage",computeage) | ||||||
|             'incevents'     : 0, |          | ||||||
|             'incaddresses'  : 0, |         omitda = BooleanOption(_("Omit duplicate ancestors"),True) | ||||||
|             'incsources'    : 0, |         omitda.set_help(_("Whether to omit duplicate ancestors.")) | ||||||
|             'incmates'      : 1, |         menu.add_option(category_name,"omitda",omitda) | ||||||
|         } |  | ||||||
|         self.options_help = { |         desref = BooleanOption(_("Add descendant reference in child list"),True) | ||||||
|             'gen'           : ("=int","Generations", |         desref.set_help( | ||||||
|                             "The number of generations to include in the report", |                     _("Whether to add descendant references in child list.")) | ||||||
|                             True), |         menu.add_option(category_name,"desref",desref) | ||||||
|             'pagebbg'       : ("=0/1","Page Break Between Generations", |  | ||||||
|                             ["No line break", "Insert line break"], |         category_name = _("Include") | ||||||
|                             False), |          | ||||||
|             'fulldates'     : ("=0/1","Whether to use full dates instead of just year.", |         incnotes = BooleanOption(_("Include notes"),True) | ||||||
|                             ["Do not use full dates","Use full dates"], |         incnotes.set_help(_("Whether to include notes.")) | ||||||
|                             True), |         menu.add_option(category_name,"incnotes",incnotes) | ||||||
|             'listc'         : ("=0/1","Whether to list children.", |  | ||||||
|                             ["Do not list children","List children"], |         incattrs = BooleanOption(_("Include attributes"),False) | ||||||
|                             True), |         incattrs.set_help(_("Whether to include attributes.")) | ||||||
|             'incnotes'      : ("=0/1","Whether to include notes.", |         menu.add_option(category_name,"incattrs",incattrs) | ||||||
|                             ["Do not include notes","Include notes"], |          | ||||||
|                             True), |         incphotos = BooleanOption(_("Include Photo/Images from Gallery"),False) | ||||||
|             'incattrs'      : ("=0/1","Whether to include attributes.", |         incphotos.set_help(_("Whether to include images.")) | ||||||
|                             ["Do not include attributes","Include attributes"], |         menu.add_option(category_name,"incphotos",incphotos) | ||||||
|                             True), |  | ||||||
|             'usecall'       : ("=0/1","Whether to use the call name as the first name.", |         incnames = BooleanOption(_("Include alternative names"),False) | ||||||
|                             ["Do not use call name","Use call name"], |         incnames.set_help(_("Whether to include other names.")) | ||||||
|                             True), |         menu.add_option(category_name,"incnames",incnames) | ||||||
|             'repplace'      : ("=0/1","Whether to replace missing Places with blanks.", |  | ||||||
|                             ["Do not replace missing Places","Replace missing Places"], |         incevents = BooleanOption(_("Include events"),False) | ||||||
|                             True), |         incevents.set_help(_("Whether to include events.")) | ||||||
|             'repdate'       : ("=0/1","Whether to replace missing Dates with blanks.", |         menu.add_option(category_name,"incevents",incevents) | ||||||
|                             ["Do not replace missing Dates","Replace missing Dates"], |  | ||||||
|                             True), |         incaddresses = BooleanOption(_("Include addresses"),False) | ||||||
|             'computeage'    : ("=0/1","Whether to compute age.", |         incaddresses.set_help(_("Whether to include addresses.")) | ||||||
|                             ["Do not compute age","Compute age"], |         menu.add_option(category_name,"incaddresses",incaddresses) | ||||||
|                             True), |  | ||||||
|             'omitda'        : ("=0/1","Whether to omit duplicate ancestors.", |         incsources = BooleanOption(_("Include sources"),False) | ||||||
|                             ["Do not omit duplicates","Omit duplicates"], |         incsources.set_help(_("Whether to include source references.")) | ||||||
|                             True), |         menu.add_option(category_name,"incsources",incsources) | ||||||
|             'desref'        : ("=0/1","Whether to add descendant references in child list.", |  | ||||||
|                             ["Do not add references","Add references"], |         incmates = BooleanOption(_("Include spouses"),False) | ||||||
|                             True), |         incmates.set_help(_("Whether to include detailed spouse information.")) | ||||||
|             'incphotos'     : ("=0/1","Whether to include images.", |         menu.add_option(category_name,"incmates",incmates) | ||||||
|                             ["Do not include images","Include images"], |  | ||||||
|                             True), |         category_name = _("Missing information")         | ||||||
|             'incnames'      : ("=0/1","Whether to include other names.", |  | ||||||
|                             ["Do not include other names","Include other names"], |         repplace = BooleanOption(_("Replace missing places with ______"),False) | ||||||
|                             True), |         repplace.set_help(_("Whether to replace missing Places with blanks.")) | ||||||
|             'incevents'     : ("=0/1","Whether to include events.", |         menu.add_option(category_name,"repplace",repplace) | ||||||
|                             ["Do not include events","Include events"], |  | ||||||
|                             True), |         repdate = BooleanOption(_("Replace missing dates with ______"),False) | ||||||
|             'incaddresses': ("=0/1","Whether to include addresses.", |         repdate.set_help(_("Whether to replace missing Dates with blanks.")) | ||||||
|                             ["Do not include addresses","Include addresses"], |         menu.add_option(category_name,"repdate",repdate) | ||||||
|                             True), |  | ||||||
|             'incsources'    : ("=0/1","Whether to include source references.", |  | ||||||
|                             ["Do not include sources","Include sources"], |  | ||||||
|                             True), |  | ||||||
|             'incmates'      : ("=0/1","Whether to include detailed spouse information.", |  | ||||||
|                             ["Do not include spouse info","Include spouse info"], |  | ||||||
|                             True), |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|     def make_default_style(self,default_style): |     def make_default_style(self,default_style): | ||||||
|         """Make the default output style for the Detailed Ancestral Report""" |         """Make the default output style for the Detailed Ancestral Report""" | ||||||
| @@ -795,126 +797,6 @@ class DetDescendantOptions(ReportOptions): | |||||||
|  |  | ||||||
|         Endnotes.add_endnote_styles(default_style) |         Endnotes.add_endnote_styles(default_style) | ||||||
|  |  | ||||||
|     def add_user_options(self,dialog): |  | ||||||
|         """ |  | ||||||
|         Override the base class add_user_options task to add a menu that allows |  | ||||||
|         the user to select the sort method. |  | ||||||
|         """ |  | ||||||
|         self.max_gen = gtk.SpinButton(gtk.Adjustment(1,1,100,1)) |  | ||||||
|         self.max_gen.set_value(self.options_dict['gen']) |  | ||||||
|          |  | ||||||
|         self.cb_pagebreak = gtk.CheckButton (_("Page break between generations")) |  | ||||||
|         self.cb_pagebreak.set_active (self.options_dict['pagebbg']) |  | ||||||
|  |  | ||||||
|         # Full date usage |  | ||||||
|         self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year")) |  | ||||||
|         self.full_date_option.set_active(self.options_dict['fulldates']) |  | ||||||
|  |  | ||||||
|         # Children List |  | ||||||
|         self.list_children_option = gtk.CheckButton(_("List children")) |  | ||||||
|         self.list_children_option.set_active(self.options_dict['listc']) |  | ||||||
|  |  | ||||||
|         # Print notes |  | ||||||
|         self.include_notes_option = gtk.CheckButton(_("Include notes")) |  | ||||||
|         self.include_notes_option.set_active(self.options_dict['incnotes']) |  | ||||||
|          |  | ||||||
|         # Print attributes |  | ||||||
|         self.include_attributes_option = gtk.CheckButton(_("Include attributes")) |  | ||||||
|         self.include_attributes_option.set_active(self.options_dict['incattrs']) |  | ||||||
|  |  | ||||||
|         # Print callname |  | ||||||
|         self.usecall = gtk.CheckButton(_("Use callname for common name")) |  | ||||||
|         self.usecall.set_active(self.options_dict['usecall']) |  | ||||||
|  |  | ||||||
|         # Replace missing Place with ___________ |  | ||||||
|         self.place_option = gtk.CheckButton(_("Replace missing places with ______")) |  | ||||||
|         self.place_option.set_active(self.options_dict['repplace']) |  | ||||||
|  |  | ||||||
|         # Replace missing dates with __________ |  | ||||||
|         self.date_option = gtk.CheckButton(_("Replace missing dates with ______")) |  | ||||||
|         self.date_option.set_active(self.options_dict['repdate']) |  | ||||||
|  |  | ||||||
|         # Add "Died at the age of NN" in text |  | ||||||
|         self.age_option = gtk.CheckButton(_("Compute age")) |  | ||||||
|         self.age_option.set_active(self.options_dict['computeage']) |  | ||||||
|  |  | ||||||
|         # Omit duplicate persons, occurs when distant cousins marry |  | ||||||
|         self.dupPersons_option = gtk.CheckButton(_("Omit duplicate ancestors")) |  | ||||||
|         self.dupPersons_option.set_active(self.options_dict['omitda']) |  | ||||||
|  |  | ||||||
|         #Add descendant reference in child list |  | ||||||
|         self.childRef_option = gtk.CheckButton(_("Add descendant reference in child list")) |  | ||||||
|         self.childRef_option.set_active(self.options_dict['desref']) |  | ||||||
|  |  | ||||||
|         #Add photo/image reference |  | ||||||
|         self.image_option = gtk.CheckButton(_("Include Photo/Images from Gallery")) |  | ||||||
|         self.image_option.set_active(self.options_dict['incphotos']) |  | ||||||
|  |  | ||||||
|         # Print alternative names |  | ||||||
|         self.include_names_option = gtk.CheckButton(_("Include alternative names")) |  | ||||||
|         self.include_names_option.set_active(self.options_dict['incnames']) |  | ||||||
|  |  | ||||||
|         # Print events |  | ||||||
|         self.include_events_option = gtk.CheckButton(_("Include events")) |  | ||||||
|         self.include_events_option.set_active(self.options_dict['incevents']) |  | ||||||
|          |  | ||||||
|         # Print addresses |  | ||||||
|         self.include_addresses_option = gtk.CheckButton(_("Include addresses")) |  | ||||||
|         self.include_addresses_option.set_active(self.options_dict['incaddresses']) |  | ||||||
|  |  | ||||||
|         # Print sources |  | ||||||
|         self.include_sources_option = gtk.CheckButton(_("Include sources")) |  | ||||||
|         self.include_sources_option.set_active(self.options_dict['incsources']) |  | ||||||
|  |  | ||||||
|         # Print Spouses |  | ||||||
|         self.include_spouses_option = gtk.CheckButton(_("Include spouses")) |  | ||||||
|         self.include_spouses_option.set_active(self.options_dict['incmates']) |  | ||||||
|  |  | ||||||
|         # Add new options. The first argument is the tab name for grouping options. |  | ||||||
|         # if you want to put everyting in the generic "Options" category, use |  | ||||||
|         # self.add_option(text,widget) instead of self.add_frame_option(category,text,widget) |  | ||||||
|         dialog.add_option(_('Generations'),self.max_gen) |  | ||||||
|         dialog.add_option ('', self.cb_pagebreak) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.usecall) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.full_date_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.list_children_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.age_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.dupPersons_option) |  | ||||||
|         dialog.add_frame_option(_('Content'),'',self.childRef_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.image_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_notes_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_attributes_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_names_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_events_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_addresses_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_sources_option) |  | ||||||
|         dialog.add_frame_option(_('Include'),'',self.include_spouses_option) |  | ||||||
|         dialog.add_frame_option(_('Missing information'),'',self.place_option) |  | ||||||
|         dialog.add_frame_option(_('Missing information'),'',self.date_option) |  | ||||||
|  |  | ||||||
|     def parse_user_options(self,dialog): |  | ||||||
|         """ |  | ||||||
|         Parses the custom options that we have added. |  | ||||||
|         """ |  | ||||||
|         self.options_dict['gen'] = self.max_gen.get_value_as_int() |  | ||||||
|         self.options_dict['pagebbg'] = int(self.cb_pagebreak.get_active ()) |  | ||||||
|         self.options_dict['fulldates'] = int(self.full_date_option.get_active()) |  | ||||||
|         self.options_dict['listc'] = int(self.list_children_option.get_active()) |  | ||||||
|         self.options_dict['usecall'] = int(self.usecall.get_active()) |  | ||||||
|         self.options_dict['incnotes'] = int(self.include_notes_option.get_active()) |  | ||||||
|         self.options_dict['incattrs'] = int(self.include_attributes_option.get_active()) |  | ||||||
|         self.options_dict['repplace'] = int(self.place_option.get_active()) |  | ||||||
|         self.options_dict['repdate'] = int(self.date_option.get_active()) |  | ||||||
|         self.options_dict['computeage'] = int(self.age_option.get_active()) |  | ||||||
|         self.options_dict['omitda'] = int(self.dupPersons_option.get_active()) |  | ||||||
|         self.options_dict['desref'] = int(self.childRef_option.get_active()) |  | ||||||
|         self.options_dict['incphotos'] = int(self.image_option.get_active()) |  | ||||||
|         self.options_dict['incnames'] = int(self.include_names_option.get_active()) |  | ||||||
|         self.options_dict['incevents'] = int(self.include_events_option.get_active()) |  | ||||||
|         self.options_dict['incaddresses'] = int(self.include_addresses_option.get_active()) |  | ||||||
|         self.options_dict['incsources'] = int(self.include_sources_option.get_active()) |  | ||||||
|         self.options_dict['incmates'] = int(self.include_spouses_option.get_active()) |  | ||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| # | # | ||||||
| # | # | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user