예제 #1
0
파일: all_events.py 프로젝트: wmbr/gramps
def run_fam(database, document, family):
    """
    Loops through the family events and the events of all parents, displaying
    the basic details of the event
    """

    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)

    # get the family events
    event_list = [(_('Family'), x) for x in sdb.events(family)]

    # get the events of father and mother
    #fathername = sdb.first_name(sdb.father(family))
    event_list += [(sdb.father(family), x)
                   for x in sdb.events(sdb.father(family))]
    #mothername = sdb.first_name(sdb.mother(family))
    event_list += [(sdb.mother(family), x)
                   for x in sdb.events(sdb.mother(family))]

    # children events
    event_list_children = []
    for child in sdb.children(family):
        #name = sdb.first_name(child)
        event_list_children += [(child, x) for x in sdb.events(child)]

    # Sort the events by their date
    event_list.sort(key=lambda x: x[1].get_date_object())
    event_list_children.sort(key=lambda x: x[1].get_date_object())

    # display the results

    sdoc.title(
        _("Sorted events of family\n %(father)s - %(mother)s") % {
            'father': sdb.name(sdb.father(family)),
            'mother': sdb.name(sdb.mother(family))
        })
    sdoc.paragraph("")

    document.has_data = False
    stab.columns(_("Family Member"), _("Event Type"), _("Event Date"),
                 _("Event Place"))

    for (person, event) in event_list:
        stab.row(person, sdb.event_type(event), sdb.event_date_obj(event),
                 sdb.event_place(event))
        document.has_data = True
    stab.write(sdoc)

    stab = QuickTable(sdb)
    sdoc.header1(_("Personal events of the children"))
    stab.columns(_("Family Member"), _("Event Type"), _("Event Date"),
                 _("Event Place"))
    for (person, event) in event_list_children:
        stab.row(person, sdb.event_type(event), sdb.event_date_obj(event),
                 sdb.event_place(event))
        document.has_data = True
    stab.write(sdoc)
예제 #2
0
def run_fam(database, document, family):
    """
    Loops through the family events and the events of all parents, displaying
    the basic details of the event
    """

    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)

    # get the family events
    event_list = [(_('Family'), x) for x in sdb.events(family)]

    # get the events of father and mother
    #fathername = sdb.first_name(sdb.father(family))
    event_list += [(sdb.father(family), x) for x in sdb.events(sdb.father(family))]
    #mothername = sdb.first_name(sdb.mother(family))
    event_list += [(sdb.mother(family), x) for x in sdb.events(sdb.mother(family))]

    # children events
    event_list_children = []
    for child in sdb.children(family) :
        #name = sdb.first_name(child)
        event_list_children += [(child, x) for x in sdb.events(child)]

    # Sort the events by their date
    event_list.sort(key=lambda x: x[1].get_date_object())
    event_list_children.sort(key=lambda x: x[1].get_date_object())

    # display the results

    sdoc.title(_("Sorted events of family\n %(father)s - %(mother)s") % {
        'father' : sdb.name(sdb.father(family)), 'mother' : sdb.name(sdb.mother(family)) })
    sdoc.paragraph("")

    document.has_data = False
    stab.columns(_("Family Member"), _("Event Type"),
                 _("Event Date"), _("Event Place"))

    for (person, event) in event_list:
        stab.row(person, sdb.event_type(event),
                 sdb.event_date_obj(event),
                 sdb.event_place(event))
        document.has_data = True
    stab.write(sdoc)

    stab = QuickTable(sdb)
    sdoc.header1(_("Personal events of the children"))
    stab.columns(_("Family Member"), _("Event Type"),
                 _("Event Date"), _("Event Place"))
    for (person, event) in event_list_children:
        stab.row(person, sdb.event_type(event),
                 sdb.event_date_obj(event),
                 sdb.event_place(event))
        document.has_data = True
    stab.write(sdoc)
예제 #3
0
def run(database, document, person):
    """
    Output a text biography of active person
    """
    sa = SimpleAccess(database)
    sd = SimpleDoc(document)
    sd.title(_("Biography for %s") % sa.name(person))
    sd.paragraph('')

    narrator = Narrator(database,
                        verbose=True,
                        use_call_name=True,
                        use_fulldate=True)
    narrator.set_subject(person)

    # Birth Details
    text = narrator.get_born_string()
    if text:
        sd.paragraph(text)

    text = narrator.get_baptised_string()
    if text:
        sd.paragraph(text)

    text = narrator.get_christened_string()
    if text:
        sd.paragraph(text)

    text = get_parents_desc(database, person)
    if text:
        sd.paragraph(text)
    sd.paragraph('')

    # Family Details
    for family in sa.parent_in(person):
        text = narrator.get_married_string(family)
        if text:
            sd.paragraph(text)
    sd.paragraph('')

    # Death Details
    text = narrator.get_died_string(True)
    if text:
        sd.paragraph(text)

    text = narrator.get_buried_string()
    if text:
        sd.paragraph(text)
    sd.paragraph('')

    # Sources
    sd.header1(_('Sources'))
    for source in get_sources(database, person):
        sd.paragraph(source)
예제 #4
0
def run(database, document, person):
    """
    Output a text biography of active person
    """
    sa = SimpleAccess(database)
    sd = SimpleDoc(document)
    sd.title("Biography for %s" % sa.name(person))
    sd.paragraph('')

    narrator = Narrator(database, verbose=True,
                        use_call_name=True, use_fulldate=True)
    narrator.set_subject(person)


    # Birth Details
    text = narrator.get_born_string()
    if text:
        sd.paragraph(text)

    text = narrator.get_baptised_string()
    if text:
        sd.paragraph(text)

    text = narrator.get_christened_string()
    if text:
        sd.paragraph(text)

    text = get_parents_desc(database, person)
    if text:
        sd.paragraph(text)
    sd.paragraph('')

    # Family Details
    for family in sa.parent_in(person):
        text = narrator.get_married_string(family)
        if text:
            sd.paragraph(text)
    sd.paragraph('')

    # Death Details
    text = narrator.get_died_string(True)
    if text:
        sd.paragraph(text)

    text = narrator.get_buried_string()
    if text:
        sd.paragraph(text)
    sd.paragraph('')

    # Sources
    sd.header1('Sources')
    for source in get_sources(database, person):
        sd.paragraph(source)
예제 #5
0
def run(database, document, repo):
    """
    Display back-references (sources) for this repository.
    """

    # setup the simple access functions

    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)

    # First we find repository and add its text

    sdoc.title('%s\n' % repo.get_name())

    # Go over all the sources that refer to this repository

    repo_handle = repo.handle
    source_list = [item[1] for item in
                   database.find_backlink_handles(repo_handle, ['Source'
                   ])]

    stab.columns(_("Source"), _("Type of media"), _("Call number"))
    document.has_data = False
    for source_handle in source_list:
        src = database.get_source_from_handle(source_handle)

        # Get the list of references from this source to our repo
        # (can be more than one, technically)

        for reporef in src.get_reporef_list():
            if reporef.ref == repo_handle:

                # Determine the text for this source

                media = str(reporef.get_media_type())
                call = reporef.get_call_number()

                stab.row(src.get_title(), media, call)
                document.has_data = True
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found"))
예제 #6
0
파일: siblings.py 프로젝트: SNoiraud/gramps
def run(database, document, person):
    """
    Loops through the families that the person is a child in, and display
    the information about the other children.
    """
    # setup the simple access functions
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    rel_class = get_relationship_calculator(glocale)

    # display the title
    # feature request 2356: avoid genitive form
    sdoc.title(_("Siblings of %s") % sdb.name(person))
    sdoc.paragraph("")
    stab.columns(_("Sibling"), _("Gender"), _("Birth Date"), _("Type"))
    # grab our current id (self):
    gid = sdb.gid(person)
    # loop through each family in which the person is a child
    document.has_data = False
    for family in sdb.child_in(person):
        # loop through each child in the family
        for child in sdb.children(family):
            # only display if this child is not the active person
            if sdb.gid(child) != gid:
                rel_str = rel_class.get_sibling_relationship_string(
                    rel_class.get_sibling_type(database, person, child),
                    person.get_gender(), child.get_gender())
            else:
                rel_str = _('self')
            # pass row the child object to make link:
            stab.row(child,
                     sdb.gender(child),
                     sdb.birth_or_fallback(child),
                     rel_str)
            document.has_data = True
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found") + "\n")
예제 #7
0
def run(database, document, person):
    """
    Loops through the person events and the family events of any family
    in which the person is a parent (to catch Marriage events), displaying
    the basic details of the event
    """

    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)

    # get the personal events
    event_list = sdb.events(person)

    # get the events of each family in which the person is
    # a parent
    for family in sdb.parent_in(person):
        event_list += sdb.events(family)

    # Sort the events by their date
    event_list.sort(key=lambda x: x.get_date_object())

    # display the results

    # feature request 2356: avoid genitive form
    sdoc.title(_("Sorted events of %s") % sdb.name(person))
    sdoc.paragraph("")

    stab.columns(_("Event Type"), _("Event Date"), _("Event Place"))
    document.has_data = False
    for event in event_list:
        stab.row(event,
                 sdb.event_date_obj(event),
                 sdb.event_place(event))
        document.has_data = True
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found"))
예제 #8
0
def run(database, document, person):
    """
    Loops through the families that the person is a child in, and display
    the information about the other children.
    """
    # setup the simple access functions
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    rel_class = get_relationship_calculator(glocale)

    # display the title
    # feature request 2356: avoid genitive form
    sdoc.title(_("Siblings of %s") % sdb.name(person))
    sdoc.paragraph("")
    stab.columns(_("Sibling"), _("Gender"), _("Birth Date"), _("Type"))
    # grab our current id (self):
    gid = sdb.gid(person)
    # loop through each family in which the person is a child
    document.has_data = False
    for family in sdb.child_in(person):
        # loop through each child in the family
        for child in sdb.children(family):
            # only display if this child is not the active person
            if sdb.gid(child) != gid:
                rel_str = rel_class.get_sibling_relationship_string(
                    rel_class.get_sibling_type(database, person, child),
                    person.get_gender(), child.get_gender())
            else:
                rel_str = _('self')
            # pass row the child object to make link:
            stab.row(child, sdb.gender(child), sdb.birth_or_fallback(child),
                     rel_str)
            document.has_data = True
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found") + "\n")
예제 #9
0
def run(database, document, attribute, value=None):
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    sdoc.title(_("People who have the '%s' Attribute") % attribute)
    sdoc.paragraph("")
    stab.columns(_("Person"), str(attribute))
    matches = 0
    for person_handle in database.iter_person_handles():
        person = database.get_person_from_handle(person_handle)
        matched = False
        for attr in person.attribute_list:
            if str(attr.type) == attribute:
                stab.row(person, str(attr.get_value()))
                matched = True
        if matched:
            matches += 1
    document.has_data = matches > 0
    sdoc.paragraph(_("There are %d people with a matching attribute name.\n") % matches)
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found"))
예제 #10
0
def run(database, document, person):
    """
    Loops through the person events and the family events of any family
    in which the person is a parent (to catch Marriage events), displaying
    the basic details of the event
    """

    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)

    # get the personal events
    event_list = sdb.events(person)

    # get the events of each family in which the person is
    # a parent
    for family in sdb.parent_in(person):
        event_list += sdb.events(family)

    # Sort the events by their date
    event_list.sort(key=lambda x: x.get_date_object())

    # display the results

    # feature request 2356: avoid genitive form
    sdoc.title(_("Sorted events of %s") % sdb.name(person))
    sdoc.paragraph("")

    stab.columns(_("Event Type"), _("Event Date"), _("Event Place"))
    document.has_data = False
    for event in event_list:
        stab.row(event, sdb.event_date_obj(event), sdb.event_place(event))
        document.has_data = True
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found"))
예제 #11
0
def run(database, document, attribute, value=None):
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    sdoc.title(_("People who have the '%s' Attribute") % attribute)
    sdoc.paragraph("")
    stab.columns(_("Person"), str(attribute))
    matches = 0
    for person_handle in database.iter_person_handles():
        person = database.get_person_from_handle(person_handle)
        matched = False
        for attr in person.attribute_list:
            if str(attr.type) == attribute:
                stab.row(person, str(attr.get_value()))
                matched = True
        if matched:
            matches += 1
    document.has_data = matches > 0
    sdoc.paragraph(
        _("There are %d people with a matching attribute name.\n") % matches)
    if document.has_data:
        stab.write(sdoc)
    else:
        sdoc.header1(_("Not found"))