Example #1
0
    def build_model(self, namespace):
        """
        Build a model for the combo box selector.
        """
        from gi.repository import Gtk
        from gi.repository import GObject
        from gramps.gen.filters import CustomFilters
        if namespace == "person":
            # Populate the Person Filter
            entire_db = GenericFilter()
            entire_db.set_name(_("Include all selected people"))
            the_filters = [entire_db]

            if self.person:
                the_filters += self.__define_person_filters()

            the_filters.extend(CustomFilters.get_filters('Person'))

            model = Gtk.ListStore(GObject.TYPE_STRING, object)
            for item in the_filters:
                model.append(row=[item.get_name(), item])
        elif namespace == "note":
            # Populate the Notes Filter
            entire_db = GenericFilter()
            entire_db.set_name(_("Include all selected notes"))
            notes_filters = [entire_db]
            notes_filters.extend(CustomFilters.get_filters('Note'))
            model = Gtk.ListStore(GObject.TYPE_STRING, object)
            for item in notes_filters:
                model.append(row=[item.get_name(), item])

        elif namespace == "living":
            model = Gtk.ListStore(GObject.TYPE_STRING, int)
            row = 0
            for item in [
                    _('Include all selected people'),
                    _('Replace given names of living people'),
                    _('Replace complete name of living people'),
                    _('Do not include living people'),
            ]:
                model.append(row=[item, row])
                row += 1

        elif namespace == "reference":
            model = Gtk.ListStore(GObject.TYPE_STRING, int)
            row = 0
            for item in [
                    _('Include all selected records'),
                    _('Do not include records not linked to a selected person'
                      ),
            ]:
                model.append(row=[item, row])
                row += 1

        return model
Example #2
0
    def build_model(self, namespace):
        """
        Build a model for the combo box selector.
        """
        from gi.repository import Gtk
        from gi.repository import GObject
        from gramps.gen.filters import CustomFilters
        if namespace == "person":
            # Populate the Person Filter
            entire_db = GenericFilter()
            entire_db.set_name(_("Include all selected people"))
            the_filters = [entire_db]

            if self.person:
                the_filters += self.__define_person_filters()

            the_filters.extend(CustomFilters.get_filters('Person'))

            model = Gtk.ListStore(GObject.TYPE_STRING, object)
            for item in the_filters:
                model.append(row=[item.get_name(), item])
        elif namespace == "note":
            # Populate the Notes Filter
            entire_db = GenericFilter()
            entire_db.set_name(_("Include all selected notes"))
            notes_filters = [entire_db]
            notes_filters.extend(CustomFilters.get_filters('Note'))
            model = Gtk.ListStore(GObject.TYPE_STRING, object)
            for item in notes_filters:
                model.append(row=[item.get_name(), item])

        elif namespace == "living":
            model = Gtk.ListStore(GObject.TYPE_STRING, int)
            row = 0
            for item in [_('Include all selected people'),
                         _('Replace given names of living people'),
                         _('Replace complete name of living people'),
                         _('Do not include living people'),
                        ]:
                model.append(row=[item, row])
                row += 1

        elif namespace == "reference":
            model = Gtk.ListStore(GObject.TYPE_STRING, int)
            row = 0
            for item in [
                _('Include all selected records'),
                _('Do not include records not linked to a selected person'),]:
                model.append(row=[item, row])
                row += 1

        return model
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
    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)
Example #6
0
    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 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)
Example #8
0
    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)
Example #9
0
    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):
        """
        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)
Example #11
0
    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_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):
        """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)
Example #13
0
    def get_person_filters(menu):
        """Get menu option filter list of custon and generic filters."""
        custom = CustomFilters.get_filters("Person")
        menu.filter_list = [(0, _("Ancestors of <selected person>")),
                            (1, _("Descendants of <selected person>"))]

        for item in enumerate([x.get_name() for x in custom], start=2):
            menu.filter_list.append(item)
    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
        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)
        
        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)

        sort_by_citation = BooleanOption(_("Sort by Citation"), True)
        sort_by_citation.set_help(_("Whether to sort lines by Citation or Date"))
        menu.add_option(category_name, "sort_by_citation", sort_by_citation)
        
        sort_by_date = BooleanOption(_("Sort by Date"), True)
        sort_by_date.set_help(_("Whether to sort lines by Date or citation"))
        menu.add_option(category_name, "sort_by_date", sort_by_date)
        
        
        placeformat = EnumeratedListOption(_("Place Format"), "Default")
        placeformat.set_items([
                ("default",   _("Default")),
                ("first",   _("First")),
                ("firstplace",   _("Firstplace")),
                ("firstplace-country",   _("Firstplace-Country")),
                ("country",   _("Country")),
                ("long", _("Long"))])
        placeformat.set_help(_("If Placename is given long or short"))
        menu.add_option(category_name, "placeformat", placeformat)
Example #15
0
    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)
Example #16
0
    def set(self,local_filters,default=""):
        self.store = Gtk.ListStore(GObject.TYPE_STRING)
        self.set_model(self.store)
        cell = Gtk.CellRendererText()
        self.pack_start(cell,True)
        self.add_attribute(cell,'text',0)

        self.map = {}

        active = 0
        cnt = 0
        for filt in local_filters:
            self.store.append(row=[filt.get_name()])
            self.map[str(filt.get_name())] = filt
            if default != "" and default == filt.get_name():
                active = cnt
            cnt += 1

        #for filt in SystemFilters.get_filters():
            #self.store.append(row=[filt.get_name()])
            #self.map[unicode(filt.get_name())] = filt
            #if default != "" and default == filt.get_name():
                #active = cnt
            #cnt += 1

        for filt in CustomFilters.get_filters():
            self.store.append(row=[filt.get_name()])
            self.map[str(filt.get_name())] = filt
            if default != "" and default == filt.get_name():
                active = cnt
            cnt += 1

        if active:
            self.set_active(active)
        elif len(local_filters):
            self.set_active(2)
        #elif len(SystemFilters.get_filters()):
            #self.set_active(4 + len(local_filters))
        elif len(CustomFilters.get_filters()):
            self.set_active(4 + len(local_filters))
        else:
            self.set_active(0)
Example #17
0
    def set(self,local_filters,default=""):
        self.store = Gtk.ListStore(GObject.TYPE_STRING)
        self.set_model(self.store)
        cell = Gtk.CellRendererText()
        self.pack_start(cell,True)
        self.add_attribute(cell,'text',0)

        self.map = {}
        
        active = 0
        cnt = 0
        for filt in local_filters:
            self.store.append(row=[filt.get_name()])
            self.map[str(filt.get_name())] = filt
            if default != "" and default == filt.get_name():
                active = cnt
            cnt += 1
        
        #for filt in SystemFilters.get_filters():
            #self.store.append(row=[filt.get_name()])
            #self.map[unicode(filt.get_name())] = filt
            #if default != "" and default == filt.get_name():
                #active = cnt
            #cnt += 1

        for filt in CustomFilters.get_filters():
            self.store.append(row=[filt.get_name()])
            self.map[str(filt.get_name())] = filt
            if default != "" and default == filt.get_name():
                active = cnt
            cnt += 1

        if active:
            self.set_active(active)
        elif len(local_filters):
            self.set_active(2)
        #elif len(SystemFilters.get_filters()):
            #self.set_active(4 + len(local_filters))
        elif len(CustomFilters.get_filters()):
            self.set_active(4 + len(local_filters))
        else:
            self.set_active(0)
Example #18
0
    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)
Example #19
0
    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)
Example #20
0
    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)
Example #21
0
    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)
Example #22
0
    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)
Example #23
0
    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)
Example #24
0
 def get_filter(index, pers_id):
     """Create a filter."""
     fltr = GenericFilterFactory("Person")()
     custom = enumerate(CustomFilters.get_filters("Person"), start=2)
     if index == 0:
         fltr.add_rule(rules.person.IsAncestorOf([pers_id, True]))
     elif index == 1:
         fltr.add_rule(rules.person.IsDescendantOf([pers_id, True]))
     else:
         for num, item in list(custom):
             if num == index:
                 fltr = item
     return fltr
    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)
Example #26
0
    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)
Example #27
0
def build_filter_model(space, local=[]):
    from gramps.gen.filters import CustomFilters

    model = Gtk.ListStore(GObject.TYPE_STRING, object)

    if isinstance(space, STRTYPE):
        flist = local + CustomFilters.get_filters(space)
    elif isinstance(space, (list, tuple)):
        flist = space
    else:
        return None

    for filt in flist:
        model.append(row=[filt.get_name(), filt])
    return model
Example #28
0
def build_filter_model(space, local = []):
    from gramps.gen.filters import CustomFilters

    model = Gtk.ListStore(GObject.TYPE_STRING, object)

    if isinstance(space, str):
        flist = local + CustomFilters.get_filters(space)
    elif isinstance(space, (list, tuple)):
        flist = space
    else:
        return None

    for filt in flist:
        model.append(row=[filt.get_name(), filt])
    return model
    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)
Example #30
0
    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)

        placeformat = EnumeratedListOption(_("Place Format"), "Default")
        placeformat.set_items([
                ("default",   _("Default")),
                ("first",   _("First")),
                ("firstplace",   _("Firstplace")),
                ("firstplace-country",   _("Firstplace-Country")),
                ("country",   _("Country")),
                ("long", _("Long"))])
        placeformat.set_help(_("If Placename is given long or short"))
        menu.add_option(category_name, "placeformat", placeformat)

        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)
Example #31
0
    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)

        placeformat = EnumeratedListOption(_("Place Format"), "Default")
        placeformat.set_items([
                ("default",   _("Default")),
                ("first",   _("First")),
                ("firstplace",   _("Firstplace")),
                ("firstplace-country",   _("Firstplace-Country")),
                ("country",   _("Country")),
                ("long", _("Long"))])
        placeformat.set_help(_("If Placename is given long or short"))
        menu.add_option(category_name, "placeformat", placeformat)

        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 the options for this report """
        category_name = _("Report Options")

        title = StringOption(_('Report Title'), _('Title of the Report'))
        title.set_help(_("Title string for the report."))
        menu.add_option(category_name, "title", title)

        subtitle = StringOption(_('Subtitle'), _('Subtitle of the Report'))
        subtitle.set_help(_("Subtitle string for the report."))
        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
        from gramps.gen.filters import CustomFilters, GenericFilter

        self.__filter = FilterOption(_("Select using filter"), 0)
        self.__filter.set_help(_("Select sources using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Source'))
        self.__filter.set_filters(filter_list)
        menu.add_option(category_name, "filter", self.__filter)

        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)
        locale_opt = stdoptions.add_localization_option(menu, category_name)
        stdoptions.add_date_format_option(menu, category_name, locale_opt)
Example #33
0
    def __init__(self, local_filters=[], namespace="generic", default=""):
        Gtk.ListStore.__init__(self, str)
        self.list_map = []
        self.def_index = 0

        cnt = 0
        for filt in local_filters:
            name = filt.get_name()
            self.append(row=[name])
            self.list_map.append(filt)
            if default != "" and default == name:
                self.def_index = cnt
            cnt += 1

        for filt in CustomFilters.get_filters(namespace):
            name = _(filt.get_name())
            self.append(row=[name])
            self.list_map.append(filt)
            if default != "" and default == name:
                self.def_index = cnt
            cnt += 1
Example #34
0
    def __init__(self, local_filters=[], namespace="generic", default=""):
        Gtk.ListStore.__init__(self, str)
        self.list_map = []
        self.def_index = 0

        cnt = 0
        for filt in local_filters:
            name = filt.get_name()
            self.append(row=[name])
            self.list_map.append(filt)
            if default != "" and default == name:
                self.def_index = cnt
            cnt += 1

        for filt in CustomFilters.get_filters(namespace):
            name = _(filt.get_name())
            self.append(row=[name])
            self.list_map.append(filt)
            if default != "" and default == name:
                self.def_index = cnt
            cnt += 1
Example #35
0
    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 = EnumeratedListOption(_("Class wdith"), 10)

        classwidth.set_items([
                (10, _("10 Years")),
                (20, _("20 Years")),
                (40, _("40 Years")),
                (50, _("50 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 the options for this report """
        category_name = _("Report Options")

        title = StringOption(_('Report Title'), _('Title of the Report') )
        title.set_help(_("Title string for the report."))
        menu.add_option(category_name, "title", title)

        subtitle = StringOption(_('Subtitle'), _('Subtitle of the Report') )
        subtitle.set_help(_("Subtitle string for the report."))
        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
        from gramps.gen.filters import CustomFilters, GenericFilter

        self.__filter = FilterOption(_("Select using filter"), 0)
        self.__filter.set_help(_("Select sources using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Source'))
        self.__filter.set_filters(filter_list)
        menu.add_option(category_name, "filter", self.__filter)

        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)
        locale_opt = stdoptions.add_localization_option(menu, category_name)
        stdoptions.add_date_format_option(menu, category_name, locale_opt)
Example #37
0
    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)
        #
        #        showpersons = BooleanOption(_("Show persons"), True)
        #        showpersons.set_help(_("Whether to show events and persons mentioned in the note"))
        #        menu.add_option(category_name, "showpersons", showpersons)
        #
        #        incphotos = BooleanOption(_("Include Photos"), True)
        #        incphotos.set_help(_("Whether to show photos mentioned in the citation"))
        #        menu.add_option(category_name, "incphotos", incphotos)

        category_name = _("Calc 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('Source'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)

        showallfamilies = BooleanOption(
            _("Show surnames of all famiies in clans"), True)
        showallfamilies.set_help(
            _("Whether to show the names of all families as surname"))
        menu.add_option(category_name, "showallfamilies", showallfamilies)

        #        self.pl_format  = menu.get_option_by_name('placeformat').get_value()

        #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)
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """

        common_name = _('Report Options')
        repository_name = _('Repositories')
        source_name = _('Sources')

        # 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(_("Selection with a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Repository'))
        opt.set_filters(filter_list)
        menu.add_option(repository_name, "filter", opt)

        from functools import partial
        addopt = partial(menu.add_option, common_name)
        raddopt = partial(menu.add_option, repository_name)
        saddopt = partial(menu.add_option, source_name)

        incintern = BooleanOption(_("Include repository's urls"), False)
        incintern.set_help(_('Whether to include urls on repository.'))
        raddopt('incintern', incintern)

        incaddres = BooleanOption(_("Include repository's address"), False)
        incaddres.set_help(_('Whether to include addresses on repository.'))
        raddopt('incaddres', incaddres)

        incauthor = BooleanOption(_("Include source's author"), False)
        incauthor.set_help(_('Whether to include author.'))
        saddopt('incauthor', incauthor)

        incabbrev = BooleanOption(_("Include source's abbreviation"), False)
        incabbrev.set_help(_('Whether to include abbreviation.'))
        saddopt('incabbrev', incabbrev)

        incpublic = BooleanOption(_("Include source's publication information"), False)
        incpublic.set_help(_('Whether to include publication information.'))
        saddopt('incpublic', incpublic)

        incdatamp = BooleanOption(_("Include source's data"), False)
        incdatamp.set_help(_('Whether to include keys and values.'))
        saddopt('incdatamp', incdatamp)

        inclunote = BooleanOption(_('Include notes'), False)
        inclunote.set_help(_('Whether to include notes on repositories and sources.'))
        addopt('inclunote', inclunote)

        inclmedia = BooleanOption(_('Include media'), False)
        inclmedia.set_help(_('Whether to include media.'))
        addopt('inclmedia', inclmedia)

        inclcitat = BooleanOption(_('Include citations'), False)
        inclcitat.set_help(_('Whether to include citations on sources.'))
        saddopt('inclcitat', inclcitat)

        incprivat = BooleanOption(_('Include private records'), False)
        incprivat.set_help(_('Whether to include repositories and sources marked as private.'))
        addopt('incprivat', incprivat)

        incempty = BooleanOption(_('Display empty values'), False)
        incempty.set_help(_('Whether to include key records with empty values.'))
        addopt('incempty', incempty)

        stdoptions.add_localization_option(menu, common_name)
Example #39
0
    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)
#        
#        showpersons = BooleanOption(_("Show persons"), True)
#        showpersons.set_help(_("Whether to show events and persons mentioned in the note"))
#        menu.add_option(category_name, "showpersons", showpersons)
#
#        incphotos = BooleanOption(_("Include Photos"), True)
#        incphotos.set_help(_("Whether to show photos mentioned in the citation"))
#        menu.add_option(category_name, "incphotos", incphotos)
                

        category_name = _("Calc 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('Source'))
        opt.set_filters(filter_list)
        menu.add_option(category_name, "filter", opt)
        
#        opt = FilterOption(_("Select Person filter"), 0)
#        opt.set_help(_("Select places using a person filter"))
#        filter_list = []
#        filter_list.append(GenericFilter())
#        filter_list.extend(CustomFilters.get_filters('Person'))

#        opt.set_filters(filter_list)
#        menu.add_option(category_name, "filter", opt)


        showallfamilies = BooleanOption(_("Show surnames of all famiies in clans"), True)
        showallfamilies.set_help(_("Whether to show the names of all families as surname"))
        menu.add_option(category_name, "showallfamilies", showallfamilies)

        placeformat = EnumeratedListOption(_("Place Format"), "Default")
        placeformat.set_items([
                ("default",   _("Default")),
                ("first",   _("First")),
                ("firstplace",   _("Firstplace")),
                ("firstplace-country",   _("Firstplace-Country")),
                ("country",   _("Country")),
                ("long", _("Long"))])
        placeformat.set_help(_("If Placename is given long or short"))
        menu.add_option(category_name, "placeformat", placeformat)
Example #40
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the place report.
        """

        common_name = _('Report Options')
        repository_name = _('Repositories')
        source_name = _('Sources')

        # 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(_("Selection with a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        filter_list.extend(CustomFilters.get_filters('Repository'))
        opt.set_filters(filter_list)
        menu.add_option(repository_name, "filter", opt)

        from functools import partial
        addopt = partial(menu.add_option, common_name)
        raddopt = partial(menu.add_option, repository_name)
        saddopt = partial(menu.add_option, source_name)

        incintern = BooleanOption(_("Include repository's urls"), False)
        incintern.set_help(_('Whether to include urls on repository.'))
        raddopt('incintern', incintern)

        incaddres = BooleanOption(_("Include repository's address"), False)
        incaddres.set_help(_('Whether to include addresses on repository.'))
        raddopt('incaddres', incaddres)

        incauthor = BooleanOption(_("Include source's author"), False)
        incauthor.set_help(_('Whether to include author.'))
        saddopt('incauthor', incauthor)

        incabbrev = BooleanOption(_("Include source's abbreviation"), False)
        incabbrev.set_help(_('Whether to include abbreviation.'))
        saddopt('incabbrev', incabbrev)

        incpublic = BooleanOption(
            _("Include source's publication information"), False)
        incpublic.set_help(_('Whether to include publication information.'))
        saddopt('incpublic', incpublic)

        incdatamp = BooleanOption(_("Include source's data"), False)
        incdatamp.set_help(_('Whether to include keys and values.'))
        saddopt('incdatamp', incdatamp)

        inclunote = BooleanOption(_('Include notes'), False)
        inclunote.set_help(
            _('Whether to include notes on repositories and sources.'))
        addopt('inclunote', inclunote)

        inclmedia = BooleanOption(_('Include media'), False)
        inclmedia.set_help(_('Whether to include media.'))
        addopt('inclmedia', inclmedia)

        inclcitat = BooleanOption(_('Include citations'), False)
        inclcitat.set_help(_('Whether to include citations on sources.'))
        saddopt('inclcitat', inclcitat)

        incprivat = BooleanOption(_('Include private records'), False)
        incprivat.set_help(
            _('Whether to include repositories and sources marked as private.')
        )
        addopt('incprivat', incprivat)

        incempty = BooleanOption(_('Display empty values'), False)
        incempty.set_help(
            _('Whether to include key records with empty values.'))
        addopt('incempty', incempty)

        stdoptions.add_localization_option(menu, common_name)