def add_menu_options(self, menu): """Add the menu options for the tool.""" # Get generic 'all families' filter and all custom familiy filters menu.filter_list = CustomFilters.get_filters("Family") all_families = GenericFilterFactory("Family")() all_families.set_name(_("All Families")) all_families.add_rule(rules.family.AllFamilies([])) all_filter_in_list = False for fltr in menu.filter_list: if fltr.get_name() == all_families.get_name(): all_filter_in_list = True if not all_filter_in_list: menu.filter_list.insert(0, all_families) # family filter menu option fam = FilterOption(_("Family Filter"), 0) fam.set_help(_("Choose the set of families to process.\n" "Create custom filters if empty.")) fam.set_filters(menu.filter_list) menu.add_option(_("Options"), "families", fam) # add family relationship type menu option rel = FilterOption(_("Relationship Type"), 0) rel.set_help(_("Choose the new family relationship type.\n" "Custom relationship types aren't supported.")) rel.set_items([(0, _("Married")), (1, _("Unmarried")), (2, _("Civil Union")), (3, _("Unknown"))]) menu.add_option(_("Options"), "relationship", rel)
def __general_options(self, menu): """Menu Options for general option tab.""" # Add or remove tags menu option self.add_remove = FilterOption(_("Add/Remove"), 0) self.add_remove.set_help(_("Add or remove tags from objects.")) self.add_remove.set_items([(0, _("Add Tags")), (1, _("Remove Tags"))]) menu.add_option(_("General options"), "add_remove", self.add_remove) # category menu option lst = [ _("People"), _("Families"), _("Events"), _("Places"), _("Sources"), _("Citations"), _("Repositories"), _("Media"), _("Notes") ] category_list = list(enumerate(lst)) self.tag_category = FilterOption(_("Category"), 0) self.tag_category.set_help(_("Choose a category.")) menu.add_option(_("General options"), "category", self.tag_category) self.tag_category.set_items(category_list) self.tag_category.connect('value-changed', self.__update_options) # tag name list menu option tag_list = self.__enum_tag_list() self.tag_name = FilterOption(_("Choose Tag"), 0) self.tag_name.set_help(_("Choose a tag to remove.")) menu.add_option(_("General options"), "tag_name", self.tag_name) self.tag_name.set_items(tag_list)
def __add_tag_category_options(self, menu): """ Menu Options for general category tab. Users select from which category they'd like to remove a tag. The chosen category also restricts the tag removal to this category e.g. remove tag 'ToDo' from filtered persons, but not from places, events, etc. """ lst = [ "People", "Families", "Events", "Places", "Sources", "Citations", "Repositories", "Media", "Notes" ] category_list = list(enumerate(lst)) self.__tag_category = FilterOption(_("Category"), 0) self.__tag_category.set_help(_("Choose a category.")) menu.add_option(_("Option 1"), "category", self.__tag_category) self.__tag_category.set_items(category_list) self.__tag_category.connect('value-changed', self.__update_options) tag_list = self.get_enum_tag_name_list() self.__tag_name = FilterOption("Remove Tag", 0) self.__tag_name.set_help(_("Choose a tag to remove.")) menu.add_option(_("Option 1"), "tag_name", self.__tag_name) self.__tag_name.set_items(tag_list)
def __add_tag_category_options(self, menu): """ Menu Options for general category. Users selects from which category they'd like to remove a tag. The chosen category also restricts the tag removal to this category e.g. remove tag 'ToDo' from filtered persons, but not from places, events, etc. """ item_list = [] self.category_names = ["People", "Families", "Events", "Places", "Sources", "Citations", "Repositories", "Media", "Notes"] for i in range(1, 10): txt = i, _(self.category_names[i-1]) item_list.append(txt) self.__tag_category = FilterOption(_("Category"), 1) text = _("Choose a category from where would you like to remove a tag") tag_category_text = text self.__tag_category.set_help(tag_category_text) menu.add_option(_("Configuration"), "tag_category", self.__tag_category) self.__tag_category.set_items(item_list) self.__tag_category.connect('value-changed', self.__update_options) item_list = self.__item_list self.__tag_name = FilterOption("Remove Tag", 0) self.__tag_name.set_help(_("Choose a tag to remove")) menu.add_option(_("Configuration"), "tag_name", self.__tag_name) self.__tag_name.set_items(item_list)
def add_menu_options(self, menu): """ Add all menu options to the tool window. """ # generate list for category menu option words = [ _("male"), _("female"), _("unknown"), _("Option"), _("single image mode") ] itm1 = "{} 1: {}".format(words[3], words[4]) itm2 = "{} 2: {}/{}/{}".format(words[3], words[0], words[1], words[2]) category_names = [(0, itm1), (1, itm2)] # add all menu options self.__category = FilterOption(_("Category"), 0) text = _("Choose how many images you'd like to use.") self.__category.set_help(text) menu.add_option(_("Options"), "category", self.__category) self.__category.set_items(category_names) self.__category.connect('value-changed', self.__update_options) self.__media1 = MediaOption(_("Unknown")) self.__media1.set_help(_("Image for people with unknown gender.")) menu.add_option(_("Options"), "media1", self.__media1) self.__media2 = MediaOption(_("Male")) self.__media2.set_help(_("Image for males.")) menu.add_option(_("Options"), "media2", self.__media2) self.__media3 = MediaOption(_("Female")) self.__media3.set_help(_("Image for females")) menu.add_option(_("Options"), "media3", self.__media3) self.__person_filter = FilterOption(_("Person Filter"), 0) self.__person_filter.set_help(_("Select filter to restrict people")) menu.add_option(_("Options"), "person_filter", self.__person_filter) self.__person_filter.connect('value-changed', self.__filter_changed) self.__pid = PersonOption(_("Center Person")) self.__pid.set_help(_("The center person for the filter")) menu.add_option(_("Options"), "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters) self.__remove = BooleanOption(_("Remove images from people"), False) txt = _("Remove selected image(s).") self.__remove.set_help(txt) menu.add_option(_("Options"), "remove", self.__remove)
def add_menu_options(self, menu): self.person = BooleanOption(_("Persons"), False) menu.add_option(_("Option"), "person", self.person) self.__person_filter = FilterOption(_("Person Filter"), 0) self.__person_filter.set_help(_("Select filter to restrict people")) menu.add_option(_("Option"), "person_filter", self.__person_filter) person_filter_all = GenericFilterFactory("Person")() person_filter_all.name = _("Entire Database") person_filter_list = [person_filter_all ] + CustomFilters.get_filters("Person") self.__person_filter.set_filters(person_filter_list) self.event = BooleanOption(_("Events"), False) menu.add_option(_("Option"), "event", self.event) self.__event_filter = FilterOption(_("Event Filter"), 0) self.__event_filter.set_help(_("Select filter to restrict events")) menu.add_option(_("Option"), "event_filter", self.__event_filter) event_filter_all = GenericFilterFactory("Event")() event_filter_all.name = _("Entire Database") event_filter_list = [event_filter_all ] + CustomFilters.get_filters('Event') self.__event_filter.set_filters(event_filter_list) self.media = BooleanOption(_("Media"), False) menu.add_option(_("Option"), "media", self.media) self.__media_filter = FilterOption(_("Media Filter"), 0) self.__media_filter.set_help(_("Select filter to restrict medias")) menu.add_option(_("Option"), "media_filter", self.__media_filter) media_filter_all = GenericFilterFactory("Media")() media_filter_all.name = _("Entire Database") media_filter_list = [media_filter_all ] + CustomFilters.get_filters('Media') self.__media_filter.set_filters(media_filter_list) self.no_date = BooleanOption(_("Always private if no date."), False) self.no_date.set_help( _("If checked, all objects without a date will " "also be set private.")) menu.add_option(_("Option"), "no_date", self.no_date) self.years = NumberOption(_("Years"), 0, 0, 2000) self.years.set_help( _("The time range in years from today you want to " "set objects private.\n" "'0 years' = remove privacy from all objects.")) menu.add_option(_("Option"), "years", self.years)
def add_menu_options(self, menu): """ Add options to the menu for the place report. """ category_name = _("Report Options") # Reload filters to pick any new ones CustomFilters = None from gramps.gen.filters import CustomFilters, GenericFilter opt = FilterOption(_("Select using filter"), 0) opt.set_help(_("Select places using a filter")) filter_list = [] filter_list.append(GenericFilter()) filter_list.extend(CustomFilters.get_filters('Place')) opt.set_filters(filter_list) menu.add_option(category_name, "filter", opt) stdoptions.add_name_format_option(menu, category_name) places = PlaceListOption(_("Select places individually")) places.set_help(_("List of places to report on")) menu.add_option(category_name, "places", places) classwidth = EnumeratedListOption(_("Class wdith"), "classwidth") classwidth.set_items([("20 Years", _("10 Years")), ("20 Years", _("20 Years"))]) classwidth.set_help(_("classwidth fpr Analysis")) menu.add_option(category_name, "classwidth", classwidth) incpriv = BooleanOption(_("Include private data"), True) incpriv.set_help(_("Whether to include private data")) menu.add_option(category_name, "incpriv", incpriv) stdoptions.add_localization_option(menu, category_name)
def add_menu_options(self, menu): """ Add options to the menu for the place report. """ category_name = _("Report Options") # Reload filters to pick any new ones CustomFilters = None from gramps.gen.filters import CustomFilters, GenericFilter opt = FilterOption(_("Select using filter"), 0) opt.set_help(_("Select places using a filter")) filter_list = [] filter_list.append(GenericFilter()) filter_list.extend(CustomFilters.get_filters('Place')) opt.set_filters(filter_list) menu.add_option(category_name, "filter", opt) stdoptions.add_name_format_option(menu, category_name) places = PlaceListOption(_("Select places individually")) places.set_help(_("List of places to report on")) menu.add_option(category_name, "places", places) stdoptions.add_place_format_option(menu, category_name) incpriv = BooleanOption(_("Include private data"), True) incpriv.set_help(_("Whether to include private data")) menu.add_option(category_name, "incpriv", incpriv) showgodparents = BooleanOption(_("show godparents"), True) showgodparents.set_help(_("Whether to include and show godparents")) menu.add_option(category_name, "showgodparents", showgodparents) stdoptions.add_localization_option(menu, category_name)
def add_menu_options(self, menu): """ Add options to the menu for the place report. """ category_name = _("Report Options") # Reload filters to pick any new ones CustomFilters = None from gramps.gen.filters import CustomFilters, GenericFilter opt = FilterOption(_("Select using filter"), 0) opt.set_help(_("Select places using a filter")) filter_list = [] filter_list.append(GenericFilter()) filter_list.extend(CustomFilters.get_filters('Place')) opt.set_filters(filter_list) menu.add_option(category_name, "filter", opt) places = PlaceListOption(_("Select places individually")) places.set_help(_("List of places to report on")) menu.add_option(category_name, "places", places) stdoptions.add_private_data_option(menu, category_name) stdoptions.add_living_people_option(menu, category_name) stdoptions.add_name_format_option(menu, category_name) center = EnumeratedListOption(_("Center on"), "Event") center.set_items([("Event", _("Event")), ("Person", _("Person"))]) center.set_help(_("If report is event or person centered")) menu.add_option(category_name, "center", center) stdoptions.add_localization_option(menu, category_name)
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): 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) top_size = NumberOption(_("Number of ranks to display"), 3, 1, 100) menu.add_option(category_name, "top_size", top_size) callname = EnumeratedListOption(_("Use call name"), CALLNAME_DONTUSE) callname.set_items([(CALLNAME_DONTUSE, _("Don't use call name")), (CALLNAME_REPLACE, _("Replace first names with call name")), (CALLNAME_UNDERLINE_ADD, _("Underline call name in first names / " "add call name to first name"))]) menu.add_option(category_name, "callname", callname) footer = StringOption(_("Footer text"), "") menu.add_option(category_name, "footer", footer) category_name = _("Report Options (2)") 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) p_count = 0 for (text, varname, default) in RECORDS: if varname.startswith('person'): p_count += 1 p_half = p_count // 2 p_idx = 0 for (text, varname, default) in RECORDS: option = BooleanOption(_(text), default) if varname.startswith('person'): if p_idx >= p_half: category_name = _("Person 2") else: category_name = _("Person 1") p_idx += 1 elif varname.startswith('family'): category_name = _("Family") menu.add_option(category_name, varname, option)
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) attribute_text = StringOption(_("Attribute"), "") attribute_value = StringOption(_("Value"), "") attribute_text.set_help(_("Attribute type to add or edit")) attribute_value.set_help(_("Attribute value to add or edit")) menu.add_option(category_name, "attribute_text", attribute_text) menu.add_option(category_name, "attribute_value", attribute_value) self.__attribute_text = attribute_text self.__attribute_value = attribute_value remove = BooleanOption(_("Remove"), False) remove.set_help(_("Remove attribute type and value set")) menu.add_option(category_name, "remove", remove) self.__update_filters()
def add_menu_options(self, menu): """ Add options to the menu for the place report. """ category_name = _("Report Options") # Reload filters to pick any new ones CustomFilters = None from gramps.gen.filters import CustomFilters, GenericFilter opt = FilterOption(_("Select using filter"), 0) opt.set_help(_("Select places using a filter")) filter_list = [] filter_list.append(GenericFilter()) filter_list.extend(CustomFilters.get_filters('Place')) opt.set_filters(filter_list) menu.add_option(category_name, "filter", opt) places = PlaceListOption(_("Select places individually")) places.set_help(_("List of places to report on")) menu.add_option(category_name, "places", places) reporttype = EnumeratedListOption(_("Type de Liste"), "ListeType") reporttype.set_items([("ListeEclair", _("Tiny Tafel")), ("cousingenweb", _("cousingenweb"))]) reporttype.set_help(_("Type de liste")) menu.add_option(category_name, "reporttype", reporttype) incpriv = BooleanOption(_("Include private data"), True) incpriv.set_help(_("Whether to include private data")) menu.add_option(category_name, "incpriv", incpriv)
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.__update_filters() stdoptions.add_name_format_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_private_data_option(menu, category_name) stdoptions.add_localization_option(menu, category_name)
def add_menu_options(self, menu): """ Add options to the menu for the place report. """ category_name = _("Report Options") # Reload filters to pick any new ones CustomFilters = None #p from Filters import CustomFilters, GenericFilter from gramps.gen.filters import CustomFilters, GenericFilter opt = FilterOption(_("Select using filter"), 0) opt.set_help(_("Select places using a filter")) filter_list = [] filter_list.append(GenericFilter()) filter_list.extend(CustomFilters.get_filters('Place')) opt.set_filters(filter_list) menu.add_option(category_name, "filter", opt) places = PlaceListOption(_("Select places individually")) places.set_help(_("List of places to report on")) menu.add_option(category_name, "places", places) center = EnumeratedListOption(_("Center on"), "Event") center.set_items([ ("Event", _("Event")), ("Person", _("Person"))]) center.set_help(_("If report is event or person centered")) menu.add_option(category_name, "center", center) incpriv = BooleanOption(_("Include private data"), True) incpriv.set_help(_("Whether to include private data")) menu.add_option(category_name, "incpriv", incpriv)
def add_menu_options(self, menu): """Menu options.""" menu.filter_list = CustomFilters.get_filters("Event") all_filter = GenericFilterFactory("Event")() all_filter.set_name(_("All Events")) all_filter.add_rule(rules.event.AllEvents([])) all_filter_in_list = False for fltr in menu.filter_list: if fltr.get_name() == all_filter.get_name(): all_filter_in_list = True if not all_filter_in_list: menu.filter_list.insert(0, all_filter) events = FilterOption(_("Events"), 0) menu.add_option(_("Option"), "events", events) events.set_filters(menu.filter_list) find = StringOption(_("Find"), "") menu.add_option(_("Option"), "find", find) replace = StringOption(_("Replace"), "") menu.add_option(_("Option"), "replace", replace) keep_old = BooleanOption(_("Replace substring only"), False) keep_old.set_help(_("If True only the substring will be replaced, " "otherwise the whole description will be deleted " "and replaced by the new one.")) menu.add_option(_("Option"), "keep_old", keep_old) regex = BooleanOption(_("Allow regex"), False) regex.set_help(_("Allow regular expressions.")) menu.add_option(_("Option"), "regex", regex)
def add_menu_options(self, menu): """ Add the menu options for the Remove Tag Tool """ 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) 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) self.__update_filters()
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 __filter_options(self, menu): """Menu Options for filter option tab.""" self.filter_dict = {} # get all filter rules, used for generic filters all_persons = rules.person.Everyone([]) all_families = rules.family.AllFamilies([]) all_events = rules.event.AllEvents([]) all_places = rules.place.AllPlaces([]) all_sources = rules.source.AllSources([]) all_cits = rules.citation.AllCitations([]) all_repos = rules.repository.AllRepos([]) all_media = rules.media.AllMedia([]) all_notes = rules.note.AllNotes([]) # create a list used for menu filter option creation later lst = [(_("Person Filter"), 'Person', _("Persons"), all_persons), (_("Family Filter"), 'Family', _("Families"), all_families), (_("Event Filter"), 'Event', _("Events"), all_events), (_("Place Filter"), 'Place', _("Places"), all_places), (_("Source Filter"), 'Source', _("Sources"), all_sources), (_("Citation Filter"), 'Citation', _("Citations"), all_cits), (_("Repository Filter"), 'Repository', _("Repositories"), all_repos), (_("Media Filter"), 'Media', _("Media"), all_media), (_("Note Filter"), 'Note', _("Notes"), all_notes)] for entry in lst: # create a filter option for each category e.g. person, events # filter option is a combination of custom filters and # a generic filter for all objects of one category filter_name = FilterOption(entry[0], 0) menu.add_option(_("Filter options"), entry[1].lower(), filter_name) self.filter_dict[entry[1]] = filter_name # custom filter: filter_list = CustomFilters.get_filters(entry[1]) # generic filter: GenericFilter = GenericFilterFactory(entry[1]) all_filter = GenericFilter() all_filter.set_name(_("All %s") % (entry[2])) all_filter.add_rule(entry[3]) # only add the generic filter if it isn't already in the menu all_filter_in_list = False for fltr in filter_list: if fltr.get_name() == all_filter.get_name(): all_filter_in_list = True if not all_filter_in_list: filter_list.insert(0, all_filter) # add the list of custom and generic filters # to the filter option self.filter_dict[entry[1]].set_filters(filter_list)
def __add_event_options(self, menu): """ Menu Options for event category. Menu Option 'event_filter' is used to choose a custom event filter. """ self.__event_filter = FilterOption(_("Event Filter"), 0) self.__event_filter.set_help(_("Select filter to restrict events")) menu.add_option(_("Configuration"), "event_filter", self.__event_filter) filter_list = CustomFilters.get_filters('Event') self.__event_filter.set_filters(filter_list)
def __add_source_options(self, menu): """ Menu Options for scoure category. Menu Option 'source_filter' is used to choose a custom source filter. """ self.__source_filter = FilterOption(_("Source Filter"), 0) self.__source_filter.set_help(_("Select filter to restrict sources")) menu.add_option(_("Configuration"), "source_filter", self.__source_filter) filter_list = CustomFilters.get_filters('Source') self.__source_filter.set_filters(filter_list)
def __add_note_options(self, menu): """ Menu Options for notes category. Menu Option 'note_filter' is used to choose a custom note filter. """ self.__note_filter = FilterOption(_("Note Filter"), 0) self.__note_filter.set_help(_("Select filter to restrict notes")) menu.add_option(_("Configuration"), "note_filter", self.__note_filter) filter_list = CustomFilters.get_filters('Note') self.__note_filter.set_filters(filter_list)
def __add_media_options(self, menu): """ Menu Options for media category. Menu Option 'media_filter' is used to choose a custom media filter. """ self.__media_filter = FilterOption(_("Media Filter"), 0) self.__media_filter.set_help(_("Select filter to restrict media")) menu.add_option(_("Configuration"), "media_filter", self.__media_filter) filter_list = CustomFilters.get_filters('Media') self.__media_filter.set_filters(filter_list)
def __add_citation_options(self, menu): """ Menu Options for citation category. Menu Option 'cit_filter' is used to choose a custom citation filter. """ self.__cit_filter = FilterOption(_("Citation Filter"), 0) self.__cit_filter.set_help(_("Select filter to restrict citations")) menu.add_option(_("Configuration"), "cit_filter", self.__cit_filter) filter_list = CustomFilters.get_filters('Citation') self.__cit_filter.set_filters(filter_list)
def __add_repository_options(self, menu): """ Menu Options for repository category. Menu Option 'repo_filter' is usedto choose a custom repository filter. """ self.__repo_filter = FilterOption(_("Repository Filter"), 0) text = _("Select filter to restrict repositories") self.__repo_filter.set_help(text) menu.add_option(_("Configuration"), "repo_filter", self.__repo_filter) filter_list = CustomFilters.get_filters('Repository') self.__repo_filter.set_filters(filter_list)
def add_menu_options(self, menu): """ Add the menu options for the Remove Tag Tool. """ if self.is_db_empty(): txt = [ _("The Remove Tag Tool requires at least " "one person, family and tag to execute.") ] self.empty = TextOption(_("ERROR"), txt) menu.add_option(_("ERROR"), "empty", self.empty) else: self.__add_tag_category_options(menu) self.__add_person_options(menu) self.__add_family_options(menu) self.filter_dict = {} lst = [("events", _("Event Filter"), "event_filter", 'Event', _("All Events")), ("places", _("Place Filter"), "place_filter", 'Place', _("All Places")), ("sources", _("Source Filter"), "scource_filter", 'Source', _("All Sources")), ("citations", _("Citation Filter"), "cit_filter", 'Citation', _("All Citations")), ("repositories", _("Repository Filter"), "repo_filter", 'Repository', _("All Repositories")), ("media", _("Media Filter"), "media_filter", 'Media', _("All Media")), ("notes", _("Note Filter"), "note_filter", 'Note', _("All Notes"))] for entry in lst: filter_name = FilterOption(entry[1], 0) filter_name.set_help( _("Select filter to restrict {}".format(entry[0]))) menu.add_option(_("Option 2"), entry[2], filter_name) self.filter_dict[entry[3]] = filter_name filter_list = CustomFilters.get_filters(entry[3]) GenericFilter = GenericFilterFactory(entry[3]) all_filter = GenericFilter() all_filter.set_name(entry[4]) all_filter.add_rule(rules.event.AllEvents([])) all_filter_in_list = False for fltr in filter_list: if fltr.get_name() == all_filter.get_name(): all_filter_in_list = True if not all_filter_in_list: filter_list.insert(0, all_filter) self.filter_dict[entry[3]].set_filters(filter_list)
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): """ Add the options for this report """ category_name = _("Report Options") title = StringOption(_('book|Title'), _('Title of the Book')) title.set_help(_("Title string for the book.")) menu.add_option(category_name, "title", title) subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book')) subtitle.set_help(_("Subtitle string for the book.")) menu.add_option(category_name, "subtitle", subtitle) dateinfo = time.localtime(time.time()) #rname = self.__db.get_researcher().get_name() rname = "researcher name" footer_string = _('Copyright %(year)d %(name)s') % { 'year': dateinfo[0], 'name': rname } footer = StringOption(_('Footer'), footer_string) footer.set_help(_("Footer string for the page.")) menu.add_option(category_name, "footer", footer) # Reload filters to pick any new ones CustomFilters = None #p from Filters import CustomFilters, GenericFilter from gramps.gen.filters import CustomFilters, GenericFilter opt = FilterOption(_("Select using filter"), 0) opt.set_help(_("Select places using a filter")) filter_list = [] filter_list.append(GenericFilter()) filter_list.extend(CustomFilters.get_filters('Source')) opt.set_filters(filter_list) menu.add_option(category_name, "filter", opt) showinlaw = BooleanOption(_("Show inlaw"), True) showinlaw.set_help(_("Whether to show inlaw persons")) menu.add_option(category_name, "showinlaw", showinlaw) showperson = BooleanOption(_("Show persons"), True) showperson.set_help( _("Whether to show events and persons mentioned in the note")) menu.add_option(category_name, "showperson", showperson) incphotos = BooleanOption(_("Include Photos"), True) incphotos.set_help( _("Whether to show photos mentioned in the citation")) menu.add_option(category_name, "incphotos", incphotos)
def __add_person_options(self, menu): """ Menu Options for person category. Menu Option 'filter' is used to choose a generic or custom person filter. Menu Option 'pid' selects the center person, which is needed for some person filters. """ self.__filter = FilterOption(_("Person Filter"), 0) self.__filter.set_help(_("Select filter to restrict people")) menu.add_option(_("Configuration"), "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 filter")) menu.add_option(_("Configuration"), "pid", self.__pid) self.__pid.connect('value-changed', self.__update_filters)
def __add_family_options(self, menu): """ Menu Options for family category. Menu Option 'family_filter' is used to choose a generic or custom family filter. Menu Option 'fid' selects the center family, which is needed for some filters. """ self.__family_filter = FilterOption(_("Family Filter"), 0) self.__family_filter.set_help(_("Select filter to restrict families")) menu.add_option(_("Configuration"), "family_filter", self.__family_filter) self.__family_filter.connect('value-changed', self.__family_filter_changed) self.__fid = FamilyOption(_("Center Family")) self.__fid.set_help(_("The center person for the filter")) menu.add_option(_("Configuration"), "fid", self.__fid) self.__fid.connect('value-changed', self.__update_family_filters)