def add_menu_options(self, menu): """ Add options to the menu for the marker report. """ category_name = _("Report Options") all_tags = [] for handle in self.__db.get_tag_handles(): tag = self.__db.get_tag_from_handle(handle) all_tags.append(tag.get_name()) if len(all_tags) > 0: tag_option = EnumeratedListOption(_("Tag"), all_tags[0]) for tag_name in all_tags: tag_option.add_item(tag_name, tag_name) else: tag_option = EnumeratedListOption(_("Tag"), "") tag_option.add_item("", "") tag_option.set_help(_("The tag to use for the report")) menu.add_option(category_name, "tag", tag_option) can_group = BooleanOption(_("Group by reference type"), False) can_group.set_help(_("Group notes by Family, Person, Place, etc.")) menu.add_option(category_name, "can_group", can_group)
def add_menu_options(self, menu): category_name = _("Report Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the report")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) sortby = EnumeratedListOption(_('Sort by'), 0 ) idx = 0 for item in _get_sort_functions(Sort(self.__db)): sortby.add_item(idx, _(item[0])) idx += 1 sortby.set_help( _("Sorting method to use")) menu.add_option(category_name,"sortby",sortby) stdoptions.add_localization_option(menu, category_name)
def add_menu_options(self, menu): """ Define the options for the menu. """ category_name = _("Tool Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help(_("Select the people to sort")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__update_filters() sort_by = EnumeratedListOption(_('Sort by'), 0 ) idx = 0 for item in _get_sort_functions(Sort(self.__db)): sort_by.add_item(idx, item[0]) idx += 1 sort_by.set_help( _("Sorting method to use")) menu.add_option(category_name, "sort_by", sort_by) sort_desc = BooleanOption(_("Sort descending"), False) sort_desc.set_help(_("Set the sort order")) menu.add_option(category_name, "sort_desc", sort_desc) family_events = BooleanOption(_("Include family events"), True) family_events.set_help(_("Sort family events of the person")) menu.add_option(category_name, "family_events", family_events)
def build_options(self): from gramps.gen.plug.menu import EnumeratedListOption # Add types: type_list = EnumeratedListOption(_("View Type"), self.gui.data[0]) for item in [("Person", _("Person")), ("Event", _("Event")), ("Family", _("Family")), ("Media", _("Media")), ("Note", _("Note")), ("Place", _("Place")), ("Repository", _("Repository")), ("Source", _("Source")), ("Citation", _("Citation")), ]: type_list.add_item(item[0], item[1]) # Add particular lists: qv_list = get_quick_report_list(CATEGORY_QR_PERSON) if self.gui.data[1] is None: self.gui.data[1] = qv_list[0].id list_option = EnumeratedListOption(_("Quick Views"), self.gui.data[1]) for pdata in qv_list: list_option.add_item(pdata.id, pdata.name) self.add_option(type_list) self.add_option(list_option) type_widget = self.get_option_widget(_("View Type")) type_widget.value_changed = self.rebuild_option_list self.rebuild_option_list() # call for initial setting
def add_menu_options(self, menu): """ Add options to the menu for the tag report. """ category_name = _("Report Options") all_tags = [] for handle in self.__db.get_tag_handles(sort_handles=True): tag = self.__db.get_tag_from_handle(handle) all_tags.append(tag.get_name()) if len(all_tags) > 0: tag_option = EnumeratedListOption(_('Tag'), all_tags[0]) for tag_name in all_tags: tag_option.add_item(tag_name, tag_name) else: tag_option = EnumeratedListOption(_('Tag'), '') tag_option.add_item('', '') tag_option.set_help( _("The tag to use for the report")) menu.add_option(category_name, "tag", tag_option) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_localization_option(menu, category_name)
def build_options(self): self.add_option(NumberOption(_("Max generations"), self.max_generations, 1, 100)) self.add_option(BooleanOption(_("Show dates"), bool(self.show_dates))) elist = EnumeratedListOption(_("Line type"), self.box_mode) elist.add_item("UTF", "UTF") elist.add_item("ASCII", "ASCII") self.add_option(elist)
def build_options(self): from gramps.gen.plug.menu import EnumeratedListOption # Add types: style_list = EnumeratedListOption(_("House Icon Style"), self.gui.data[0]) for item in [("001", _("Standard")), ("002", _("Small")), ("003", _("Unicode")), ("004", _("None")), ]: style_list.add_item(item[0], item[1]) self.add_option(style_list)
def add_localization_option(menu, category): """ Insert an option for localizing the report into a different locale from the UI locale. """ trans = EnumeratedListOption(_("Translation"), glocale.DEFAULT_TRANSLATION_STR) trans.add_item(glocale.DEFAULT_TRANSLATION_STR, _("Default")) languages = glocale.get_language_dict() for language in sorted(languages, key=glocale.sort_key): trans.add_item(languages[language], language) trans.set_help(_("The translation to be used for the report.")) menu.add_option(category, "trans", trans)
def add_menu_options(self, menu): """ Add options to the menu for the ancestor report. """ category_name = _("Report Options") report_type = EnumeratedListOption(_('Census Selection'), TYPE_PERSON) report_type.add_item(TYPE_PERSON, _('By Person')) report_type.add_item(TYPE_SOURCE, _('By Source')) report_type.add_item(TYPE_BOTH, _('By Person and Source')) report_type.add_item(TYPE_ALL, _('All Census records')) report_type.set_help(_("The type of report")) menu.add_option(category_name, "report_type", report_type) pid = PersonOption(_("Person")) pid.set_help(_("The selected person for the report.")) menu.add_option(category_name, "pid", pid) default = None sources = get_census_sources(self.database) if len(sources) > 0: if len(sources[0]) > 0: default = sources[0][0] src_handle = EnumeratedListOption(_('Source'), default) for source in sources: src_handle.add_item(source[0], source[1]) menu.add_option(category_name, "src_handle", src_handle) pg_break = BooleanOption(_("Page break after each census."), False) pg_break.set_help(_("Start a new page after each census.")) menu.add_option(category_name, "pg_break", pg_break)
def add_menu_options(self, menu): category_name = _("Report Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select filter to restrict people that appear in the report")) menu.add_option(category_name, "filter", self.__filter) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__update_filters() # We must figure out the value of the first option before we can # create the EnumeratedListOption fmt_list = global_name_display.get_name_format() name_format = EnumeratedListOption(_("Name format"), 0) name_format.add_item(0, _("Default")) for num, name, fmt_str, act in fmt_list: name_format.add_item(num, name) name_format.set_help(_("Select the format to display names")) menu.add_option(category_name, "name_format", name_format) numbering = EnumeratedListOption(_("Numbering system"), "Simple") numbering.set_items([ ("Simple", _("Simple numbering")), ("de Villiers/Pama", _("de Villiers/Pama numbering")), ("Meurgey de Tupigny", _("Meurgey de Tupigny numbering"))]) numbering.set_help(_("The numbering system to be used")) menu.add_option(category_name, "numbering", numbering) gen = NumberOption(_("Generations"), 10, 1, 15) gen.set_help(_("The number of generations to include in the report")) menu.add_option(category_name, "gen", gen) marrs = BooleanOption(_('Show marriage info'), False) marrs.set_help(_("Whether to show marriage information in the report.")) menu.add_option(category_name, "marrs", marrs) divs = BooleanOption(_('Show divorce info'), False) divs.set_help(_("Whether to show divorce information in the report.")) menu.add_option(category_name, "divs", divs) dups = BooleanOption(_('Show duplicate trees'), True) dups.set_help(_("Whether to show duplicate family trees in the report.")) menu.add_option(category_name, "dups", dups)
def add_menu_options(self, menu): category_name = _("Report Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", pid) # We must figure out the value of the first option before we can # create the EnumeratedListOption fmt_list = global_name_display.get_name_format() name_format = EnumeratedListOption(_("Name format"), 0) name_format.add_item(0, _("Default")) for num, name, fmt_str, act in fmt_list: name_format.add_item(num, name) name_format.set_help(_("Select the format to display names")) menu.add_option(category_name, "name_format", name_format)
def add_name_format_option(menu, category): """ Insert an option for changing the report's name format to a report-specific format instead of the user's Edit=>Preferences choice """ name_format = EnumeratedListOption(_("Name format"), 0) name_format.add_item(0, _("Default")) format_list = global_name_display.get_name_format() for number, name, format_string, whether_active in format_list: name_format.add_item(number, name) name_format.set_help(_("Select the format to display names")) current_format = config.get('preferences.name-format') # if this report hasn't ever been run, start with user's current setting name_format.set_value(current_format) # if the report has been run, this line will get the user's old setting menu.add_option(category, "name_format", name_format) return name_format
def add_menu_options(self, menu): """ Create all the menu options for this report. """ category_name = _("Report Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The Center person for the graph")) menu.add_option(category_name, "pid", pid) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15) max_gen.set_help(_("The number of generations of descendants to " "include in the graph")) menu.add_option(category_name, "maxdescend", max_gen) max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15) max_gen.set_help(_("The number of generations of ancestors to " "include in the graph")) menu.add_option(category_name, "maxascend", max_gen) include_id = EnumeratedListOption(_('Include Gramps ID'), 0) include_id.add_item(0, _('Do not include')) include_id.add_item(1, _('Share an existing line')) include_id.add_item(2, _('On a line of its own')) include_id.set_help(_("Whether (and where) to include Gramps IDs")) menu.add_option(category_name, "incid", include_id) stdoptions.add_localization_option(menu, category_name) ################################ category_name = _("Graph Style") ################################ color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range( 0, len(_COLORS) ): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) menu.add_option(category_name, "color", color) roundedcorners = BooleanOption( # see bug report #2180 _("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) menu.add_option(category_name, "roundcorners", roundedcorners)
def add_menu_options(self, menu): """ Add options to the menu for the ancestral fan chart report. """ category_name = _("Ancestral Fan Chart Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", pid) # We must figure out the value of the first option before we can # create the EnumeratedListOption fmt_list = global_name_display.get_name_format() name_format = EnumeratedListOption(_("Name format"), 0) name_format.add_item(0, _("Default")) for num, name, fmt_str, act in fmt_list: name_format.add_item(num, name) name_format.set_help(_("Select the format to display names")) menu.add_option(category_name, "name_format", name_format) self._maxgen = NumberOption(_("Include Generations"), 10, 1, 100) self._maxgen.set_help(_("The number of generations to include in " + "the report")) menu.add_option(category_name, "maxgen", self._maxgen) self._maxgen.connect('value-changed', self.validate_gen) pat_bg = ColorOption(_("Paternal Background Color"), "#ccddff") pat_bg.set_help(_("RGB-color for paternal box background.")) menu.add_option(category_name, "pat_bg", pat_bg) mat_bg = ColorOption(_("Maternal Background"), "#ffb2a1") mat_bg.set_help(_("RGB-color for maternal box background.")) menu.add_option(category_name, "mat_bg", mat_bg) dest_path = DestinationOption(_("Destination"), config.get('paths.website-directory')) dest_path.set_help(_("The destination path for generated files.")) dest_path.set_directory_entry(True) menu.add_option(category_name, "dest_path", dest_path) dest_file = StringOption(_("Filename"), "AncestralFanchart.html") dest_file.set_help(_("The destination file name for html content.")) menu.add_option(category_name, "dest_file", dest_file)
def add_menu_options(self, menu): """ Add the options """ category_name = _("Options") self.__filter = FilterOption(_("Person Filter"), 0) self.__filter.set_help(_("Select filter to restrict people")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__update_filters() source_type = EnumeratedListOption(_("Source type"), 0) source_type.add_item(0, _("New source")) source_type.add_item(1, _("Existing source")) source_type.set_help(_("Select the type of source to attach")) menu.add_option(category_name, "source_type", source_type) source_type.connect('value-changed', self.__update_source_type) self.__source_type = source_type source_text = StringOption(_("New Source Title"), "") source_text.set_help(_("Text of source to attach")) menu.add_option(category_name, "source_text", source_text) self.__source_text = source_text source_id = StringOption(_("Existing Source ID"), "") source_id.set_help(_("ID of source to attach")) menu.add_option(category_name, "source_id", source_id) self.__source_id = source_id self.__update_source_type()
def add_menu_options(self, menu): """ Add the options for the text birthday report """ category_name = _("Report Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select the filter to be applied to the report.")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter.")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) titletext = StringOption(_("Title text"), _(_TITLE0)) titletext.set_help(_("Title of report")) menu.add_option(category_name, "titletext", titletext) text1 = StringOption(_("Text Area 1"), _(_TITLE1)) text1.set_help(_("First line of text at bottom of report")) menu.add_option(category_name, "text1", text1) text2 = StringOption(_("Text Area 2"), _(_TITLE2)) text2.set_help(_("Second line of text at bottom of report")) menu.add_option(category_name, "text2", text2) text3 = StringOption( _("Text Area 3"), URL_HOMEPAGE, ) text3.set_help(_("Third line of text at bottom of report")) menu.add_option(category_name, "text3", text3) category_name = _("Report Options (2)") self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) stdoptions.add_private_data_option(menu, category_name) alive = BooleanOption(_("Include only living people"), True) alive.set_help(_("Include only living people in the report")) menu.add_option(category_name, "alive", alive) deadtxt = StringOption(_("Dead Symbol"), _(_DEADTXT)) deadtxt.set_help( _("This will show after name to indicate that person is dead")) menu.add_option(category_name, "deadtxt", deadtxt) self.__update_filters() stdoptions.add_localization_option(menu, category_name) showyear = BooleanOption(_("Show event year"), True) showyear.set_help( _("Prints the year the event took place in the report")) menu.add_option(category_name, "showyear", showyear) category_name = _("Content") year = NumberOption(_("Year of report"), time.localtime()[0], 1000, 3000) year.set_help(_("Year of report")) menu.add_option(category_name, "year", year) country = EnumeratedListOption(_("Country for holidays"), 0) holiday_table = libholiday.HolidayTable() countries = holiday_table.get_countries() countries.sort() if (len(countries) == 0 or (len(countries) > 0 and countries[0] != '')): countries.insert(0, '') count = 0 for c in countries: country.add_item(count, c) count += 1 country.set_help(_("Select the country to see associated holidays")) menu.add_option(category_name, "country", country) maiden_name = EnumeratedListOption(_("Birthday surname"), "own") maiden_name.add_item( "spouse_first", _("Wives use husband's surname (from first family listed)")) maiden_name.add_item( "spouse_last", _("Wives use husband's surname (from last family listed)")) maiden_name.add_item("own", _("Wives use their own surname")) maiden_name.set_help(_("Select married women's displayed surname")) menu.add_option(category_name, "maiden_name", maiden_name) birthdays = BooleanOption(_("Include birthdays"), True) birthdays.set_help(_("Whether to include birthdays")) menu.add_option(category_name, "birthdays", birthdays) anniversaries = BooleanOption(_("Include anniversaries"), True) anniversaries.set_help(_("Whether to include anniversaries")) menu.add_option(category_name, "anniversaries", anniversaries) death_anniversaries = BooleanOption(_("Include death anniversaries"), True) death_anniversaries.set_help( _("Whether to include anniversaries of death")) menu.add_option(category_name, "death_anniversaries", death_anniversaries) show_relships = BooleanOption( _("Include relationship to center person"), False) show_relships.set_help( _("Whether to include relationships to the center person")) menu.add_option(category_name, "relationships", show_relships)
def add_menu_options(self, menu): ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################################ add_option = partial(menu.add_option, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item( 1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item( 2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item( 3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item( 4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item( 5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item( 6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.add_item( 7, _('Include (birth, marriage, death) ' 'dates and places on same line')) self.event_choice.set_help(_("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) url = BooleanOption(_("Include URLs"), False) url.set_help( _("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) include_id = EnumeratedListOption(_('Include Gramps ID'), 0) include_id.add_item(0, _('Do not include')) include_id.add_item(1, _('Share an existing line')) include_id.add_item(2, _('On a line of its own')) include_id.set_help(_("Whether (and where) to include Gramps IDs")) add_option("incid", include_id) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help( _("Whether to show every person's " "relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear relative to the name")) add_option("imageOnTheSide", self.__image_on_side) #occupation = BooleanOption(_("Include occupation"), False) occupation = EnumeratedListOption(_('Include occupation'), 0) occupation.add_item(0, _('Do not include any occupation')) occupation.add_item( 1, _('Include description ' 'of most recent occupation')) occupation.add_item( 2, _('Include date, description and place ' 'of all occupations')) occupation.set_help(_("Whether to include the last occupation")) add_option("occupation", occupation) if __debug__: self.__show_ga_gb = BooleanOption( _("Include relationship " "debugging numbers also"), False) self.__show_ga_gb.set_help( _("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship " "calculator")) add_option("advrelinfo", self.__show_ga_gb) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ color = EnumeratedListOption(_("Graph coloring"), 'filled') for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help( _("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range(0, len(_ARROWS)): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) # see bug report #2180 roundedcorners = BooleanOption(_("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help( _("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help( _("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily)
class BirthdaysGramplet(Gramplet): def init(self): self.set_text(_("No Family Tree loaded.")) self.max_age = config.get('behavior.max-age-prob-alive') def build_options(self): """Build the configuration options""" db = self.dbstate.db name = _("Ignore birthdays with tag") self.option = EnumeratedListOption(name, self.ignore_tag) self.option.add_item('', '') # No ignore tag if db.is_open(): for tag_handle in db.get_tag_handles(sort_handles=True): tag = db.get_tag_from_handle(tag_handle) tag_name = tag.get_name() self.option.add_item(tag_name, tag_name) self.add_option(self.option) def save_options(self): """Save gramplet configuration data""" self.ignore_tag = self.option.get_value() def save_update_options(self, obj): """Save a gramplet's options to file""" self.save_options() self.gui.data = [self.ignore_tag] self.update() def on_load(self): """Load stored configuration data""" if len(self.gui.data) == 1: self.ignore_tag = self.gui.data[0] else: self.ignore_tag = '' def db_changed(self): """Update gramplet when database was changed""" self.connect(self.dbstate.db, 'person-add', self.update) self.connect(self.dbstate.db, 'person-delete', self.update) self.connect(self.dbstate.db, 'person-update', self.update) def main(self): """Main function of the Birthdays gramplet""" self.set_text(_("Processing...")) database = self.dbstate.db personList = database.iter_people() self.result = [] # get ignore tag handle ignore_tag_handle = "" # No ignore handle selceted by user tag_name = self.option.get_value() tag_handles = database.get_tag_handles() for handle in tag_handles: tag = database.get_tag_from_handle(handle) if tag_name == tag.get_name(): # overwrite ignore_handle to user selction ignore_tag_handle = tag.get_handle() for cnt, person in enumerate(personList): person_tag_handles = person.get_tag_list() if ignore_tag_handle in person_tag_handles: pass # ignore person else: # calculate age and days until birthday: self.__calculate(database, person) # Reverse sort on number of days from now: self.result.sort(key=lambda item: -item[0]) self.clear_text() # handle text shown in gramplet for diff, age, date, person in self.result: name = person.get_primary_name() displayer = gramps.gen.datehandler.displayer self.append_text("{}: ".format(displayer.display(date))) self.link(name_displayer.display_name(name), "Person", person.handle) self.append_text(" ({})\n".format(age)) self.append_text("", scroll_to="begin") def __calculate(self, database, person): """Calculate the age and days until birthday""" today = Today() birth_ref = person.get_birth_ref() death_ref = person.get_death_ref() if (birth_ref and not death_ref): birth = database.get_event_from_handle(birth_ref.ref) birth_date = birth.get_date_object() if birth_date.is_regular(): birthday_this_year = Date(today.get_year(), birth_date.get_month(), birth_date.get_day()) next_age = birthday_this_year - birth_date # (0 year, months, days) between now and birthday of this # year (positive if passed): diff = today - birthday_this_year # about number of days the diff is: diff_days = diff[1] * 30 + diff[2] if next_age[0] < self.max_age: if diff_days <= 0: # not yet passed self.result.append((diff_days, next_age, birth_date, person)) else: # passed; add it for next year's birthday self.result.append((diff_days - 365, next_age[0] + 1, birth_date, person))
def add_menu_options(self, menu): """ Create all the menu options for this report. """ category_name = _("Report Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The Center person for the graph")) menu.add_option(category_name, "pid", pid) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15) max_gen.set_help(_("The number of generations of descendants to " "include in the graph")) menu.add_option(category_name, "maxdescend", max_gen) max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15) max_gen.set_help(_("The number of generations of ancestors to " "include in the graph")) menu.add_option(category_name, "maxascend", max_gen) include_id = EnumeratedListOption(_('Include Gramps ID'), 0) include_id.add_item(0, _('Do not include')) include_id.add_item(1, _('Share an existing line')) include_id.add_item(2, _('On a line of its own')) include_id.set_help(_("Whether (and where) to include Gramps IDs")) menu.add_option(category_name, "incid", include_id) stdoptions.add_localization_option(menu, category_name) ################################ category_name = _("Graph Style") ################################ color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) menu.add_option(category_name, "color", color) color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) menu.add_option(category_name, 'colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) menu.add_option(category_name, 'colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help(_('The color to use ' 'when the gender is unknown.')) menu.add_option(category_name, 'colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) menu.add_option(category_name, 'colorfamilies', color_family) arrow = EnumeratedListOption(_("Arrowhead direction"), 'o') for i in range( 0, len(_ARROWS) ): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) menu.add_option(category_name, "arrow", arrow) roundedcorners = BooleanOption(_("Use rounded corners"), False) # 2180 roundedcorners.set_help( _("Use rounded corners to differentiate between women and men.")) menu.add_option(category_name, "roundcorners", roundedcorners)
def add_menu_options(self, menu): """ Add options to the menu for the ancestral collapsible tree report. """ category_name = _("Ancestral Collapsible Tree Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", pid) pid = menu.get_option_by_name('pid').get_value() center_person = self._dbase.get_person_from_gramps_id( menu.get_option_by_name('pid').get_value()) if center_person : name_str = global_name_display.display_formal(center_person) else: name_str = "" # We must figure out the value of the first option before we can # create the EnumeratedListOption fmt_list = global_name_display.get_name_format() name_format = EnumeratedListOption(_("Name format"), 0) name_format.add_item(0, _("Default")) for num, name, fmt_str, act in fmt_list: name_format.add_item(num, name) name_format.set_help(_("Select the format to display names")) menu.add_option(category_name, "name_format", name_format) self.maxgen = NumberOption(_("Include Generations"), 10, 1, 100) self.maxgen.set_help(_("The number of generations to include in the " + "report")) menu.add_option(category_name, "maxgen", self.maxgen) self.maxgen.connect('value-changed', self.validate_gen) male_bg = ColorOption(_("Male Background Color"), "#ffffff") male_bg.set_help(_("RGB-color for male box background.")) menu.add_option(category_name, "male_bg", male_bg) exp_male_bg = ColorOption(_("Male Expandable Background Color"), "#B4C4D9") exp_male_bg.set_help(_("RGB-color for male expandable box background.")) menu.add_option(category_name, "exp_male_bg", exp_male_bg) female_bg = ColorOption(_("Female Background"), "#ffffff") female_bg.set_help(_("RGB-color for female box background.")) menu.add_option(category_name, "female_bg", female_bg) exp_female_bg = ColorOption(_("Female Expandable Background"), "#F0D5D7") exp_female_bg.set_help(_("RGB-color for female expandable box " + "background.")) menu.add_option(category_name, "exp_female_bg", exp_female_bg) dest_path = DestinationOption(_("Destination"), config.get('paths.website-directory')) dest_path.set_help(_("The destination path for generated files.")) dest_path.set_directory_entry(True) menu.add_option(category_name, "dest_path", dest_path) dest_file = StringOption(_("Filename"), "AncestralCollapsible.html") dest_file.set_help(_("The destination file name for html content.")) menu.add_option(category_name, "dest_file", dest_file)
def add_menu_options(self, menu): """ Add the options """ category_name = _("Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help(_("Select filter to restrict people")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__update_filters() source_text = StringOption(_("Source text"), _("Calculated Date Estimates")) source_text.set_help(_("Source to remove and/or add")) menu.add_option(category_name, "source_text", source_text) remove = BooleanOption(_("Remove previously added events, notes, and source"), True) remove.set_help(_("Remove calculated events, notes, and source; occurs immediately on Execute")) menu.add_option(category_name, "remove", remove) birth = EnumeratedListOption(_("Birth"), 0) birth.add_item(0, _("Do not add birth events")) birth.add_item(1, _("Add birth events without dates")) birth.add_item(2, _("Add birth events with dates")) birth.set_help( _("Add a birth events with or without estimated dates")) menu.add_option(category_name, "add_birth", birth) death = EnumeratedListOption(_("Death"), 0) death.add_item(0, _("Do not add death events")) death.add_item(1, _("Add death events without dates")) death.add_item(2, _("Add death events with dates")) death.set_help( _("Add death events with or without estimated dates")) menu.add_option(category_name, "add_death", death) # ----------------------------------------------------- num = NumberOption(_("Maximum age"), config.get('behavior.max-age-prob-alive'), 0, 200) num.set_help(_("Maximum age that one can live to")) menu.add_option(category_name, "MAX_AGE_PROB_ALIVE", num) num = NumberOption(_("Maximum sibling age difference"), config.get('behavior.max-sib-age-diff'), 0, 200) num.set_help(_("Maximum age difference between siblings")) menu.add_option(category_name, "MAX_SIB_AGE_DIFF", num) num = NumberOption(_("Average years between generations"), config.get('behavior.avg-generation-gap'), 0, 200) num.set_help(_("Average years between two generations")) menu.add_option(category_name, "AVG_GENERATION_GAP", num) dates = EnumeratedListOption(_("Estimated Dates"), 0) dates.add_item(0, _("Approximate (about)")) dates.add_item(1, _("Extremes (after and before)")) dates.set_help( _("Dates on events are either about or after/before")) menu.add_option(category_name, "dates", dates)
def add_menu_options(self, menu): """ Add options to the menu for the statistics report. """ ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help(_("Determines what people are included " "in the report.")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter.")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) sortby = EnumeratedListOption(_('Sort chart items by'), _options.SORT_VALUE) for item_idx in range(len(_options.opt_sorts)): item = _options.opt_sorts[item_idx] sortby.add_item(item_idx, item[2]) sortby.set_help(_("Select how the statistical data is sorted.")) add_option("sortby", sortby) reverse = BooleanOption(_("Sort in reverse order"), False) reverse.set_help(_("Check to reverse the sorting order.")) add_option("reverse", reverse) this_year = time.localtime()[0] year_from = NumberOption(_("People Born After"), 1700, 1, this_year) year_from.set_help(_("Birth year from which to include people.")) add_option("year_from", year_from) year_to = NumberOption(_("People Born Before"), this_year, 1, this_year) year_to.set_help(_("Birth year until which to include people")) add_option("year_to", year_to) no_years = BooleanOption(_("Include people without known birth years"), False) no_years.set_help(_("Whether to include people without " "known birth years.")) add_option("no_years", no_years) gender = EnumeratedListOption(_('Genders included'), Person.UNKNOWN) for item_idx in range(len(_options.opt_genders)): item = _options.opt_genders[item_idx] gender.add_item(item[0], item[2]) gender.set_help(_("Select which genders are included into " "statistics.")) add_option("gender", gender) bar_items = NumberOption(_("Max. items for a pie"), 8, 0, 20) bar_items.set_help(_("With fewer items pie chart and legend will be " "used instead of a bar chart.")) add_option("bar_items", bar_items) ################################ category_name = _("Report Options (2)") add_option = partial(menu.add_option, category_name) ################################ self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################################ # List of available charts on separate option tabs ################################ idx = 0 third = (len(_Extract.extractors) + 1) // 3 chart_types = [] for (chart_opt, ctuple) in _Extract.extractors.items(): chart_types.append((_(ctuple[1]), chart_opt, ctuple)) sorted_chart_types = sorted(chart_types, key=lambda x: glocale.sort_key(x[0])) for (translated_option_name, opt_name, ctuple) in sorted_chart_types: if idx >= (third * 2): category_name = _("Charts 3") elif idx >= third: category_name = _("Charts 2") else: category_name = _("Charts 1") opt = BooleanOption(translated_option_name, False) opt.set_help(_("Include charts with indicated data.")) menu.add_option(category_name, opt_name, opt) idx += 1 # Enable a couple of charts by default menu.get_option_by_name("data_gender").set_value(True) menu.get_option_by_name("data_ccount").set_value(True) menu.get_option_by_name("data_bmonth").set_value(True)
def add_menu_options(self, menu): # --------------------- category_name = _('Report Options') add_option = partial(menu.add_option, category_name) # --------------------- followpar = BooleanOption(_('Follow parents to determine ' '"family lines"'), True) followpar.set_help(_('Parents and their ancestors will be ' 'considered when determining "family lines".')) add_option('followpar', followpar) followchild = BooleanOption(_('Follow children to determine ' '"family lines"'), True) followchild.set_help(_('Children will be considered when ' 'determining "family lines".')) add_option('followchild', followchild) remove_extra_people = BooleanOption(_('Try to remove extra ' 'people and families'), True) remove_extra_people.set_help(_('People and families not directly ' 'related to people of interest will ' 'be removed when determining ' '"family lines".')) add_option('removeextra', remove_extra_people) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range( 0, len(_ARROWS) ): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red, unless otherwise set above for filled. " "If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) roundedcorners = EnumeratedListOption(_("Rounded corners"), '') for i in range( 0, len(_CORNERS) ): roundedcorners.add_item(_CORNERS[i]["value"], _CORNERS[i]["name"]) roundedcorners.set_help(_("Use rounded corners e.g. to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) # --------------------- category_name = _('Report Options (2)') add_option = partial(menu.add_option, category_name) # --------------------- stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name, default=False) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) # -------------------------------- add_option = partial(menu.add_option, _('People of Interest')) # -------------------------------- person_list = PersonListOption(_('People of interest')) person_list.set_help(_('People of interest are used as a starting ' 'point when determining "family lines".')) add_option('gidlist', person_list) self.limit_parents = BooleanOption(_('Limit the number of ancestors'), False) self.limit_parents.set_help(_('Whether to ' 'limit the number of ancestors.')) add_option('limitparents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents.set_help(_('The maximum number ' 'of ancestors to include.')) add_option('maxparents', self.max_parents) self.limit_children = BooleanOption(_('Limit the number ' 'of descendants'), False) self.limit_children.set_help(_('Whether to ' 'limit the number of descendants.')) add_option('limitchildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 10, 9999) self.max_children.set_help(_('The maximum number ' 'of descendants to include.')) add_option('maxchildren', self.max_children) # -------------------- category_name = _('Include') add_option = partial(menu.add_option, category_name) # -------------------- self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates.set_help(_('Whether to include dates for people ' 'and families.')) add_option('incdates', self.include_dates) self.include_dates.connect('value-changed', self.include_dates_changed) self.justyears = BooleanOption(_("Limit dates to years only"), False) self.justyears.set_help(_("Prints just dates' year, neither " "month or day nor date approximation " "or interval are shown.")) add_option("justyears", self.justyears) include_places = BooleanOption(_('Include places'), True) include_places.set_help(_('Whether to include placenames for people ' 'and families.')) add_option('incplaces', include_places) include_num_children = BooleanOption(_('Include the number of ' 'children'), True) include_num_children.set_help(_('Whether to include the number of ' 'children for families with more ' 'than 1 child.')) add_option('incchildcnt', include_num_children) self.include_images = BooleanOption(_('Include ' 'thumbnail images of people'), True) self.include_images.set_help(_('Whether to ' 'include thumbnail images of people.')) add_option('incimages', self.include_images) self.include_images.connect('value-changed', self.images_changed) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) self.image_location.add_item(0, _('Above the name')) self.image_location.add_item(1, _('Beside the name')) self.image_location.set_help(_('Where the thumbnail image ' 'should appear relative to the name')) add_option('imageonside', self.image_location) self.image_size = EnumeratedListOption(_('Thumbnail size'), SIZE_NORMAL) self.image_size.add_item(SIZE_NORMAL, _('Normal')) self.image_size.add_item(SIZE_LARGE, _('Large')) self.image_size.set_help(_('Size of the thumbnail image')) add_option('imagesize', self.image_size) # ---------------------------- add_option = partial(menu.add_option, _('Family Colors')) # ---------------------------- surname_color = SurnameColorOption(_('Family colors')) surname_color.set_help(_('Colors to use for various family lines.')) add_option('surnamecolors', surname_color) # ------------------------- add_option = partial(menu.add_option, _('Individuals')) # ------------------------- color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help(_('The color to use ' 'when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) self.limit_changed() self.images_changed()
def add_menu_options(self, menu): ################## category_name = _("Tree Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the tree")) menu.add_option(category_name, "pid", pid) siblings = BooleanOption(_('Include siblings of the center person'), False) siblings.set_help(_("Whether to only display the center person or all " "of his/her siblings too")) menu.add_option(category_name, "inc_siblings", siblings) self.max_gen = NumberOption(_("Generations"), 10, 1, 50) self.max_gen.set_help(_("The number of generations to include " "in the tree")) menu.add_option(category_name, "maxgen", self.max_gen) self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"), 0) self.fillout.set_help(_("The number of generations of empty " "boxes that will be displayed")) menu.add_option(category_name, "fill_out", self.fillout) self.max_gen.connect('value-changed', self.__fillout_vals) self.__fillout_vals() compress = BooleanOption(_('Compress tree'), True) compress.set_help(_("Whether to remove any extra blank spaces set " "aside for people that are unknown")) menu.add_option(category_name, "compress_tree", compress) #better to 'Show siblings of\nthe center person #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center " # "person"), 0) #Spouse_disp.add_item( 0, _("No. Do not show Spouses")) #Spouse_disp.add_item( 1, _("Yes, and use the Main Display Format")) #Spouse_disp.add_item( 2, _("Yes, and use the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) ################## category_name = _("Report Options") self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item(0, _("Do not include a title")) self.title.add_item(1, _("Include Report Title")) self.title.set_help(_("Choose a title for the report")) menu.add_option(category_name, "report_title", self.title) border = BooleanOption(_('Include a border'), False) border.set_help(_("Whether to make a border around the report.")) menu.add_option(category_name, "inc_border", border) prnnum = BooleanOption(_('Include Page Numbers'), False) prnnum.set_help(_("Whether to print page numbers on each page.")) menu.add_option(category_name, "inc_pagenum", prnnum) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################## category_name = _("Display") disp = TextOption(_("Father\nDisplay Format"), ["$n", "%s $b" %_BORN, "-{%s $d}" %_DIED]) disp.set_help(_("Display format for the fathers box.")) menu.add_option(category_name, "father_disp", disp) #Will add when libsubstkeyword supports it. #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \ # with"), 0) #missing.add_item( 0, _("Does not display anything")) #missing.add_item( 1, _("Displays '_____'")) #missing.set_help(_("What will print when information is not known")) #menu.add_option(category_name, "miss_val", missing) #category_name = _("Secondary") dispMom = TextOption(_("Mother\nDisplay Format"), ["$n", "%s $b" %_BORN, "%s $m" %_MARR, "-{%s $d}" %_DIED] ) dispMom.set_help(_("Display format for the mothers box.")) menu.add_option(category_name, "mother_disp", dispMom) centerDisp = EnumeratedListOption(_("Center person uses\n" "which format"), 0) centerDisp.add_item(0, _("Use Fathers Display format")) centerDisp.add_item(1, _("Use Mothers display format")) centerDisp.set_help(_("Which Display format to use the center person")) menu.add_option(category_name, "center_uses", centerDisp) incmarr = BooleanOption(_('Include Marriage box'), False) incmarr.set_help( _("Whether to include a separate marital box in the report")) menu.add_option(category_name, "inc_marr", incmarr) marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR) marrdisp.set_help(_("Display format for the marital box.")) menu.add_option(category_name, "marr_disp", marrdisp) ################## category_name = _("Size") self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) self.scale.add_item(0, _("Do not scale tree")) self.scale.add_item(1, _("Scale tree to fit page width only")) self.scale.add_item(2, _("Scale tree to fit the size of the page")) self.scale.set_help( _("Whether to scale the tree to fit a specific paper size") ) menu.add_option(category_name, "scale_tree", self.scale) self.scale.connect('value-changed', self.__check_blank) if "BKI" not in self.name.split(","): self.__onepage = BooleanOption(_("Resize Page to Fit Tree size\n" "\n" "Note: Overrides options in the 'Paper Option' tab" ), False) self.__onepage.set_help( _("Whether to resize the page to fit the size \n" "of the tree. Note: the page will have a \n" "non standard size.\n" "\n" "With this option selected, the following will happen:\n" "\n" "With the 'Do not scale tree' option the page\n" " is resized to the height/width of the tree\n" "\n" "With 'Scale tree to fit page width only' the height of\n" " the page is resized to the height of the tree\n" "\n" "With 'Scale tree to fit the size of the page' the page\n" " is resized to remove any gap in either height or width" )) menu.add_option(category_name, "resize_page", self.__onepage) self.__onepage.connect('value-changed', self.__check_blank) else: self.__onepage = None self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10, 2.00, 0.01) self.box_Y_sf.set_help(_("Make the inter-box spacing bigger or smaller")) menu.add_option(category_name, "box_Yscale", self.box_Y_sf) self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00, 0.00, 2.00, 0.01) # down to 0 self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller")) menu.add_option(category_name, "shadowscale", self.box_shadow_sf) ################## category_name = _("Replace") repldisp = TextOption( _("Replace Display Format:\n'Replace this'/' with this'"), []) repldisp.set_help(_("i.e.\nUnited States of America/U.S.A")) menu.add_option(category_name, "replace_list", repldisp) ################## category_name = _("Include") self.__blank = BooleanOption(_('Include Blank Pages'), True) self.__blank.set_help(_("Whether to include pages that are blank.")) menu.add_option(category_name, "inc_blank", self.__blank) self.__check_blank() self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) menu.add_option(category_name, "includeImages", self.__include_images) #category_name = _("Notes") self.usenote = BooleanOption(_('Include a note'), False) self.usenote.set_help(_("Whether to include a note on " "the report.")) menu.add_option(category_name, "inc_note", self.usenote) self.notedisp = TextOption(_("Note"), []) self.notedisp.set_help(_("Add a note\n\n" "$T inserts today's date")) menu.add_option(category_name, "note_disp", self.notedisp) locales = NoteType(0, 1) self.notelocal = EnumeratedListOption(_("Note Location"), 0) for num, text in locales.note_locals(): self.notelocal.add_item(num, text) self.notelocal.set_help(_("Where to place the note.")) menu.add_option(category_name, "note_place", self.notelocal)
def add_menu_options(self, menu): ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range(0, len(_ARROWS)): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), 'filled') for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) # see bug report #2180 roundedcorners = BooleanOption(_("Use rounded corners"), False) roundedcorners.set_help(_("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) ################################ category_name = _("Report Options (2)") add_option = partial(menu.add_option, category_name) ################################ self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) ################################ add_option = partial(menu.add_option, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item(1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item(2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item(3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item(4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item(5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item(6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.add_item(7, _('Include (birth, marriage, death) ' 'dates and places on same line')) self.event_choice.set_help( _("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) url = BooleanOption(_("Include URLs"), False) url.set_help(_("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help(_("Whether to show every person's " "relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear relative to the name")) add_option("imageOnTheSide", self.__image_on_side) #occupation = BooleanOption(_("Include occupation"), False) occupation = EnumeratedListOption(_('Include occupation'), 0) occupation.add_item(0, _('Do not include any occupation')) occupation.add_item(1, _('Include description ' 'of most recent occupation')) occupation.add_item(2, _('Include date, description and place ' 'of all occupations')) occupation.set_help(_("Whether to include the last occupation")) add_option("occupation", occupation) if __debug__: self.__show_ga_gb = BooleanOption(_("Include relationship " "debugging numbers also"), False) self.__show_ga_gb.set_help(_("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship " "calculator")) add_option("advrelinfo", self.__show_ga_gb) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use when the gender is unknown.') ) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help(_("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help(_("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily)
def add_menu_options(self, menu): # --------------------- category_name = _('Report Options') add_option = partial(menu.add_option, category_name) # --------------------- followpar = BooleanOption( _('Follow parents to determine ' '"family lines"'), True) followpar.set_help( _('Parents and their ancestors will be ' 'considered when determining "family lines".')) add_option('followpar', followpar) followchild = BooleanOption( _('Follow children to determine ' '"family lines"'), True) followchild.set_help( _('Children will be considered when ' 'determining "family lines".')) add_option('followchild', followchild) remove_extra_people = BooleanOption( _('Try to remove extra ' 'people and families'), True) remove_extra_people.set_help( _('People and families not directly ' 'related to people of interest will ' 'be removed when determining ' '"family lines".')) add_option('removeextra', remove_extra_people) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range(0, len(_ARROWS)): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help( _("Males will be shown with blue, females " "with red, unless otherwise set above for filled. " "If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) roundedcorners = EnumeratedListOption(_("Rounded corners"), '') for i in range(0, len(_CORNERS)): roundedcorners.add_item(_CORNERS[i]["value"], _CORNERS[i]["name"]) roundedcorners.set_help( _("Use rounded corners e.g. to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) # --------------------- category_name = _('Report Options (2)') add_option = partial(menu.add_option, category_name) # --------------------- stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name, default=False) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) # -------------------------------- add_option = partial(menu.add_option, _('People of Interest')) # -------------------------------- person_list = PersonListOption(_('People of interest')) person_list.set_help( _('People of interest are used as a starting ' 'point when determining "family lines".')) add_option('gidlist', person_list) self.limit_parents = BooleanOption(_('Limit the number of ancestors'), False) self.limit_parents.set_help( _('Whether to ' 'limit the number of ancestors.')) add_option('limitparents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents.set_help( _('The maximum number ' 'of ancestors to include.')) add_option('maxparents', self.max_parents) self.limit_children = BooleanOption( _('Limit the number ' 'of descendants'), False) self.limit_children.set_help( _('Whether to ' 'limit the number of descendants.')) add_option('limitchildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 10, 9999) self.max_children.set_help( _('The maximum number ' 'of descendants to include.')) add_option('maxchildren', self.max_children) # -------------------- category_name = _('Include') add_option = partial(menu.add_option, category_name) # -------------------- self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates.set_help( _('Whether to include dates for people ' 'and families.')) add_option('incdates', self.include_dates) self.include_dates.connect('value-changed', self.include_dates_changed) self.justyears = BooleanOption(_("Limit dates to years only"), False) self.justyears.set_help( _("Prints just dates' year, neither " "month or day nor date approximation " "or interval are shown.")) add_option("justyears", self.justyears) include_places = BooleanOption(_('Include places'), True) include_places.set_help( _('Whether to include placenames for people ' 'and families.')) add_option('incplaces', include_places) include_num_children = BooleanOption( _('Include the number of ' 'children'), True) include_num_children.set_help( _('Whether to include the number of ' 'children for families with more ' 'than 1 child.')) add_option('incchildcnt', include_num_children) self.include_images = BooleanOption( _('Include ' 'thumbnail images of people'), True) self.include_images.set_help( _('Whether to ' 'include thumbnail images of people.')) add_option('incimages', self.include_images) self.include_images.connect('value-changed', self.images_changed) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) self.image_location.add_item(0, _('Above the name')) self.image_location.add_item(1, _('Beside the name')) self.image_location.set_help( _('Where the thumbnail image ' 'should appear relative to the name')) add_option('imageonside', self.image_location) self.image_size = EnumeratedListOption(_('Thumbnail size'), SIZE_NORMAL) self.image_size.add_item(SIZE_NORMAL, _('Normal')) self.image_size.add_item(SIZE_LARGE, _('Large')) self.image_size.set_help(_('Size of the thumbnail image')) add_option('imagesize', self.image_size) # ---------------------------- add_option = partial(menu.add_option, _('Family Colors')) # ---------------------------- surname_color = SurnameColorOption(_('Family colors')) surname_color.set_help(_('Colors to use for various family lines.')) add_option('surnamecolors', surname_color) # ------------------------- add_option = partial(menu.add_option, _('Individuals')) # ------------------------- color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use ' 'when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) self.limit_changed() self.images_changed()
def add_menu_options(self, menu): """ Create all the menu options for this report. """ category_name = _("Report Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The Center person for the graph")) menu.add_option(category_name, "pid", pid) max_gen_d = NumberOption(_('Max Descendant Generations'), 10, 1, 15) max_gen_d.set_help(_("The number of generations of descendants to " "include in the graph")) menu.add_option(category_name, "maxdescend", max_gen_d) max_gen_a = NumberOption(_('Max Ancestor Generations'), 10, 1, 15) max_gen_a.set_help(_("The number of generations of ancestors to " "include in the graph")) menu.add_option(category_name, "maxascend", max_gen_a) arrow = EnumeratedListOption(_("Arrowhead direction"), 'o') for i in range( 0, len(_ARROWS) ): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) menu.add_option(category_name, "arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) menu.add_option(category_name, "color", color) roundedcorners = BooleanOption(_("Use rounded corners"), False) # 2180 roundedcorners.set_help( _("Use rounded corners to differentiate between women and men.")) menu.add_option(category_name, "roundcorners", roundedcorners) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) category_name = _("Report Options (2)") stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) ################################ category_name = _("Graph Style") ################################ color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) menu.add_option(category_name, 'colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) menu.add_option(category_name, 'colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help(_('The color to use ' 'when the gender is unknown.')) menu.add_option(category_name, 'colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) menu.add_option(category_name, 'colorfamilies', color_family)
def add_menu_options(self, menu): """ Add the options for the text birthday report """ category_name = _("Report Options") year = NumberOption(_("Year of report"), time.localtime()[0], 1000, 3000) year.set_help(_("Year of report")) menu.add_option(category_name, "year", year) self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select filter to restrict people that appear on report")) menu.add_option(category_name, "filter", self.__filter) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_name_format_option(menu, category_name) country = EnumeratedListOption(_("Country for holidays"), 0) holiday_table = libholiday.HolidayTable() countries = holiday_table.get_countries() countries.sort() if (len(countries) == 0 or (len(countries) > 0 and countries[0] != '')): countries.insert(0, '') count = 0 for c in holiday_table.get_countries(): country.add_item(count, c) count += 1 country.set_help(_("Select the country to see associated holidays")) menu.add_option(category_name, "country", country) start_dow = EnumeratedListOption(_("First day of week"), 1) long_days = _dd.long_days for count in range(1, 8): # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below start_dow.add_item((count + 5) % 7 + 1, long_days[count].capitalize()) start_dow.set_help( _("Select the first day of the week for the report")) menu.add_option(category_name, "start_dow", start_dow) maiden_name = EnumeratedListOption(_("Birthday surname"), "own") maiden_name.add_item( "spouse_first", _("Wives use husband's surname (from first family listed)")) maiden_name.add_item( "spouse_last", _("Wives use husband's surname (from last family listed)")) maiden_name.add_item("own", _("Wives use their own surname")) maiden_name.set_help(_("Select married women's displayed surname")) menu.add_option(category_name, "maiden_name", maiden_name) stdoptions.add_private_data_option(menu, category_name) alive = BooleanOption(_("Include only living people"), True) alive.set_help(_("Include only living people in the report")) menu.add_option(category_name, "alive", alive) birthdays = BooleanOption(_("Include birthdays"), True) birthdays.set_help(_("Include birthdays in the report")) menu.add_option(category_name, "birthdays", birthdays) anniversaries = BooleanOption(_("Include anniversaries"), True) anniversaries.set_help(_("Include anniversaries in the report")) menu.add_option(category_name, "anniversaries", anniversaries) option = BooleanOption(_("Include relationships to center person"), False) option.set_help(_("Include relationships to center person (slower)")) menu.add_option(category_name, "relationships", option) stdoptions.add_localization_option(menu, category_name) category_name = _("Text Options") titletext = StringOption(_("Title text"), _(_TITLE0)) titletext.set_help(_("Title of report")) menu.add_option(category_name, "titletext", titletext) text1 = StringOption(_("Text Area 1"), _(_TITLE1)) text1.set_help(_("First line of text at bottom of report")) menu.add_option(category_name, "text1", text1) text2 = StringOption(_("Text Area 2"), _(_TITLE2)) text2.set_help(_("Second line of text at bottom of report")) menu.add_option(category_name, "text2", text2) text3 = StringOption( _("Text Area 3"), URL_HOMEPAGE, ) text3.set_help(_("Third line of text at bottom of report")) menu.add_option(category_name, "text3", text3)
class TagOptions(MenuReportOptions): """ Options for the Tag Report """ def __init__(self, name, dbase): self.__db = dbase MenuReportOptions.__init__(self, name, dbase) def get_subject(self): """ Return a string that describes the subject of the report. """ return self.__tag_option.get_value() def add_menu_options(self, menu): """ Add options to the menu for the tag report. """ category_name = _("Report Options") all_tags = [] for handle in self.__db.get_tag_handles(sort_handles=True): tag = self.__db.get_tag_from_handle(handle) all_tags.append(tag.get_name()) if len(all_tags) > 0: self.__tag_option = EnumeratedListOption(_('Tag'), all_tags[0]) for tag_name in all_tags: self.__tag_option.add_item(tag_name, tag_name) else: self.__tag_option = EnumeratedListOption(_('Tag'), '') self.__tag_option.add_item('', '') self.__tag_option.set_help(_("The tag to use for the report")) menu.add_option(category_name, "tag", self.__tag_option) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_place_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) def make_default_style(self, default_style): """Make the default output style for the Tag Report.""" # Paragraph Styles font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) font.set_bold(1) para = ParagraphStyle() para.set_header_level(1) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set_description(_("The style used for the title.")) default_style.add_paragraph_style("TR-Title", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=1) para = ParagraphStyle() para.set_header_level(1) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set_description(_('The style used for the subtitle.')) default_style.add_paragraph_style("TR-ReportSubtitle", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=14, italic=1) para = ParagraphStyle() para.set_font(font) para.set_header_level(2) para.set_top_margin(0.25) para.set_bottom_margin(0.25) para.set_description(_('The style used for the section headers.')) default_style.add_paragraph_style("TR-Heading", para) font = FontStyle() font.set_size(12) para = ParagraphStyle() para.set(first_indent=-0.75, lmargin=.75) para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for the text display.')) default_style.add_paragraph_style("TR-Normal", para) font = FontStyle() font.set_size(12) font.set_bold(True) para = ParagraphStyle() para.set(first_indent=-0.75, lmargin=.75) para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for table headings.')) default_style.add_paragraph_style("TR-Normal-Bold", para) para = ParagraphStyle() para.set(first_indent=-0.75, lmargin=.75) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for the note display.')) default_style.add_paragraph_style("TR-Note", para) #Table Styles cell = TableCellStyle() default_style.add_cell_style('TR-TableCell', cell) table = TableStyle() table.set_width(100) table.set_columns(4) table.set_column_width(0, 10) table.set_column_width(1, 30) table.set_column_width(2, 30) table.set_column_width(3, 30) default_style.add_table_style('TR-Table', table)
class AncestorTreeOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.box_Y_sf = None self.box_shadow_sf = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################## category_name = _("Tree Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the tree")) menu.add_option(category_name, "pid", pid) siblings = BooleanOption(_('Include siblings of the center person'), False) siblings.set_help(_("Whether to only display the center person or all " "of his/her siblings too")) menu.add_option(category_name, "inc_siblings", siblings) self.max_gen = NumberOption(_("Generations"), 10, 1, 50) self.max_gen.set_help(_("The number of generations to include " "in the tree")) menu.add_option(category_name, "maxgen", self.max_gen) self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"), 0) self.fillout.set_help(_("The number of generations of empty " "boxes that will be displayed")) menu.add_option(category_name, "fill_out", self.fillout) self.max_gen.connect('value-changed', self.__fillout_vals) self.__fillout_vals() compress = BooleanOption(_('Compress tree'), True) compress.set_help(_("Whether to remove any extra blank spaces set " "aside for people that are unknown")) menu.add_option(category_name, "compress_tree", compress) #better to 'Show siblings of\nthe center person #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center " # "person"), 0) #Spouse_disp.add_item( 0, _("No. Do not show Spouses")) #Spouse_disp.add_item( 1, _("Yes, and use the Main Display Format")) #Spouse_disp.add_item( 2, _("Yes, and use the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) ################## category_name = _("Report Options") self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item(0, _("Do not include a title")) self.title.add_item(1, _("Include Report Title")) self.title.set_help(_("Choose a title for the report")) menu.add_option(category_name, "report_title", self.title) border = BooleanOption(_('Include a border'), False) border.set_help(_("Whether to make a border around the report.")) menu.add_option(category_name, "inc_border", border) prnnum = BooleanOption(_('Include Page Numbers'), False) prnnum.set_help(_("Whether to print page numbers on each page.")) menu.add_option(category_name, "inc_pagenum", prnnum) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################## category_name = _("Display") disp = TextOption(_("Father\nDisplay Format"), ["$n", "%s $b" %_BORN, "-{%s $d}" %_DIED]) disp.set_help(_("Display format for the fathers box.")) menu.add_option(category_name, "father_disp", disp) #Will add when libsubstkeyword supports it. #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \ # with"), 0) #missing.add_item( 0, _("Does not display anything")) #missing.add_item( 1, _("Displays '_____'")) #missing.set_help(_("What will print when information is not known")) #menu.add_option(category_name, "miss_val", missing) #category_name = _("Secondary") dispMom = TextOption(_("Mother\nDisplay Format"), ["$n", "%s $b" %_BORN, "%s $m" %_MARR, "-{%s $d}" %_DIED] ) dispMom.set_help(_("Display format for the mothers box.")) menu.add_option(category_name, "mother_disp", dispMom) centerDisp = EnumeratedListOption(_("Center person uses\n" "which format"), 0) centerDisp.add_item(0, _("Use Fathers Display format")) centerDisp.add_item(1, _("Use Mothers display format")) centerDisp.set_help(_("Which Display format to use the center person")) menu.add_option(category_name, "center_uses", centerDisp) incmarr = BooleanOption(_('Include Marriage box'), False) incmarr.set_help( _("Whether to include a separate marital box in the report")) menu.add_option(category_name, "inc_marr", incmarr) marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR) marrdisp.set_help(_("Display format for the marital box.")) menu.add_option(category_name, "marr_disp", marrdisp) ################## category_name = _("Size") self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) self.scale.add_item(0, _("Do not scale tree")) self.scale.add_item(1, _("Scale tree to fit page width only")) self.scale.add_item(2, _("Scale tree to fit the size of the page")) self.scale.set_help( _("Whether to scale the tree to fit a specific paper size") ) menu.add_option(category_name, "scale_tree", self.scale) self.scale.connect('value-changed', self.__check_blank) if "BKI" not in self.name.split(","): self.__onepage = BooleanOption(_("Resize Page to Fit Tree size\n" "\n" "Note: Overrides options in the 'Paper Option' tab" ), False) self.__onepage.set_help( _("Whether to resize the page to fit the size \n" "of the tree. Note: the page will have a \n" "non standard size.\n" "\n" "With this option selected, the following will happen:\n" "\n" "With the 'Do not scale tree' option the page\n" " is resized to the height/width of the tree\n" "\n" "With 'Scale tree to fit page width only' the height of\n" " the page is resized to the height of the tree\n" "\n" "With 'Scale tree to fit the size of the page' the page\n" " is resized to remove any gap in either height or width" )) menu.add_option(category_name, "resize_page", self.__onepage) self.__onepage.connect('value-changed', self.__check_blank) else: self.__onepage = None self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10, 2.00, 0.01) self.box_Y_sf.set_help(_("Make the inter-box spacing bigger or smaller")) menu.add_option(category_name, "box_Yscale", self.box_Y_sf) self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00, 0.00, 2.00, 0.01) # down to 0 self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller")) menu.add_option(category_name, "shadowscale", self.box_shadow_sf) ################## category_name = _("Replace") repldisp = TextOption( _("Replace Display Format:\n'Replace this'/' with this'"), []) repldisp.set_help(_("i.e.\nUnited States of America/U.S.A")) menu.add_option(category_name, "replace_list", repldisp) ################## category_name = _("Include") self.__blank = BooleanOption(_('Include Blank Pages'), True) self.__blank.set_help(_("Whether to include pages that are blank.")) menu.add_option(category_name, "inc_blank", self.__blank) self.__check_blank() self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) menu.add_option(category_name, "includeImages", self.__include_images) #category_name = _("Notes") self.usenote = BooleanOption(_('Include a note'), False) self.usenote.set_help(_("Whether to include a note on " "the report.")) menu.add_option(category_name, "inc_note", self.usenote) self.notedisp = TextOption(_("Note"), []) self.notedisp.set_help(_("Add a note\n\n" "$T inserts today's date")) menu.add_option(category_name, "note_disp", self.notedisp) locales = NoteType(0, 1) self.notelocal = EnumeratedListOption(_("Note Location"), 0) for num, text in locales.note_locals(): self.notelocal.add_item(num, text) self.notelocal.set_help(_("Where to place the note.")) menu.add_option(category_name, "note_place", self.notelocal) def __check_blank(self): if self.__onepage: value = not self.__onepage.get_value() else: value = True off = value and (self.scale.get_value() != 2) self.__blank.set_available(off) def __fillout_vals(self): max_gen = self.max_gen.get_value() old_val = self.fillout.get_value() item_list = [] item_list.append([0, _("No generations of empty boxes " "for unknown ancestors")]) if max_gen > 1: item_list.append([1, _("One Generation of empty boxes " "for unknown ancestors")]) item_list.extend([itr, str(itr) + _(" Generations of empty boxes for unknown ancestors")] for itr in range(2, max_gen) ) self.fillout.set_items(item_list) if old_val+2 > len(item_list): self.fillout.set_value(len(item_list) -2) def make_default_style(self, default_style): """Make the default output style for the Ancestor Tree.""" ## Paragraph Styles: font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description(_('The basic style used for the ' 'text display.')) default_style.add_paragraph_style("AC2-Normal", para_style) box_shadow = PT2CM(font.get_size()) * .6 font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description(_('The basic style used for the ' 'note display.')) default_style.add_paragraph_style("AC2-Note", para_style) font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_alignment(PARA_ALIGN_CENTER) para_style.set_description(_('The basic style used for the ' 'title display.')) default_style.add_paragraph_style("AC2-Title", para_style) ## Draw styles graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") graph_style.set_shadow(1, box_shadow) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") #graph_style.set_shadow(0, PT2CM(9)) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-fam-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Note") graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-note-box", graph_style) # TODO - Why is this here twice? #graph_style = GraphicsStyle() #graph_style.set_paragraph_style("AC2-Title") #graph_style.set_color((0, 0, 0)) #graph_style.set_fill_color((255, 255, 255)) #graph_style.set_line_width(0) #default_style.add_draw_style("AC2-Title", graph_style) graph_style = GraphicsStyle() default_style.add_draw_style("AC2-line", graph_style)
def add_menu_options(self, menu): """ Add options to the menu for the ancestral collapsible tree report. """ category_name = _("Ancestral Collapsible Tree Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", pid) pid = menu.get_option_by_name('pid').get_value() center_person = self._dbase.get_person_from_gramps_id( menu.get_option_by_name('pid').get_value()) if center_person: name_str = global_name_display.display_formal(center_person) else: name_str = "" # We must figure out the value of the first option before we can # create the EnumeratedListOption fmt_list = global_name_display.get_name_format() name_format = EnumeratedListOption(_("Name format"), 0) name_format.add_item(0, _("Default")) for num, name, fmt_str, act in fmt_list: name_format.add_item(num, name) name_format.set_help(_("Select the format to display names")) menu.add_option(category_name, "name_format", name_format) self.maxgen = NumberOption(_("Include Generations"), 10, 1, 100) self.maxgen.set_help( _("The number of generations to include in the " + "report")) menu.add_option(category_name, "maxgen", self.maxgen) self.maxgen.connect('value-changed', self.validate_gen) male_bg = ColorOption(_("Male Background Color"), "#ffffff") male_bg.set_help(_("RGB-color for male box background.")) menu.add_option(category_name, "male_bg", male_bg) exp_male_bg = ColorOption(_("Male Expandable Background Color"), "#B4C4D9") exp_male_bg.set_help( _("RGB-color for male expandable box background.")) menu.add_option(category_name, "exp_male_bg", exp_male_bg) female_bg = ColorOption(_("Female Background"), "#ffffff") female_bg.set_help(_("RGB-color for female box background.")) menu.add_option(category_name, "female_bg", female_bg) exp_female_bg = ColorOption(_("Female Expandable Background"), "#F0D5D7") exp_female_bg.set_help( _("RGB-color for female expandable box " + "background.")) menu.add_option(category_name, "exp_female_bg", exp_female_bg) dest_path = DestinationOption(_("Destination"), config.get('paths.website-directory')) dest_path.set_help(_("The destination path for generated files.")) dest_path.set_directory_entry(True) menu.add_option(category_name, "dest_path", dest_path) dest_file = StringOption(_("Filename"), "AncestralCollapsible.html") dest_file.set_help(_("The destination file name for html content.")) menu.add_option(category_name, "dest_file", dest_file)
def add_menu_options(self, menu): """ Add options to the menu for the fan chart. """ category_name = _("Report Options") pid = PersonOption(_("Center Person")) pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", pid) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) max_gen = NumberOption(_("Generations"), 5, 1, self.MAX_GENERATIONS) max_gen.set_help( _("The number of generations " "to include in the report")) menu.add_option(category_name, "maxgen", max_gen) circle = EnumeratedListOption(_('Type of graph'), HALF_CIRCLE) circle.add_item(FULL_CIRCLE, _('full circle')) circle.add_item(HALF_CIRCLE, _('half circle')) circle.add_item(QUAR_CIRCLE, _('quarter circle')) circle.set_help( _("The form of the graph: full circle, half circle," " or quarter circle.")) menu.add_option(category_name, "circle", circle) background = EnumeratedListOption(_('Background color'), BACKGROUND_GEN) background.add_item(BACKGROUND_WHITE, _('white')) background.add_item(BACKGROUND_GEN, _('generation dependent')) background.set_help( _("Background color is either white or generation" " dependent")) menu.add_option(category_name, "background", background) radial = EnumeratedListOption(_('Orientation of radial texts'), RADIAL_UPRIGHT) radial.add_item(RADIAL_UPRIGHT, _('upright')) radial.add_item(RADIAL_ROUNDABOUT, _('roundabout')) radial.set_help(_("Print radial texts upright or roundabout")) menu.add_option(category_name, "radial", radial) draw_empty = BooleanOption(_("Draw empty boxes"), True) draw_empty.set_help( _("Draw the background " "although there is no information")) menu.add_option(category_name, "draw_empty", draw_empty) same_style = BooleanOption( _("Use one font style " "for all generations"), True) same_style.set_help( _("You can customize font and color " "for each generation in the style editor")) menu.add_option(category_name, "same_style", same_style) stdoptions.add_localization_option(menu, category_name)
def add_menu_options(self, menu): ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) add_option("pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) stdoptions.add_name_format_option(menu, category_name) self.__update_filters() self.incdate = BooleanOption( _("Include Birth, Marriage and Death dates"), True) self.incdate.set_help( _("Include the dates that the individual was " "born, got married and/or died in the graph labels.")) add_option("incdate", self.incdate) self.incdate.connect('value-changed', self.__include_dates_changed) self.justyears = BooleanOption(_("Limit dates to years only"), False) self.justyears.set_help( _("Prints just dates' year, neither " "month or day nor date approximation " "or interval are shown.")) add_option("justyears", self.justyears) use_place = BooleanOption(_("Use place when no date"), True) use_place.set_help( _("When no birth, marriage, or death date is " "available, the correspondent place field " "will be used.")) add_option("use_place", use_place) url = BooleanOption(_("Include URLs"), False) url.set_help( _("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) incid = BooleanOption(_("Include IDs"), False) incid.set_help(_("Include individual and family IDs.")) add_option("incid", incid) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help( _("Whether to show every " "person's relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) if __debug__: self.__show_GaGb = BooleanOption( _("Include relationship " "debugging numbers also"), False) self.__show_GaGb.set_help( _("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship calculator")) add_option("advrelinfo", self.__show_GaGb) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear " "relative to the name")) add_option("imageOnTheSide", self.__image_on_side) stdoptions.add_localization_option(menu, category_name) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ color = EnumeratedListOption(_("Graph coloring"), 'filled') for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help( _("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range(0, len(_ARROWS)): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) roundedcorners = BooleanOption( # see bug report #2180 _("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help( _("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help( _("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily)
def add_menu_options(self, menu): """ Add options to the menu for the statistics report. """ ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the report.")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter.")) add_option("pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__update_filters() sortby = EnumeratedListOption(_('Sort chart items by'), _options.SORT_VALUE) for item_idx in range(len(_options.opt_sorts)): item = _options.opt_sorts[item_idx] sortby.add_item(item_idx, item[2]) sortby.set_help(_("Select how the statistical data is sorted.")) add_option("sortby", sortby) reverse = BooleanOption(_("Sort in reverse order"), False) reverse.set_help(_("Check to reverse the sorting order.")) add_option("reverse", reverse) this_year = time.localtime()[0] year_from = NumberOption(_("People Born After"), 1700, 1, this_year) year_from.set_help(_("Birth year from which to include people.")) add_option("year_from", year_from) year_to = NumberOption(_("People Born Before"), this_year, 1, this_year) year_to.set_help(_("Birth year until which to include people")) add_option("year_to", year_to) no_years = BooleanOption(_("Include people without known birth years"), False) no_years.set_help( _("Whether to include people without " "known birth years.")) add_option("no_years", no_years) gender = EnumeratedListOption(_('Genders included'), Person.UNKNOWN) for item_idx in range(len(_options.opt_genders)): item = _options.opt_genders[item_idx] gender.add_item(item[0], item[2]) gender.set_help( _("Select which genders are included into " "statistics.")) add_option("gender", gender) bar_items = NumberOption(_("Max. items for a pie"), 8, 0, 20) bar_items.set_help( _("With fewer items pie chart and legend will be " "used instead of a bar chart.")) add_option("bar_items", bar_items) stdoptions.add_localization_option(menu, category_name) # ------------------------------------------------- # List of available charts on separate option tabs idx = 0 half = len(_Extract.extractors) // 2 chart_types = [] for (chart_opt, tuple) in _Extract.extractors.items(): chart_types.append((_(tuple[1]), chart_opt, tuple)) sorted_chart_types = sorted(chart_types, key=lambda x: glocale.sort_key(x[0])) for (translated_option_name, opt_name, tuple) in sorted_chart_types: if idx <= half: category_name = _("Charts 1") else: category_name = _("Charts 2") opt = BooleanOption(translated_option_name, False) opt.set_help(_("Include charts with indicated data.")) menu.add_option(category_name, opt_name, opt) idx += 1 # Enable a couple of charts by default menu.get_option_by_name("data_gender").set_value(True) menu.get_option_by_name("data_ccount").set_value(True) menu.get_option_by_name("data_bmonth").set_value(True)
class RelGraphOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__pid = None self.__filter = None self.__show_relships = None self.__show_GaGb = None self.__include_images = None self.__image_on_side = None self.__db = dbase MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) ################################ add_option = partial(menu.add_option, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item(1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item(2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item(3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item(4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item(5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item(6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.set_help(_("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) url = BooleanOption(_("Include URLs"), False) url.set_help(_("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) include_id = EnumeratedListOption(_('Include Gramps ID'), 0) include_id.add_item(0, _('Do not include')) include_id.add_item(1, _('Share an existing line')) include_id.add_item(2, _('On a line of its own')) include_id.set_help(_("Whether (and where) to include Gramps IDs")) add_option("incid", include_id) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help(_("Whether to show every " "person's relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear " "relative to the name")) add_option("imageOnTheSide", self.__image_on_side) if __debug__: self.__show_GaGb = BooleanOption(_("Include relationship " "debugging numbers also"), False) self.__show_GaGb.set_help(_("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship calculator")) add_option("advrelinfo", self.__show_GaGb) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ color = EnumeratedListOption(_("Graph coloring"), 'filled') for i in range( 0, len(_COLORS) ): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use when the gender is unknown.') ) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range( 0, len(_ARROWS) ): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) roundedcorners = BooleanOption( # see bug report #2180 _("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help(_("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help(_("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily) def __update_filters(self): """ Update the filter list based on the selected person """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) nfv = self._nf.get_value() filter_list = ReportUtils.get_person_filters(person, include_single=False, name_format=nfv) self.__filter.set_filters(filter_list) def __filter_changed(self): """ Handle filter change. If the filter is not specific to a person, disable the person option """ filter_value = self.__filter.get_value() if filter_value in [1, 2, 3, 4]: # Filters 1, 2, 3 and 4 rely on the center person self.__pid.set_available(True) elif self.__show_relships and self.__show_relships.get_value(): self.__pid.set_available(True) else: # The rest don't self.__pid.set_available(False) def __image_changed(self): """ Handle thumbnail change. If the image is not to be included, make the image location option unavailable. """ self.__image_on_side.set_available(self.__include_images.get_value()) def __show_relships_changed(self): """ Enable/disable menu items if relationships are required """ if self.__show_GaGb: self.__show_GaGb.set_available(self.__show_relships.get_value()) self.__filter_changed()
class FamilyLinesOptions(MenuReportOptions): """ Defines all of the controls necessary to configure the FamilyLines report. """ def __init__(self, name, dbase): self.limit_parents = None self.max_parents = None self.limit_children = None self.max_children = None self.include_images = None self.image_location = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): # --------------------- category_name = _('Report Options') add_option = partial(menu.add_option, category_name) # --------------------- stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name, default=False) followpar = BooleanOption( _('Follow parents to determine ' '"family lines"'), True) followpar.set_help( _('Parents and their ancestors will be ' 'considered when determining "family lines".')) add_option('followpar', followpar) followchild = BooleanOption( _('Follow children to determine ' '"family lines"'), True) followchild.set_help( _('Children will be considered when ' 'determining "family lines".')) add_option('followchild', followchild) remove_extra_people = BooleanOption( _('Try to remove extra ' 'people and families'), True) remove_extra_people.set_help( _('People and families not directly ' 'related to people of interest will ' 'be removed when determining ' '"family lines".')) add_option('removeextra', remove_extra_people) use_roundedcorners = BooleanOption(_('Use rounded corners'), False) use_roundedcorners.set_help( _('Use rounded corners to differentiate ' 'between women and men.')) add_option("useroundedcorners", use_roundedcorners) color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help( _("Males will be shown with blue, females " "with red, unless otherwise set above for filled. " "If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) stdoptions.add_localization_option(menu, category_name) # -------------------------------- add_option = partial(menu.add_option, _('People of Interest')) # -------------------------------- person_list = PersonListOption(_('People of interest')) person_list.set_help( _('People of interest are used as a starting ' 'point when determining "family lines".')) add_option('gidlist', person_list) self.limit_parents = BooleanOption(_('Limit the number of ancestors'), False) self.limit_parents.set_help( _('Whether to ' 'limit the number of ancestors.')) add_option('limitparents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents.set_help( _('The maximum number ' 'of ancestors to include.')) add_option('maxparents', self.max_parents) self.limit_children = BooleanOption( _('Limit the number ' 'of descendants'), False) self.limit_children.set_help( _('Whether to ' 'limit the number of descendants.')) add_option('limitchildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 10, 9999) self.max_children.set_help( _('The maximum number ' 'of descendants to include.')) add_option('maxchildren', self.max_children) # -------------------- add_option = partial(menu.add_option, _('Include')) # -------------------- include_id = EnumeratedListOption(_('Include Gramps ID'), 0) include_id.add_item(0, _('Do not include')) include_id.add_item(1, _('Share an existing line')) include_id.add_item(2, _('On a line of its own')) include_id.set_help(_("Whether (and where) to include Gramps IDs")) add_option("incid", include_id) self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates.set_help( _('Whether to include dates for people ' 'and families.')) add_option('incdates', self.include_dates) self.include_dates.connect('value-changed', self.include_dates_changed) self.justyears = BooleanOption(_("Limit dates to years only"), False) self.justyears.set_help( _("Prints just dates' year, neither " "month or day nor date approximation " "or interval are shown.")) add_option("justyears", self.justyears) include_places = BooleanOption(_('Include places'), True) include_places.set_help( _('Whether to include placenames for people ' 'and families.')) add_option('incplaces', include_places) include_num_children = BooleanOption( _('Include the number of ' 'children'), True) include_num_children.set_help( _('Whether to include the number of ' 'children for families with more ' 'than 1 child.')) add_option('incchildcnt', include_num_children) self.include_images = BooleanOption( _('Include ' 'thumbnail images of people'), True) self.include_images.set_help( _('Whether to ' 'include thumbnail images of people.')) add_option('incimages', self.include_images) self.include_images.connect('value-changed', self.images_changed) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) self.image_location.add_item(0, _('Above the name')) self.image_location.add_item(1, _('Beside the name')) self.image_location.set_help( _('Where the thumbnail image ' 'should appear relative to the name')) add_option('imageonside', self.image_location) # ---------------------------- add_option = partial(menu.add_option, _('Family Colors')) # ---------------------------- surname_color = SurnameColorOption(_('Family colors')) surname_color.set_help(_('Colors to use for various family lines.')) add_option('surnamecolors', surname_color) # ------------------------- add_option = partial(menu.add_option, _('Individuals')) # ------------------------- color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use ' 'when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) self.limit_changed() self.images_changed() def limit_changed(self): """ Handle the change of limiting parents and children. """ self.max_parents.set_available(self.limit_parents.get_value()) self.max_children.set_available(self.limit_children.get_value()) def images_changed(self): """ Handle the change of including images. """ self.image_location.set_available(self.include_images.get_value()) def include_dates_changed(self): """ Enable/disable menu items if dates are required """ if self.include_dates.get_value(): self.justyears.set_available(True) else: self.justyears.set_available(False)
class TagOptions(MenuReportOptions): """ Options for the Tag Report """ def __init__(self, name, dbase): self.__db = dbase MenuReportOptions.__init__(self, name, dbase) def get_subject(self): """ Return a string that describes the subject of the report. """ return self.__tag_option.get_value() def add_menu_options(self, menu): """ Add options to the menu for the tag report. """ category_name = _("Report Options") all_tags = [] for handle in self.__db.get_tag_handles(sort_handles=True): tag = self.__db.get_tag_from_handle(handle) all_tags.append(tag.get_name()) if len(all_tags) > 0: self.__tag_option = EnumeratedListOption(_('Tag'), all_tags[0]) for tag_name in all_tags: self.__tag_option.add_item(tag_name, tag_name) else: self.__tag_option = EnumeratedListOption(_('Tag'), '') self.__tag_option.add_item('', '') self.__tag_option.set_help(_("The tag to use for the report")) menu.add_option(category_name, "tag", self.__tag_option) stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_localization_option(menu, category_name) def make_default_style(self, default_style): """Make the default output style for the Tag Report.""" # Paragraph Styles font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) font.set_bold(1) para = ParagraphStyle() para.set_header_level(1) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set_description(_("The style used for the title of the page.")) default_style.add_paragraph_style("TR-Title", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=12, bold=1) para = ParagraphStyle() para.set_header_level(1) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_font(font) para.set_alignment(PARA_ALIGN_CENTER) para.set_description(_('The style used for the subtitle.')) default_style.add_paragraph_style("TR-ReportSubtitle", para) font = FontStyle() font.set(face=FONT_SANS_SERIF, size=14, italic=1) para = ParagraphStyle() para.set_font(font) para.set_header_level(2) para.set_top_margin(0.25) para.set_bottom_margin(0.25) para.set_description(_('The style used for the section headers.')) default_style.add_paragraph_style("TR-Heading", para) font = FontStyle() font.set_size(12) para = ParagraphStyle() para.set(first_indent=-0.75, lmargin=.75) para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for the text display.')) default_style.add_paragraph_style("TR-Normal", para) font = FontStyle() font.set_size(12) font.set_bold(True) para = ParagraphStyle() para.set(first_indent=-0.75, lmargin=.75) para.set_font(font) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for table headings.')) default_style.add_paragraph_style("TR-Normal-Bold", para) para = ParagraphStyle() para.set(first_indent=-0.75, lmargin=.75) para.set_top_margin(utils.pt2cm(3)) para.set_bottom_margin(utils.pt2cm(3)) para.set_description(_('The basic style used for the note display.')) default_style.add_paragraph_style("TR-Note", para) #Table Styles cell = TableCellStyle() default_style.add_cell_style('TR-TableCell', cell) table = TableStyle() table.set_width(100) table.set_columns(4) table.set_column_width(0, 10) table.set_column_width(1, 30) table.set_column_width(2, 30) table.set_column_width(3, 30) default_style.add_table_style('TR-Table', table)
class AncestorTreeOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__db = dbase self.__pid = None self.box_Y_sf = None self.box_shadow_sf = None MenuReportOptions.__init__(self, name, dbase) def get_subject(self): """ Return a string that describes the subject of the report. """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) return _nd.display(person) def add_menu_options(self, menu): ################## category_name = _("Tree Options") self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the tree")) menu.add_option(category_name, "pid", self.__pid) siblings = BooleanOption(_('Include siblings of the center person'), False) siblings.set_help( _("Whether to only display the center person or all " "of his/her siblings too")) menu.add_option(category_name, "inc_siblings", siblings) self.max_gen = NumberOption(_("Generations"), 10, 1, 50) self.max_gen.set_help( _("The number of generations to include " "in the tree")) menu.add_option(category_name, "maxgen", self.max_gen) self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"), 0) self.fillout.set_help( _("The number of generations of empty " "boxes that will be displayed")) menu.add_option(category_name, "fill_out", self.fillout) self.max_gen.connect('value-changed', self.__fillout_vals) self.__fillout_vals() compress = BooleanOption(_('Compress tree'), True) compress.set_help( _("Whether to remove any extra blank spaces set " "aside for people that are unknown")) menu.add_option(category_name, "compress_tree", compress) #better to 'Show siblings of\nthe center person #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center " # "person"), 0) #Spouse_disp.add_item(0, _("No. Do not show Spouses")) #Spouse_disp.add_item(1, _("Yes, and use the Main Display Format")) #Spouse_disp.add_item(2, _("Yes, and use the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) ################## category_name = _("Report Options") self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item(0, _("Do not include a title")) self.title.add_item(1, _("Include Report Title")) self.title.set_help(_("Choose a title for the report")) menu.add_option(category_name, "report_title", self.title) border = BooleanOption(_('Include a border'), False) border.set_help(_("Whether to make a border around the report.")) menu.add_option(category_name, "inc_border", border) prnnum = BooleanOption(_('Include Page Numbers'), False) prnnum.set_help(_("Whether to print page numbers on each page.")) menu.add_option(category_name, "inc_pagenum", prnnum) self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) self.scale.add_item(0, _("Do not scale tree")) self.scale.add_item(1, _("Scale tree to fit page width only")) self.scale.add_item(2, _("Scale tree to fit the size of the page")) self.scale.set_help( _("Whether to scale the tree to fit a specific paper size")) menu.add_option(category_name, "scale_tree", self.scale) self.scale.connect('value-changed', self.__check_blank) if "BKI" not in self.name.split(","): self.__onepage = BooleanOption( _("Resize Page to Fit Tree size\n" "\n" "Note: Overrides options in the 'Paper Option' tab"), False) self.__onepage.set_help( _("Whether to resize the page to fit the size \n" "of the tree. Note: the page will have a \n" "non standard size.\n" "\n" "With this option selected, the following will happen:\n" "\n" "With the 'Do not scale tree' option the page\n" " is resized to the height/width of the tree\n" "\n" "With 'Scale tree to fit page width only' the height of\n" " the page is resized to the height of the tree\n" "\n" "With 'Scale tree to fit the size of the page' the page\n" " is resized to remove any gap in either height or width")) menu.add_option(category_name, "resize_page", self.__onepage) self.__onepage.connect('value-changed', self.__check_blank) else: self.__onepage = None self.__blank = BooleanOption(_('Include Blank Pages'), True) self.__blank.set_help(_("Whether to include pages that are blank.")) menu.add_option(category_name, "inc_blank", self.__blank) self.__check_blank() ################## category_name = _("Report Options (2)") stdoptions.add_name_format_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) ################## category_name = _("Display") disp = TextOption( _("Father\nDisplay Format"), ["$n", "%s $b" % _BORN, "-{%s $d}" % _DIED]) disp.set_help(_("Display format for the fathers box.")) menu.add_option(category_name, "father_disp", disp) #Will add when libsubstkeyword supports it. #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \ # with"), 0) #missing.add_item(0, _("Does not display anything")) #missing.add_item(1, _("Displays '_____'")) #missing.set_help(_("What will print when information is not known")) #menu.add_option(category_name, "miss_val", missing) disp_mom = TextOption( _("Mother\nDisplay Format"), ["$n", "%s $b" % _BORN, "%s $m" % _MARR, "-{%s $d}" % _DIED]) disp_mom.set_help(_("Display format for the mothers box.")) menu.add_option(category_name, "mother_disp", disp_mom) center_disp = EnumeratedListOption( _("Center person uses\n" "which format"), 0) center_disp.add_item(0, _("Use Fathers Display format")) center_disp.add_item(1, _("Use Mothers display format")) center_disp.set_help(_("The display format for the center person")) menu.add_option(category_name, "center_uses", center_disp) self.incmarr = BooleanOption(_('Include Marriage box'), False) self.incmarr.set_help( _("Whether to include a separate marital box in the report")) menu.add_option(category_name, "inc_marr", self.incmarr) self.incmarr.connect('value-changed', self._incmarr_changed) self.marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR) self.marrdisp.set_help(_("Display format for the marital box.")) menu.add_option(category_name, "marr_disp", self.marrdisp) self._incmarr_changed() ################## category_name = _("Advanced") repldisp = TextOption( _("Replace Display Format:\n'Replace this'/' with this'"), []) repldisp.set_help(_("i.e.\nUnited States of America/U.S.A.")) menu.add_option(category_name, "replace_list", repldisp) # TODO this code is never used and so I conclude it is for future use # self.__include_images = BooleanOption( # _('Include thumbnail images of people'), False) # self.__include_images.set_help( # _("Whether to include thumbnails of people.")) # menu.add_option(category_name, "includeImages", # self.__include_images) self.usenote = BooleanOption(_('Include a note'), False) self.usenote.set_help(_("Whether to include a note on the report.")) menu.add_option(category_name, "inc_note", self.usenote) self.usenote.connect('value-changed', self._usenote_changed) self.notedisp = TextOption(_("Note"), []) self.notedisp.set_help(_("Add a note\n\n" "$T inserts today's date")) menu.add_option(category_name, "note_disp", self.notedisp) locales = NoteType(0, 1) self.notelocal = EnumeratedListOption(_("Note Location"), 0) for num, text in locales.note_locals(): self.notelocal.add_item(num, text) self.notelocal.set_help(_("Where to place the note.")) menu.add_option(category_name, "note_place", self.notelocal) self._usenote_changed() self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10, 2.00, 0.01) self.box_Y_sf.set_help( _("Make the inter-box spacing bigger or smaller")) menu.add_option(category_name, "box_Yscale", self.box_Y_sf) self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00, 0.00, 2.00, 0.01) # down to 0 self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller")) menu.add_option(category_name, "shadowscale", self.box_shadow_sf) def _incmarr_changed(self): """ If Marriage box is not enabled, disable Marriage Display Format box """ value = self.incmarr.get_value() self.marrdisp.set_available(value) def _usenote_changed(self): """ If Note box is not enabled, disable Note Location box """ value = self.usenote.get_value() self.notelocal.set_available(value) def __check_blank(self): if self.__onepage: value = not self.__onepage.get_value() else: value = True off = value and (self.scale.get_value() != 2) self.__blank.set_available(off) def __fillout_vals(self): max_gen = self.max_gen.get_value() old_val = self.fillout.get_value() item_list = [] item_list.append( [0, _("No generations of empty boxes " "for unknown ancestors")]) if max_gen > 1: item_list.append([ 1, _("One Generation of empty boxes " "for unknown ancestors") ]) item_list.extend([ itr, str(itr) + _(" Generations of empty boxes for unknown ancestors") ] for itr in range(2, max_gen)) self.fillout.set_items(item_list) if old_val + 2 > len(item_list): self.fillout.set_value(len(item_list) - 2) def make_default_style(self, default_style): """Make the default output style for the Ancestor Tree.""" # Paragraph Styles: font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description( _('The basic style used for the text display.')) default_style.add_paragraph_style("AC2-Normal", para_style) box_shadow = PT2CM(font.get_size()) * .6 font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description( _('The basic style used for the note display.')) default_style.add_paragraph_style("AC2-Note", para_style) font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_alignment(PARA_ALIGN_CENTER) para_style.set_description(_('The style used for the title.')) default_style.add_paragraph_style("AC2-Title", para_style) # Draw styles graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") graph_style.set_shadow(1, box_shadow) # shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") #graph_style.set_shadow(0, PT2CM(9)) # shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-fam-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Note") graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-note-box", graph_style) # TODO this seems meaningless, as only the text is displayed graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Title") graph_style.set_color((0, 0, 0)) graph_style.set_fill_color((255, 255, 255)) graph_style.set_line_width(0) graph_style.set_description(_("Cannot edit this reference")) default_style.add_draw_style("AC2-Title-box", graph_style) graph_style = GraphicsStyle() default_style.add_draw_style("AC2-line", graph_style)
def add_menu_options(self, menu): ################## category_name = _("Tree Options") self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the tree")) menu.add_option(category_name, "pid", self.__pid) siblings = BooleanOption(_('Include siblings of the center person'), False) siblings.set_help( _("Whether to only display the center person or all " "of his/her siblings too")) menu.add_option(category_name, "inc_siblings", siblings) self.max_gen = NumberOption(_("Generations"), 10, 1, 50) self.max_gen.set_help( _("The number of generations to include " "in the tree")) menu.add_option(category_name, "maxgen", self.max_gen) self.fillout = EnumeratedListOption(_("Display unknown\ngenerations"), 0) self.fillout.set_help( _("The number of generations of empty " "boxes that will be displayed")) menu.add_option(category_name, "fill_out", self.fillout) self.max_gen.connect('value-changed', self.__fillout_vals) self.__fillout_vals() compress = BooleanOption(_('Compress tree'), True) compress.set_help( _("Whether to remove any extra blank spaces set " "aside for people that are unknown")) menu.add_option(category_name, "compress_tree", compress) #better to 'Show siblings of\nthe center person #Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center " # "person"), 0) #Spouse_disp.add_item(0, _("No. Do not show Spouses")) #Spouse_disp.add_item(1, _("Yes, and use the Main Display Format")) #Spouse_disp.add_item(2, _("Yes, and use the Secondary " # "Display Format")) #Spouse_disp.set_help(_("Show spouses of the center person?")) #menu.add_option(category_name, "Spouse_disp", Spouse_disp) ################## category_name = _("Report Options") self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item(0, _("Do not include a title")) self.title.add_item(1, _("Include Report Title")) self.title.set_help(_("Choose a title for the report")) menu.add_option(category_name, "report_title", self.title) border = BooleanOption(_('Include a border'), False) border.set_help(_("Whether to make a border around the report.")) menu.add_option(category_name, "inc_border", border) prnnum = BooleanOption(_('Include Page Numbers'), False) prnnum.set_help(_("Whether to print page numbers on each page.")) menu.add_option(category_name, "inc_pagenum", prnnum) self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) self.scale.add_item(0, _("Do not scale tree")) self.scale.add_item(1, _("Scale tree to fit page width only")) self.scale.add_item(2, _("Scale tree to fit the size of the page")) self.scale.set_help( _("Whether to scale the tree to fit a specific paper size")) menu.add_option(category_name, "scale_tree", self.scale) self.scale.connect('value-changed', self.__check_blank) if "BKI" not in self.name.split(","): self.__onepage = BooleanOption( _("Resize Page to Fit Tree size\n" "\n" "Note: Overrides options in the 'Paper Option' tab"), False) self.__onepage.set_help( _("Whether to resize the page to fit the size \n" "of the tree. Note: the page will have a \n" "non standard size.\n" "\n" "With this option selected, the following will happen:\n" "\n" "With the 'Do not scale tree' option the page\n" " is resized to the height/width of the tree\n" "\n" "With 'Scale tree to fit page width only' the height of\n" " the page is resized to the height of the tree\n" "\n" "With 'Scale tree to fit the size of the page' the page\n" " is resized to remove any gap in either height or width")) menu.add_option(category_name, "resize_page", self.__onepage) self.__onepage.connect('value-changed', self.__check_blank) else: self.__onepage = None self.__blank = BooleanOption(_('Include Blank Pages'), True) self.__blank.set_help(_("Whether to include pages that are blank.")) menu.add_option(category_name, "inc_blank", self.__blank) self.__check_blank() ################## category_name = _("Report Options (2)") stdoptions.add_name_format_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) ################## category_name = _("Display") disp = TextOption( _("Father\nDisplay Format"), ["$n", "%s $b" % _BORN, "-{%s $d}" % _DIED]) disp.set_help(_("Display format for the fathers box.")) menu.add_option(category_name, "father_disp", disp) #Will add when libsubstkeyword supports it. #missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \ # with"), 0) #missing.add_item(0, _("Does not display anything")) #missing.add_item(1, _("Displays '_____'")) #missing.set_help(_("What will print when information is not known")) #menu.add_option(category_name, "miss_val", missing) disp_mom = TextOption( _("Mother\nDisplay Format"), ["$n", "%s $b" % _BORN, "%s $m" % _MARR, "-{%s $d}" % _DIED]) disp_mom.set_help(_("Display format for the mothers box.")) menu.add_option(category_name, "mother_disp", disp_mom) center_disp = EnumeratedListOption( _("Center person uses\n" "which format"), 0) center_disp.add_item(0, _("Use Fathers Display format")) center_disp.add_item(1, _("Use Mothers display format")) center_disp.set_help(_("The display format for the center person")) menu.add_option(category_name, "center_uses", center_disp) self.incmarr = BooleanOption(_('Include Marriage box'), False) self.incmarr.set_help( _("Whether to include a separate marital box in the report")) menu.add_option(category_name, "inc_marr", self.incmarr) self.incmarr.connect('value-changed', self._incmarr_changed) self.marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR) self.marrdisp.set_help(_("Display format for the marital box.")) menu.add_option(category_name, "marr_disp", self.marrdisp) self._incmarr_changed() ################## category_name = _("Advanced") repldisp = TextOption( _("Replace Display Format:\n'Replace this'/' with this'"), []) repldisp.set_help(_("i.e.\nUnited States of America/U.S.A.")) menu.add_option(category_name, "replace_list", repldisp) # TODO this code is never used and so I conclude it is for future use # self.__include_images = BooleanOption( # _('Include thumbnail images of people'), False) # self.__include_images.set_help( # _("Whether to include thumbnails of people.")) # menu.add_option(category_name, "includeImages", # self.__include_images) self.usenote = BooleanOption(_('Include a note'), False) self.usenote.set_help(_("Whether to include a note on the report.")) menu.add_option(category_name, "inc_note", self.usenote) self.usenote.connect('value-changed', self._usenote_changed) self.notedisp = TextOption(_("Note"), []) self.notedisp.set_help(_("Add a note\n\n" "$T inserts today's date")) menu.add_option(category_name, "note_disp", self.notedisp) locales = NoteType(0, 1) self.notelocal = EnumeratedListOption(_("Note Location"), 0) for num, text in locales.note_locals(): self.notelocal.add_item(num, text) self.notelocal.set_help(_("Where to place the note.")) menu.add_option(category_name, "note_place", self.notelocal) self._usenote_changed() self.box_Y_sf = NumberOption(_("inter-box scale factor"), 1.00, 0.10, 2.00, 0.01) self.box_Y_sf.set_help( _("Make the inter-box spacing bigger or smaller")) menu.add_option(category_name, "box_Yscale", self.box_Y_sf) self.box_shadow_sf = NumberOption(_("box shadow scale factor"), 1.00, 0.00, 2.00, 0.01) # down to 0 self.box_shadow_sf.set_help(_("Make the box shadow bigger or smaller")) menu.add_option(category_name, "shadowscale", self.box_shadow_sf)
def add_menu_options(self, menu): """ Add the options for the text birthday report """ category_name = _("Report Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select the filter to be applied to the report.")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter.")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) stdoptions.add_private_data_option(menu, category_name) alive = BooleanOption(_("Include only living people"), True) alive.set_help(_("Include only living people in the report")) menu.add_option(category_name, "alive", alive) self.__update_filters() stdoptions.add_localization_option(menu, category_name) category_name = _("Content") year = NumberOption(_("Year of report"), time.localtime()[0], 1000, 3000) year.set_help(_("Year of report")) menu.add_option(category_name, "year", year) country = EnumeratedListOption(_("Country for holidays"), 0) holiday_table = libholiday.HolidayTable() countries = holiday_table.get_countries() countries.sort() if (len(countries) == 0 or (len(countries) > 0 and countries[0] != '')): countries.insert(0, '') count = 0 for c in holiday_table.get_countries(): country.add_item(count, c) count += 1 country.set_help(_("Select the country to see associated holidays")) menu.add_option(category_name, "country", country) start_dow = EnumeratedListOption(_("First day of week"), 1) long_days = date_displayer.long_days for count in range(1, 8): # conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below start_dow.add_item((count+5) % 7 + 1, long_days[count].capitalize()) start_dow.set_help(_("Select the first day of the week for the report")) menu.add_option(category_name, "start_dow", start_dow) maiden_name = EnumeratedListOption(_("Birthday surname"), "own") maiden_name.add_item("spouse_first", _("Wives use husband's surname (from first family listed)")) maiden_name.add_item("spouse_last", _("Wives use husband's surname (from last family listed)")) maiden_name.add_item("own", _("Wives use their own surname")) maiden_name.set_help(_("Select married women's displayed surname")) menu.add_option(category_name, "maiden_name", maiden_name) birthdays = BooleanOption(_("Include birthdays"), True) birthdays.set_help(_("Include birthdays in the report")) menu.add_option(category_name, "birthdays", birthdays) anniversaries = BooleanOption(_("Include anniversaries"), True) anniversaries.set_help(_("Include anniversaries in the report")) menu.add_option(category_name, "anniversaries", anniversaries) option = BooleanOption(_("Include relationships to center person"), False) option.set_help(_("Include relationships to center person (slower)")) menu.add_option(category_name, "relationships", option) category_name = _("Text Options") titletext = StringOption(_("Title text"), _(_TITLE0)) titletext.set_help(_("Title of report")) menu.add_option(category_name, "titletext", titletext) text1 = StringOption(_("Text Area 1"), _(_TITLE1)) text1.set_help(_("First line of text at bottom of report")) menu.add_option(category_name, "text1", text1) text2 = StringOption(_("Text Area 2"), _(_TITLE2)) text2.set_help(_("Second line of text at bottom of report")) menu.add_option(category_name, "text2", text2) text3 = StringOption(_("Text Area 3"), URL_HOMEPAGE,) text3.set_help(_("Third line of text at bottom of report")) menu.add_option(category_name, "text3", text3)
def add_menu_options(self, menu): """ Add the options for the text birthday report """ category_name = _("Report Options") self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Select the filter to be applied to the report.")) menu.add_option(category_name, "filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Filter Person")) self.__pid.set_help(_("The center person for the filter.")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) titletext = StringOption(_("Title text"), _(_TITLE0)) titletext.set_help(_("Title of report")) menu.add_option(category_name, "titletext", titletext) text1 = StringOption(_("Text Area 1"), _(_TITLE1)) text1.set_help(_("First line of text at bottom of report")) menu.add_option(category_name, "text1", text1) text2 = StringOption(_("Text Area 2"), _(_TITLE2)) text2.set_help(_("Second line of text at bottom of report")) menu.add_option(category_name, "text2", text2) text3 = StringOption(_("Text Area 3"), URL_HOMEPAGE,) text3.set_help(_("Third line of text at bottom of report")) menu.add_option(category_name, "text3", text3) category_name = _("Report Options (2)") self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) stdoptions.add_private_data_option(menu, category_name) alive = BooleanOption(_("Include only living people"), True) alive.set_help(_("Include only living people in the report")) menu.add_option(category_name, "alive", alive) deadtxt = StringOption(_("Dead Symbol"), _(_DEADTXT)) deadtxt.set_help(_("This will show after name to indicate that person is dead")) menu.add_option(category_name, "deadtxt", deadtxt) self.__update_filters() stdoptions.add_localization_option(menu, category_name) showyear = BooleanOption(_("Show event year"), True) showyear.set_help(_("Prints the year the event took place in the report")) menu.add_option(category_name, "showyear", showyear) category_name = _("Content") year = NumberOption(_("Year of report"), time.localtime()[0], 1000, 3000) year.set_help(_("Year of report")) menu.add_option(category_name, "year", year) country = EnumeratedListOption(_("Country for holidays"), 0) holiday_table = libholiday.HolidayTable() countries = holiday_table.get_countries() countries.sort() if (len(countries) == 0 or (len(countries) > 0 and countries[0] != '')): countries.insert(0, '') count = 0 for c in countries: country.add_item(count, c) count += 1 country.set_help(_("Select the country to see associated holidays")) menu.add_option(category_name, "country", country) maiden_name = EnumeratedListOption(_("Birthday surname"), "own") maiden_name.add_item( "spouse_first", _("Wives use husband's surname (from first family listed)")) maiden_name.add_item( "spouse_last", _("Wives use husband's surname (from last family listed)")) maiden_name.add_item("own", _("Wives use their own surname")) maiden_name.set_help(_("Select married women's displayed surname")) menu.add_option(category_name, "maiden_name", maiden_name) birthdays = BooleanOption(_("Include birthdays"), True) birthdays.set_help(_("Whether to include birthdays")) menu.add_option(category_name, "birthdays", birthdays) anniversaries = BooleanOption(_("Include anniversaries"), True) anniversaries.set_help(_("Whether to include anniversaries")) menu.add_option(category_name, "anniversaries", anniversaries) death_anniversaries = BooleanOption(_("Include death anniversaries"), True) death_anniversaries.set_help(_("Whether to include anniversaries of death")) menu.add_option(category_name, "death_anniversaries", death_anniversaries) show_relships = BooleanOption( _("Include relationship to center person"), False) show_relships.set_help( _("Whether to include relationships to the center person")) menu.add_option(category_name, "relationships", show_relships)
class FamilyLinesOptions(MenuReportOptions): """ Defines all of the controls necessary to configure the FamilyLines report. """ def __init__(self, name, dbase): self.limit_parents = None self.max_parents = None self.limit_children = None self.max_children = None self.include_images = None self.image_location = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): # --------------------- category_name = _('Report Options') add_option = partial(menu.add_option, category_name) # --------------------- stdoptions.add_name_format_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name, default=False) followpar = BooleanOption(_('Follow parents to determine ' '"family lines"'), True) followpar.set_help(_('Parents and their ancestors will be ' 'considered when determining "family lines".')) add_option('followpar', followpar) followchild = BooleanOption(_('Follow children to determine ' '"family lines"'), True) followchild.set_help(_('Children will be considered when ' 'determining "family lines".')) add_option('followchild', followchild) remove_extra_people = BooleanOption(_('Try to remove extra ' 'people and families'), True) remove_extra_people.set_help(_('People and families not directly ' 'related to people of interest will ' 'be removed when determining ' '"family lines".')) add_option('removeextra', remove_extra_people) use_roundedcorners = BooleanOption(_('Use rounded corners'), False) use_roundedcorners.set_help(_('Use rounded corners to differentiate ' 'between women and men.')) add_option("useroundedcorners", use_roundedcorners) color = EnumeratedListOption(_("Graph coloring"), "filled") for i in range(len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red, unless otherwise set above for filled. " "If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) stdoptions.add_localization_option(menu, category_name) # -------------------------------- add_option = partial(menu.add_option, _('People of Interest')) # -------------------------------- person_list = PersonListOption(_('People of interest')) person_list.set_help(_('People of interest are used as a starting ' 'point when determining "family lines".')) add_option('gidlist', person_list) self.limit_parents = BooleanOption(_('Limit the number of ancestors'), False) self.limit_parents.set_help(_('Whether to ' 'limit the number of ancestors.')) add_option('limitparents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents.set_help(_('The maximum number ' 'of ancestors to include.')) add_option('maxparents', self.max_parents) self.limit_children = BooleanOption(_('Limit the number ' 'of descendants'), False) self.limit_children.set_help(_('Whether to ' 'limit the number of descendants.')) add_option('limitchildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 10, 9999) self.max_children.set_help(_('The maximum number ' 'of descendants to include.')) add_option('maxchildren', self.max_children) # -------------------- category_name = _('Include') add_option = partial(menu.add_option, category_name) # -------------------- stdoptions.add_living_people_option(menu, category_name) include_id = EnumeratedListOption(_('Include Gramps ID'), 0) include_id.add_item(0, _('Do not include')) include_id.add_item(1, _('Share an existing line')) include_id.add_item(2, _('On a line of its own')) include_id.set_help(_("Whether (and where) to include Gramps IDs")) add_option("incid", include_id) self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates.set_help(_('Whether to include dates for people ' 'and families.')) add_option('incdates', self.include_dates) self.include_dates.connect('value-changed', self.include_dates_changed) self.justyears = BooleanOption(_("Limit dates to years only"), False) self.justyears.set_help(_("Prints just dates' year, neither " "month or day nor date approximation " "or interval are shown.")) add_option("justyears", self.justyears) include_places = BooleanOption(_('Include places'), True) include_places.set_help(_('Whether to include placenames for people ' 'and families.')) add_option('incplaces', include_places) include_num_children = BooleanOption(_('Include the number of ' 'children'), True) include_num_children.set_help(_('Whether to include the number of ' 'children for families with more ' 'than 1 child.')) add_option('incchildcnt', include_num_children) self.include_images = BooleanOption(_('Include ' 'thumbnail images of people'), True) self.include_images.set_help(_('Whether to ' 'include thumbnail images of people.')) add_option('incimages', self.include_images) self.include_images.connect('value-changed', self.images_changed) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) self.image_location.add_item(0, _('Above the name')) self.image_location.add_item(1, _('Beside the name')) self.image_location.set_help(_('Where the thumbnail image ' 'should appear relative to the name')) add_option('imageonside', self.image_location) # ---------------------------- add_option = partial(menu.add_option, _('Family Colors')) # ---------------------------- surname_color = SurnameColorOption(_('Family colors')) surname_color.set_help(_('Colors to use for various family lines.')) add_option('surnamecolors', surname_color) # ------------------------- add_option = partial(menu.add_option, _('Individuals')) # ------------------------- color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help(_('The color to use ' 'when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) self.limit_changed() self.images_changed() def limit_changed(self): """ Handle the change of limiting parents and children. """ self.max_parents.set_available(self.limit_parents.get_value()) self.max_children.set_available(self.limit_children.get_value()) def images_changed(self): """ Handle the change of including images. """ self.image_location.set_available(self.include_images.get_value()) def include_dates_changed(self): """ Enable/disable menu items if dates are required """ if self.include_dates.get_value(): self.justyears.set_available(True) else: self.justyears.set_available(False)
class RelGraphOptions(MenuReportOptions): """ Defines options and provides handling interface. """ def __init__(self, name, dbase): self.__pid = None self.__filter = None self.__show_relships = None self.__show_ga_gb = None self.__include_images = None self.__image_on_side = None self.__db = dbase self._nf = None self.event_choice = None MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range(0, len(_ARROWS)): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), 'filled') for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help(_("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) # see bug report #2180 roundedcorners = BooleanOption(_("Use rounded corners"), False) roundedcorners.set_help(_("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) ################################ category_name = _("Report Options (2)") add_option = partial(menu.add_option, category_name) ################################ self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) ################################ add_option = partial(menu.add_option, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item(1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item(2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item(3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item(4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item(5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item(6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.add_item(7, _('Include (birth, marriage, death) ' 'dates and places on same line')) self.event_choice.set_help( _("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) url = BooleanOption(_("Include URLs"), False) url.set_help(_("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help(_("Whether to show every person's " "relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear relative to the name")) add_option("imageOnTheSide", self.__image_on_side) #occupation = BooleanOption(_("Include occupation"), False) occupation = EnumeratedListOption(_('Include occupation'), 0) occupation.add_item(0, _('Do not include any occupation')) occupation.add_item(1, _('Include description ' 'of most recent occupation')) occupation.add_item(2, _('Include date, description and place ' 'of all occupations')) occupation.set_help(_("Whether to include the last occupation")) add_option("occupation", occupation) if __debug__: self.__show_ga_gb = BooleanOption(_("Include relationship " "debugging numbers also"), False) self.__show_ga_gb.set_help(_("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship " "calculator")) add_option("advrelinfo", self.__show_ga_gb) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use when the gender is unknown.') ) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help(_("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help(_("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily) def __update_filters(self): """ Update the filter list based on the selected person """ gid = self.__pid.get_value() person = self.__db.get_person_from_gramps_id(gid) nfv = self._nf.get_value() filter_list = utils.get_person_filters(person, include_single=False, name_format=nfv) self.__filter.set_filters(filter_list) def __filter_changed(self): """ Handle filter change. If the filter is not specific to a person, disable the person option """ if self.__show_relships and self.__show_relships.get_value(): self.__pid.set_available(True) filter_value = self.__filter.get_value() if filter_value == 0: # "Entire Database" (as "include_single=False") self.__pid.set_available(False) else: # The other filters need a center person (assume custom ones too) self.__pid.set_available(True) def __image_changed(self): """ Handle thumbnail change. If the image is not to be included, make the image location option unavailable. """ self.__image_on_side.set_available(self.__include_images.get_value()) def __show_relships_changed(self): """ Enable/disable menu items if relationships are required """ if self.__show_ga_gb: self.__show_ga_gb.set_available(self.__show_relships.get_value()) self.__filter_changed()
def add_menu_options(self, menu): """ Add options to the menu for the fan chart. """ category_name = _("Report Options") self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) max_gen = NumberOption(_("Generations"), 5, 1, self.max_generations) max_gen.set_help(_("The number of generations " "to include in the report")) menu.add_option(category_name, "maxgen", max_gen) circle = EnumeratedListOption(_('Type of graph'), HALF_CIRCLE) circle.add_item(FULL_CIRCLE, _('full circle')) circle.add_item(HALF_CIRCLE, _('half circle')) circle.add_item(QUAR_CIRCLE, _('quarter circle')) circle.set_help(_("The form of the graph: full circle, half circle," " or quarter circle.")) menu.add_option(category_name, "circle", circle) background = EnumeratedListOption(_('Background color'), BACKGROUND_GEN) background.add_item(BACKGROUND_WHITE, _('white')) background.add_item(BACKGROUND_GEN, _('generation dependent')) background.set_help(_("Background color is either white or generation" " dependent")) menu.add_option(category_name, "background", background) radial = EnumeratedListOption(_('Orientation of radial texts'), RADIAL_UPRIGHT) radial.add_item(RADIAL_UPRIGHT, _('upright')) radial.add_item(RADIAL_ROUNDABOUT, _('roundabout')) radial.set_help(_("Print radial texts upright or roundabout")) menu.add_option(category_name, "radial", radial) draw_empty = BooleanOption(_("Draw empty boxes"), True) draw_empty.set_help(_("Draw the background " "although there is no information")) menu.add_option(category_name, "draw_empty", draw_empty) same_style = BooleanOption(_("Use one font style " "for all generations"), True) same_style.set_help(_("You can customize font and color " "for each generation in the style editor")) menu.add_option(category_name, "same_style", same_style) category_name = _("Report Options (2)") stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_localization_option(menu, category_name)
def add_menu_options(self, menu): ################################ category_name = _("Report Options") add_option = partial(menu.add_option, category_name) ################################ self.__filter = FilterOption(_("Filter"), 0) self.__filter.set_help( _("Determines what people are included in the graph")) add_option("filter", self.__filter) self.__filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the report")) menu.add_option(category_name, "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) arrow = EnumeratedListOption(_("Arrowhead direction"), 'd') for i in range(0, len(_ARROWS)): arrow.add_item(_ARROWS[i]["value"], _ARROWS[i]["name"]) arrow.set_help(_("Choose the direction that the arrows point.")) add_option("arrow", arrow) color = EnumeratedListOption(_("Graph coloring"), 'filled') for i in range(0, len(_COLORS)): color.add_item(_COLORS[i]["value"], _COLORS[i]["name"]) color.set_help( _("Males will be shown with blue, females " "with red. If the sex of an individual " "is unknown it will be shown with gray.")) add_option("color", color) # see bug report #2180 roundedcorners = BooleanOption(_("Use rounded corners"), False) roundedcorners.set_help( _("Use rounded corners to differentiate " "between women and men.")) add_option("useroundedcorners", roundedcorners) # see bug report #11112 hexagons = BooleanOption(_("Use hexagons"), False) hexagons.set_help( _("Use hexagons to differentiate " "those of unknown gender.")) add_option("usehexagons", hexagons) stdoptions.add_gramps_id_option(menu, category_name, ownline=True) ################################ category_name = _("Report Options (2)") add_option = partial(menu.add_option, category_name) ################################ self._nf = stdoptions.add_name_format_option(menu, category_name) self._nf.connect('value-changed', self.__update_filters) self.__update_filters() stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) locale_opt = stdoptions.add_localization_option(menu, category_name) stdoptions.add_date_format_option(menu, category_name, locale_opt) ################################ add_option = partial(menu.add_option, _("Include")) ################################ self.event_choice = EnumeratedListOption(_('Dates and/or Places'), 0) self.event_choice.add_item(0, _('Do not include any dates or places')) self.event_choice.add_item( 1, _('Include (birth, marriage, death) ' 'dates, but no places')) self.event_choice.add_item( 2, _('Include (birth, marriage, death) ' 'dates, and places')) self.event_choice.add_item( 3, _('Include (birth, marriage, death) ' 'dates, and places if no dates')) self.event_choice.add_item( 4, _('Include (birth, marriage, death) ' 'years, but no places')) self.event_choice.add_item( 5, _('Include (birth, marriage, death) ' 'years, and places')) self.event_choice.add_item( 6, _('Include (birth, marriage, death) ' 'places, but no dates')) self.event_choice.add_item( 7, _('Include (birth, marriage, death) ' 'dates and places on same line')) self.event_choice.set_help(_("Whether to include dates and/or places")) add_option("event_choice", self.event_choice) show_family_leaves = BooleanOption(_("Show all family nodes"), True) show_family_leaves.set_help( _("Show family nodes even if the output " "contains only one member of the family.")) add_option("show_family_leaves", show_family_leaves) url = BooleanOption(_("Include URLs"), False) url.set_help( _("Include a URL in each graph node so " "that PDF and imagemap files can be " "generated that contain active links " "to the files generated by the 'Narrated " "Web Site' report.")) add_option("url", url) self.__show_relships = BooleanOption( _("Include relationship to center person"), False) self.__show_relships.set_help( _("Whether to show every person's " "relationship to the center person")) add_option("increlname", self.__show_relships) self.__show_relships.connect('value-changed', self.__show_relships_changed) self.__include_images = BooleanOption( _('Include thumbnail images of people'), False) self.__include_images.set_help( _("Whether to include thumbnails of people.")) add_option("includeImages", self.__include_images) self.__include_images.connect('value-changed', self.__image_changed) self.__image_on_side = EnumeratedListOption(_("Thumbnail Location"), 0) self.__image_on_side.add_item(0, _('Above the name')) self.__image_on_side.add_item(1, _('Beside the name')) self.__image_on_side.set_help( _("Where the thumbnail image should appear relative to the name")) add_option("imageOnTheSide", self.__image_on_side) #occupation = BooleanOption(_("Include occupation"), False) occupation = EnumeratedListOption(_('Include occupation'), 0) occupation.add_item(0, _('Do not include any occupation')) occupation.add_item( 1, _('Include description ' 'of most recent occupation')) occupation.add_item( 2, _('Include date, description and place ' 'of all occupations')) occupation.set_help(_("Whether to include the last occupation")) add_option("occupation", occupation) if __debug__: self.__show_ga_gb = BooleanOption( _("Include relationship " "debugging numbers also"), False) self.__show_ga_gb.set_help( _("Whether to include 'Ga' and 'Gb' " "also, to debug the relationship " "calculator")) add_option("advrelinfo", self.__show_ga_gb) ################################ add_option = partial(menu.add_option, _("Graph Style")) ################################ color_males = ColorOption(_('Males'), '#e0e0ff') color_males.set_help(_('The color to use to display men.')) add_option('colormales', color_males) color_females = ColorOption(_('Females'), '#ffe0e0') color_females.set_help(_('The color to use to display women.')) add_option('colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown.set_help( _('The color to use when the gender is unknown.')) add_option('colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') color_family.set_help(_('The color to use to display families.')) add_option('colorfamilies', color_family) dashed = BooleanOption( _("Indicate non-birth relationships with dotted lines"), True) dashed.set_help( _("Non-birth relationships will show up " "as dotted lines in the graph.")) add_option("dashed", dashed) showfamily = BooleanOption(_("Show family nodes"), True) showfamily.set_help( _("Families will show up as ellipses, linked " "to parents and children.")) add_option("showfamily", showfamily) use_subgraphs = EnumeratedListOption(_('Parent grouping'), 0) use_subgraphs.add_item(0, _('Normal')) use_subgraphs.add_item(1, _('Parents together')) use_subgraphs.add_item(2, _('Parents offset')) use_subgraphs.set_help( _("In the 'Normal' setting parents will be located to keep most " "lines short.\n" "The 'Parents together' setting can help position " "spouses next to each other, but with non-trivial graphs will " "result in longer lines and larger graphs.\n" "The Parents offset setting will also try to put spouses near " "each other, however they will be offset from each other. This " "will tend to make graphs with many people in a generation more " "square.")) add_option("usesubgraphs", use_subgraphs)