Child relationship filter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Child relationship filter

sturdy
The Child Reference Editor allows recording the relationship of the
child to the father and to the mother. One available selection is
"Adopted" and there six others including "Stepchild." The Family filters
provide a filter for "Adopted people" but I can find no means to filter
on "Stepchild" or any of the other available relationships. I've tried
typing "Stepchild" into the "People with the <relationships>" filter but
no joy. Is a "Stepchild" filter available or possible? TIA

BobS



_______________________________________________
Gramps-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-users
https://gramps-project.org
Reply | Threaded
Open this post in threaded view
|

Re: Child relationship filter

Dave Scheipers
Hi Bob

I found the Adopted filter code and used it as a template to create a
similar filter for stepchild. It is really quite easy.

The filter for adopted is in the program file
\gramps\gen\filters\rules\person\_havealtfamilies.py

Copy this file to your desktop so you can alter it and leave the
original as is. I named it _isstepchild.py

Starting at line 37 make the changes below
#-------------------------------------------------------------------------
# "People who were step children"
#-------------------------------------------------------------------------
class IsStepChild(Rule):
    """People who were step children"""
    name        = _('Stepchild people')
    description = _("Matches people who were step children")
    category    = _('Family filters')
    def apply(self,db,person):
        for fhandle in person.get_parent_family_handle_list():
            family = db.get_family_from_handle(fhandle)
            if family:
                ref = [ ref for ref in family.get_child_ref_list() \
                        if ref.ref == person.handle]
                if ref[0].get_father_relation() == ChildRefType.STEPCHILD \
                       or ref[0].get_mother_relation() ==
ChildRefType.STEPCHILD:
                    return True
        return False

You also need to alter the __init__.py file in this folder.

Add

from ._isstepchild import IsStepChild

and

 IsStepChild,

 to the similar areas of the file. Be very careful of the indents.
Similar filters can be made for the other options.

The filter will not show up until you restart Gramps.

Hope this helps, Dave




On Wed, Sep 19, 2018 at 3:12 PM [hidden email] <[hidden email]> wrote:

>
> The Child Reference Editor allows recording the relationship of the
> child to the father and to the mother. One available selection is
> "Adopted" and there six others including "Stepchild." The Family filters
> provide a filter for "Adopted people" but I can find no means to filter
> on "Stepchild" or any of the other available relationships. I've tried
> typing "Stepchild" into the "People with the <relationships>" filter but
> no joy. Is a "Stepchild" filter available or possible? TIA
>
> BobS
>
>
>
> _______________________________________________
> Gramps-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-users
> https://gramps-project.org


_______________________________________________
Gramps-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-users
https://gramps-project.org