Ejemplo n.º 1
0
 def clone_filter(self, obj):
     store, node = self.clist.get_selected()
     if node:
         old_filter = self.clist.get_object(node)
         the_filter = GenericFilterFactory(self.namespace)(old_filter)
         the_filter.set_name('')
         EditFilter(self.namespace, self.dbstate, self.uistate, self.track,
                    the_filter, self.filterdb, self.draw_filters)
Ejemplo n.º 2
0
 def clone_filter(self, obj):
     store, node = self.clist.get_selected()
     if node:
         old_filter = self.clist.get_object(node)
         the_filter = GenericFilterFactory(self.namespace)(old_filter)
         the_filter.set_name('')
         EditFilter(self.namespace, self.dbstate, self.uistate, self.track,
                    the_filter, self.filterdb, self.draw_filters)
Ejemplo n.º 3
0
 def edit_filter(self, namespace, filter_obj):
     """
     Callback which invokes the EditFilter dialog. Will create new
     filter if called if none is selected.
     """
     from ...editors import EditFilter
     from gramps.gen.filters import FilterList, GenericFilterFactory
     from gramps.gen.const import CUSTOM_FILTERS
     the_filter = None
     filterdb = FilterList(CUSTOM_FILTERS)
     filterdb.load()
     if filter_obj.get_active() != 0:
         model = filter_obj.get_model()
         node = filter_obj.get_active_iter()
         if node:
             sel_filter = model.get_value(node, 1)
             # the_filter needs to be a particular object for editor
             for filt in filterdb.get_filters(namespace):
                 if filt.get_name() == sel_filter.get_name():
                     the_filter = filt
     else:
         the_filter = GenericFilterFactory(namespace)()
     if the_filter:
         EditFilter(namespace, self.dbstate, self.uistate, [], the_filter,
                    filterdb,
                    lambda: self.edit_filter_save(filterdb, namespace))
     else:  # can't edit this filter
         from ...dialog import ErrorDialog
         ErrorDialog(_("Cannot edit a system filter"),
                     _("Please select a different filter to edit"))
Ejemplo n.º 4
0
def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
    """
    Makes a Gramps Filter through dialog from a enumeration (list,
    set, etc.) of gramps_ids of type objclass.

    >>> make_filter(dbstate, uistate, 'Person', ['I0003', ...])
    """
    FilterClass = GenericFilterFactory(objclass)
    rule = getattr(getattr(rules, objclass.lower()),'RegExpIdOf')
    filter = FilterClass()
    if title is None:
        title = _("Filter %s from Clipboard") % objclass
    if isinstance(title, abc.Callable):
        title = title()
    filter.set_name(title)
    struct_time = time.localtime()
    filter.set_comment( _("Created on %(year)4d/%(month)02d/%(day)02d") % {
        'year': struct_time.tm_year,
        'month': struct_time.tm_mon,
        'day': struct_time.tm_mday})
    re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)])
    re_rule = rule([re])
    re_rule.use_regex = True
    filter.add_rule(re_rule)
    filterdb = FilterList(CUSTOM_FILTERS)
    filterdb.load()
    EditFilter(objclass, dbstate, uistate, [],
               filter, filterdb,
               lambda : edit_filter_save(uistate, filterdb, objclass))
Ejemplo n.º 5
0
 def edit_filter(self, obj):
     """
     Callback which invokes the EditFilter dialog. Will create new
     filter if called if none is selected.
     """
     from ...editors import EditFilter
     from gramps.gen.filters import FilterList, GenericFilterFactory
     from gramps.gen.const import CUSTOM_FILTERS
     the_filter = None
     filterdb = FilterList(CUSTOM_FILTERS)
     filterdb.load()
     if self.generic.get_active() != 0:
         model = self.generic.get_model()
         node = self.generic.get_active_iter()
         if node:
             sel_filter = model.get_value(node, 1)
             # the_filter needs to be a particular object for editor
             for filt in filterdb.get_filters(self.namespace):
                 if filt.get_name() == sel_filter.get_name():
                     the_filter = filt
     else:
         the_filter = GenericFilterFactory(self.namespace)()
     if the_filter:
         EditFilter(self.namespace,
                    self.dbstate,
                    self.uistate, [],
                    the_filter,
                    filterdb,
                    selection_callback=self.edit_filter_save)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
    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)
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
def run_given(database, document, person):
    """
    Loops through the families that the person is a child in, and displays
    the information about the other children.
    """
    # setup the simple access functions
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    if isinstance(person, Person):
        rgivenname = person.get_primary_name().get_first_name()
    else:
        rgivenname = person
    if " " in rgivenname.strip():
        rgivenname, second = rgivenname.strip().split(" ", 1)
    # display the title
    sdoc.title(_("People with the given name '%s'") % rgivenname)
    sdoc.paragraph("")
    stab.columns(_("Person"), _("Birth Date"), _("Name type"))
    filter = GenericFilterFactory('Person')()
    if rgivenname != '':
        rule = SameGiven([rgivenname])
    else:
        rule = IncompleteGiven([])
    filter.add_rule(rule)
    people = filter.apply(database, database.iter_person_handles())

    matches = 0
    for person_handle in people:
        person = database.get_person_from_handle(person_handle)
        stab.row(person, sdb.birth_or_fallback(person),
                 str(person.get_primary_name().get_type()))
        matches += 1

    document.has_data = matches > 0
    sdoc.paragraph(
        # Translators: leave all/any {...} untranslated
        ngettext(
            "There is {number_of} person "
            "with a matching name, or alternate name.\n",
            "There are {number_of} people "
            "with a matching name, or alternate name.\n",
            matches).format(number_of=matches))
    stab.write(sdoc)
Ejemplo n.º 10
0
def run(database, document, person):
    """
    Loops through the families that the person is a child in, and displays
    the information about the other children.
    """
    # setup the simple access functions
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    if isinstance(person, Person):
        surname = sdb.surname(person)
        rsurname = person.get_primary_name().get_group_name()
    else:
        surname = person
        rsurname = person
    # display the title
    sdoc.title(_("People sharing the surname '%s'") % surname)
    sdoc.paragraph("")
    stab.columns(_("Person"), _("Birth Date"), _("Name type"))
    filter = GenericFilterFactory('Person')()
    if rsurname != '':
        rule = SameSurname([rsurname])
    else:
        rule = IncompleteSurname([])
    filter.add_rule(rule)
    people = filter.apply(database,
                          database.iter_person_handles())

    matches = 0
    for person_handle in people:
        person = database.get_person_from_handle(person_handle)
        stab.row(person, sdb.birth_or_fallback(person),
                 str(person.get_primary_name().get_type()))
        matches += 1

    document.has_data = matches > 0
    sdoc.paragraph(
        # translators: leave all/any {...} untranslated
        ngettext("There is {number_of} person "
                     "with a matching name, or alternate name.\n",
                 "There are {number_of} people "
                     "with a matching name, or alternate name.\n", matches
                ).format(number_of=matches) )
    stab.write(sdoc)
Ejemplo n.º 11
0
 def get_note_list(self):
     """
     Get a list of all To Do notes.
     """
     all_notes = self.dbstate.db.get_note_handles()
     FilterClass = GenericFilterFactory('Note')
     filter = FilterClass()
     filter.add_rule(rules.note.HasType(["To Do"]))
     note_list = filter.apply(self.dbstate.db, all_notes)
     return note_list
Ejemplo n.º 12
0
 def __apply_filter(self, people, filter_rule):
     """
     Apply a filter rule on a list of people. Return the filtered list of
     people handles.
     """
     FilterClass = GenericFilterFactory('Person')
     filter_obj = FilterClass()
     filter_obj.add_rule(filter_rule)
     filtered_people = filter_obj.apply(self.dbstate.db, people)
     return filtered_people
Ejemplo n.º 13
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)
    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)
Ejemplo n.º 15
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
Ejemplo n.º 16
0
    def collect_unused(self):
        # Run through all requested tables and check all objects
        # for being referenced some place. If not, add_results on them.

        db = self.db
        tables = (
            ('events', db.get_event_cursor, db.get_number_of_events),
            ('sources', db.get_source_cursor, db.get_number_of_sources),
            ('citations', db.get_citation_cursor, db.get_number_of_citations),
            ('places', db.get_place_cursor, db.get_number_of_places),
            ('media', db.get_media_cursor, db.get_number_of_media),
            ('repos', db.get_repository_cursor, db.get_number_of_repositories),
            ('notes', db.get_note_cursor, db.get_number_of_notes),
        )

        # bug 7619 : don't select notes from to do list.
        # notes associated to the todo list doesn't have references.
        # get the todo list (from get_note_list method of the todo gramplet )
        all_notes = self.dbstate.db.get_note_handles()
        FilterClass = GenericFilterFactory('Note')
        filter1 = FilterClass()
        filter1.add_rule(rules.note.HasType(["To Do"]))
        todo_list = filter1.apply(self.dbstate.db, all_notes)
        filter2 = FilterClass()
        filter2.add_rule(rules.note.HasType(["Link"]))
        link_list = filter2.apply(self.dbstate.db, all_notes)

        for (the_type, cursor_func, total_func) in tables:
            if not self.options.handler.options_dict[the_type]:
                # This table was not requested. Skip it.
                continue

            with cursor_func() as cursor:
                self.set_total(total_func())
                fbh = db.find_backlink_handles
                for handle, data in cursor:
                    if not any(h for h in fbh(handle)):
                        if handle not in todo_list and handle not in link_list:
                            self.add_results(
                                (the_type, handle.decode('utf-8'), data))
                    self.update()
            self.reset()
Ejemplo n.º 17
0
    def write_report(self):
        """
        Generate the report document
        """
        self.doc.start_paragraph("TR-Title")
        title = _("Report on Notes Tagged %s") % self.tag
        mark = docgen.IndexMark(title, docgen.INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        # get all the notes in the database tagged Todo
        nlist = self.database.get_note_handles()
        FilterClass = GenericFilterFactory('Note')
        my_filter = FilterClass()
        my_filter.add_rule(rules.note.HasTag([self.tag]))
        note_list = my_filter.apply(self.database, nlist)

        if self.can_group:
            self._write_grouped_notes(note_list)
        else:
            self._write_sorted_notes(note_list)
Ejemplo n.º 18
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, rules,
                                        GenericFilterFactory)

        opt = FilterOption(_("Select using filter"), 0)
        opt.set_help(_("Select places using a filter"))
        filter_list = []
        filter_list.append(GenericFilter())
        placefilt = GenericFilterFactory('Place')
        allfilt = placefilt(None)
        allfilt.name = _("Entire Database")
        allfilt.add_rule(rules.place.AllPlaces([]))
        filter_list.append(allfilt)
        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)
Ejemplo n.º 19
0
 def add_new_filter(self, obj):
     the_filter = GenericFilterFactory(self.namespace)()
     EditFilter(self.namespace, self.dbstate, self.uistate, self.track,
                the_filter, self.filterdb, self.draw_filters)
Ejemplo n.º 20
0
    def write_citations(self):
        """ write the citations associated with the tag """
        clist = self.database.get_citation_handles(sort_handles=True,
                                                   locale=self._locale)
        filter_class = GenericFilterFactory('Citation')
        a_filter = filter_class()
        a_filter.add_rule(rules.citation.HasTag([self.tag]))
        citation_list = a_filter.apply(self.database, clist)

        if not citation_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Citations")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('CitationTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Volume/Page"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Date"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Source"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for citation_handle in citation_list:
            citation = self.database.get_citation_from_handle(citation_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(citation.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(citation.get_page())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            date = self._get_date(citation.get_date_object())
            if date:
                self.doc.write_text(date)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            source_handle = citation.get_reference_handle()
            source = self.database.get_source_from_handle(source_handle)
            self.doc.write_text(source.get_title())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 21
0
    def write_sources(self):
        """ write the sources associated with the tag """
        slist = self.database.get_source_handles(sort_handles=True,
                                                 locale=self._locale)
        filter_class = GenericFilterFactory('Source')
        a_filter = filter_class()
        a_filter.add_rule(rules.source.HasTag([self.tag]))
        source_list = a_filter.apply(self.database, slist)

        if not source_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Source")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('SourceTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Title"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Author"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Publication Information"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for source_handle in source_list:
            source = self.database.get_source_from_handle(source_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_title())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_author())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_publication_info())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 22
0
    def write_repositories(self):
        """ write the repositories associated with the tag """
        rlist = self.database.get_repository_handles()
        filter_class = GenericFilterFactory('Repository')
        a_filter = filter_class()
        a_filter.add_rule(rules.repository.HasTag([self.tag]))
        repo_list = a_filter.apply(self.database, rlist)

        if not repo_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Repositories")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('ReopTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Name"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Email Address"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for repo_handle in repo_list:
            repo = self.database.get_repository_from_handle(repo_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(repo.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(repo.get_name())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(str(repo.get_type()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            home_page = ''
            for url in repo.get_url_list():
                if url.get_type() == UrlType.EMAIL:
                    home_page = url.get_path()
                    break
            self.doc.write_text(home_page)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 23
0
    def write_media(self):
        """ write the media associated with the tag """
        mlist = self.database.get_media_handles(sort_handles=True,
                                                locale=self._locale)
        filter_class = GenericFilterFactory('Media')
        a_filter = filter_class()
        a_filter.add_rule(rules.media.HasTag([self.tag]))
        media_list = a_filter.apply(self.database, mlist)

        if not media_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Media")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('MediaTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Title"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Date"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for media_handle in media_list:
            media = self.database.get_media_from_handle(media_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(media.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            title = media.get_description()
            self.doc.write_text(str(title))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            mime_type = media.get_mime_type()
            self.doc.write_text(str(mime_type))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            date = self._get_date(media.get_date_object())
            if date:
                self.doc.write_text(date)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 24
0
from gi.repository import Gtk

#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from ... import widgets
from gramps.gen.lib import Note, NoteType
from .. import build_filter_model
from . import SidebarFilter
from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.note import (RegExpIdOf, HasNote, MatchesFilter,
                                           HasTag)

GenericNoteFilter = GenericFilterFactory('Note')


#-------------------------------------------------------------------------
#
# NoteSidebarFilter class
#
#-------------------------------------------------------------------------
class NoteSidebarFilter(SidebarFilter):
    def __init__(self, dbstate, uistate, clicked):
        self.clicked_func = clicked
        self.filter_id = widgets.BasicEntry()
        self.filter_text = widgets.BasicEntry()
        self.note = Note()
        self.note.set_type((NoteType.CUSTOM, ''))
        self.ntype = Gtk.ComboBox(has_entry=True)
Ejemplo n.º 25
0
    def write_places(self):
        """ write the places associated with the tag """
        plist = self.database.get_place_handles()
        filter_class = GenericFilterFactory('Place')
        a_filter = filter_class()
        a_filter.add_rule(rules.place.HasTag([self.tag]))
        place_list = a_filter.apply(self.database, plist)

        if not place_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Places")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('PlaceTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Title"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Name"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for place_handle in place_list:
            place = self.database.get_place_from_handle(place_handle)
            place_title = _pd.display(self.database, place)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(place.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(place_title)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(place.get_name().get_value())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(str(place.get_type()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 26
0
    def write_events(self):
        """ write the events associated with the tag """
        elist = self.database.get_event_handles()
        filter_class = GenericFilterFactory('Event')
        a_filter = filter_class()
        a_filter.add_rule(rules.event.HasTag([self.tag]))
        event_list = a_filter.apply(self.database, elist)

        if not event_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Events")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('EventTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Participants"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Date"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for event_handle in event_list:
            event = self.database.get_event_from_handle(event_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(event.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(self._(self._get_type(event.get_type())))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(get_participant_from_event(self.database,
                                                           event_handle))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            date = self._get_date(event.get_date_object())
            if date:
                self.doc.write_text(date)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 27
0
    def write_families(self):
        """ write the families associated with the tag """
        flist = self.database.iter_family_handles()
        filter_class = GenericFilterFactory('Family')
        a_filter = filter_class()
        a_filter.add_rule(rules.family.HasTag([self.tag]))
        fam_list = a_filter.apply(self.database, flist)

        if not fam_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Families")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('FamilyTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Father"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Mother"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Relationship"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for family_handle in fam_list:
            family = self.database.get_family_from_handle(family_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(family.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            father_handle = family.get_father_handle()
            if father_handle:
                father = self.database.get_person_from_handle(father_handle)
                mark = utils.get_person_mark(self.database, father)
                self.doc.write_text(self._name_display.display(father), mark)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            mother_handle = family.get_mother_handle()
            if mother_handle:
                mother = self.database.get_person_from_handle(mother_handle)
                mark = utils.get_person_mark(self.database, mother)
                self.doc.write_text(self._name_display.display(mother), mark)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            relation = family.get_relationship()
            self.doc.write_text(str(relation))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 28
0
    def write_people(self):
        """ write the people associated with the tag """
        plist = self.database.iter_person_handles()
        filter_class = GenericFilterFactory('Person')
        a_filter = filter_class()
        a_filter.add_rule(rules.person.HasTag([self.tag]))
        ind_list = a_filter.apply(self.database, plist)

        if not ind_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("People")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('PeopleTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Name"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Birth"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Death"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for person_handle in ind_list:
            person = self.database.get_person_from_handle(person_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(person.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            name = self._name_display.display(person)
            mark = utils.get_person_mark(self.database, person)
            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(name, mark)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            birth_ref = person.get_birth_ref()
            if birth_ref:
                event = self.database.get_event_from_handle(birth_ref.ref)
                self.doc.write_text(self._get_date(event.get_date_object()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            death_ref = person.get_death_ref()
            if death_ref:
                event = self.database.get_event_from_handle(death_ref.ref)
                self.doc.write_text(self._get_date(event.get_date_object()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 29
0
#-------------------------------------------------------------------------
from gi.repository import Gtk

#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from ... import widgets
from .. import build_filter_model
from . import SidebarFilter
from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.source import (RegExpIdOf, HasSource, HasTag,
                                             HasNoteRegexp, MatchesFilter)

GenericSourceFilter = GenericFilterFactory('Source')
#-------------------------------------------------------------------------
#
# SourceSidebarFilter class
#
#-------------------------------------------------------------------------
class SourceSidebarFilter(SidebarFilter):

    def __init__(self, dbstate, uistate, clicked):
        self.clicked_func = clicked
        self.filter_id = widgets.BasicEntry()
        self.filter_title = widgets.BasicEntry()
        self.filter_author = widgets.BasicEntry()
        self.filter_abbr = widgets.BasicEntry()
        self.filter_pub = widgets.BasicEntry()
        self.filter_note = widgets.BasicEntry()
Ejemplo n.º 30
0
    def write_notes(self):
        """ write the notes associated with the tag """
        nlist = self.database.get_note_handles()
        filter_class = GenericFilterFactory('Note')
        a_filter = filter_class()
        a_filter.add_rule(rules.note.HasTag([self.tag]))
        note_list = a_filter.apply(self.database, nlist)

        if not note_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Notes")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('NoteTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell', 2)
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Text"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for note_handle in note_list:
            note = self.database.get_note_from_handle(note_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(note.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            note_type = note.get_type()
            self.doc.write_text(str(note_type))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell', 2)
            self.doc.write_styled_note(
                note.get_styledtext(), note.get_format(), 'TR-Note',
                contains_html=((note.get_type() == NoteType.HTML_CODE)))
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 31
0
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from ... import widgets
from gramps.gen.lib import Event, EventType, Family, FamilyRelType
from .. import build_filter_model
from . import SidebarFilter
from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.family import (RegExpIdOf, RegExpFatherName,
                                             RegExpMotherName, RegExpChildName,
                                             HasEvent, HasRelType, HasTag,
                                             HasNoteRegexp, MatchesFilter)

GenericFamilyFilter = GenericFilterFactory('Family')


#-------------------------------------------------------------------------
#
# FamilySidebarFilter class
#
#-------------------------------------------------------------------------
class FamilySidebarFilter(SidebarFilter):
    def __init__(self, dbstate, uistate, clicked):
        self.clicked_func = clicked
        self.filter_id = widgets.BasicEntry()
        self.filter_father = widgets.BasicEntry()
        self.filter_mother = widgets.BasicEntry()
        self.filter_child = widgets.BasicEntry()
Ejemplo n.º 32
0
from gi.repository import Gtk

#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from ... import widgets
from gramps.gen.lib import Repository, RepositoryType
from .. import build_filter_model
from . import SidebarFilter
from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.repository import (RegExpIdOf, HasRepo, HasTag,
                                                 HasNoteRegexp, MatchesFilter)

GenericRepoFilter = GenericFilterFactory('Repository')


#-------------------------------------------------------------------------
#
# RepoSidebarFilter class
#
#-------------------------------------------------------------------------
class RepoSidebarFilter(SidebarFilter):
    def __init__(self, dbstate, uistate, clicked):
        self.clicked_func = clicked
        self.filter_id = widgets.BasicEntry()
        self.filter_title = widgets.BasicEntry()
        self.filter_address = widgets.BasicEntry()
        self.filter_url = widgets.BasicEntry()