Family line report: including person links

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

Family line report: including person links

Patrick Gerlier
Hi all,

The family line report offers the possibility to graphically show an
extract of the DB in a more tangled way then the pedigree in a person
page of Narrative web. That is, we can display all children of a family
and in turn their spouses and children.

Thge report can be generated in a variety of formats, notably SVG, which
can then be included in an extra HTLM page of Narrative Web, as a kind
of map to facilitate access to a family line.

However, the SVG-flavoured graph don't include links to indivual person
pages. These links cannot be easily added afterwards since they are
computed from some hash of the person's name. Trying to add them
manually cannot be considerd beyond 10 persons.

Is there a way to request generation of these links in the present
Gramps (version 5.1.1)?

If not, I'm willing to experiment. In which source file should I look?

Regards,
Patrick



--
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: Family line report: including person links

Chris Wood
The source file you want is here (on Linux with Gramps 5.0.1):

/usr/lib/python3/dist-packages/gramps/plugins/graph/gvfamilylines.py

although I think Gramps 5.1.1 may be on a different python level - perhaps 3.5, not sure.

I've also been experimenting with the code, for different reasons.

Chris

On Sun, 15 Dec 2019 at 16:54, Patrick Gerlier <[hidden email]> wrote:
Hi all,

The family line report offers the possibility to graphically show an
extract of the DB in a more tangled way then the pedigree in a person
page of Narrative web. That is, we can display all children of a family
and in turn their spouses and children.

Thge report can be generated in a variety of formats, notably SVG, which
can then be included in an extra HTLM page of Narrative Web, as a kind
of map to facilitate access to a family line.

However, the SVG-flavoured graph don't include links to indivual person
pages. These links cannot be easily added afterwards since they are
computed from some hash of the person's name. Trying to add them
manually cannot be considerd beyond 10 persons.

Is there a way to request generation of these links in the present
Gramps (version 5.1.1)?

If not, I'm willing to experiment. In which source file should I look?

Regards,
Patrick



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Family line report: including person links

Patrick Gerlier

Thanks, Chris.

I'm beginning to explore the source with the LXR tool. Where is the function/method to compute the hashed link to the person page?

Is there some document explaining the basics of Gramps internal (application architecture, object structure, amin access methods)?

Regards,
Patrick

Le 15/12/2019 à 18:08, Chris Wood a écrit :
The source file you want is here (on Linux with Gramps 5.0.1):

/usr/lib/python3/dist-packages/gramps/plugins/graph/gvfamilylines.py

although I think Gramps 5.1.1 may be on a different python level - perhaps 3.5, not sure.

I've also been experimenting with the code, for different reasons.

Chris

On Sun, 15 Dec 2019 at 16:54, Patrick Gerlier <[hidden email]> wrote:
Hi all,

The family line report offers the possibility to graphically show an
extract of the DB in a more tangled way then the pedigree in a person
page of Narrative web. That is, we can display all children of a family
and in turn their spouses and children.

Thge report can be generated in a variety of formats, notably SVG, which
can then be included in an extra HTLM page of Narrative Web, as a kind
of map to facilitate access to a family line.

However, the SVG-flavoured graph don't include links to indivual person
pages. These links cannot be easily added afterwards since they are
computed from some hash of the person's name. Trying to add them
manually cannot be considerd beyond 10 persons.

Is there a way to request generation of these links in the present
Gramps (version 5.1.1)?

If not, I'm willing to experiment. In which source file should I look?

Regards,
Patrick



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Family line report: including person links

Chris Wood
Unfortunately your question is way above my pay grade! Whilst I have plenty of programming experience, I have none in Python or the internals of Gramps, so my experimentation so far is just at the level of minor tweaks to the FamilyLines code e.g. adding missing places (the existing code only processes 10 out of the 21 possible place types) and changing the format of the birth and death place string, because as it stands, if there is only a birth or death place, then it's impossible in the report to know which it is. I've changed it to always precede the death place with a separator regardless of whether a birth place is shown (as in the Relationship graph). Then you know.

Chris

On Mon, 16 Dec 2019 at 09:05, Patrick Gerlier <[hidden email]> wrote:

Thanks, Chris.

I'm beginning to explore the source with the LXR tool. Where is the function/method to compute the hashed link to the person page?

Is there some document explaining the basics of Gramps internal (application architecture, object structure, amin access methods)?

Regards,
Patrick



--
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: Family line report: including person links

GRAMPS - User mailing list
In reply to this post by Patrick Gerlier
On 16/12/2019 09:05, Patrick Gerlier wrote:
> Is there some document explaining the basics of Gramps internal
> (application architecture, object structure, amin access methods)?

You need to ask this type of question on the gramps-devel list.


Nick.




--
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: Family line report: including person links

Patrick Gerlier
In reply to this post by Chris Wood

My Python experience is close to null. However, mimicking the code, I already succeeded  adding a new option to enable/disable links in graph generation.

Apparently, everything is ready to insert links in the report. Presently, this link is None. All I need to do is compute a path to the web page file. Unfortunately, I didn't find where this is computed. Obviously, it should be in webreport/person.py but I guess this computation is the same for all web subdirectory files (places, people, event, family et al.). Consequently, is likely to be a common function.

I'm browsing webreport/basepage.py and maybe method new_person_link() contains what I'm looling for. BUT, Gramps is an object-oriented program. When I'm in graph/gvfamilylines.py, I am not in the correct object context to be able to reference the method (report versus graph).

OO programming may be greta, but unerstanding an application without a data dictionary is quite hard.

Patrick

Le 16/12/2019 à 16:10, Chris Wood a écrit :
Unfortunately your question is way above my pay grade! Whilst I have plenty of programming experience, I have none in Python or the internals of Gramps, so my experimentation so far is just at the level of minor tweaks to the FamilyLines code e.g. adding missing places (the existing code only processes 10 out of the 21 possible place types) and changing the format of the birth and death place string, because as it stands, if there is only a birth or death place, then it's impossible in the report to know which it is. I've changed it to always precede the death place with a separator regardless of whether a birth place is shown (as in the Relationship graph). Then you know.

Chris

On Mon, 16 Dec 2019 at 09:05, Patrick Gerlier <[hidden email]> wrote:

Thanks, Chris.

I'm beginning to explore the source with the LXR tool. Where is the function/method to compute the hashed link to the person page?

Is there some document explaining the basics of Gramps internal (application architecture, object structure, amin access methods)?

Regards,
Patrick





--
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: Family line report: including person links

GRAMPS - User mailing list
Perhaps you might want to start here:

You'll notice that the "See also" and Categories (at the bottom of the article) point toward more 'beginning development' documentation.

-Brian

On Mon, Dec 16, 2019 at 9:43, Patrick Gerlier


--
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: Family line report: including person links

prculley
Links to Narrative web files are created from the object handles.  The Narrative web code that does this is at https://github.com/gramps-project/gramps/blob/maintenance/gramps51/gramps/plugins/webreport/narrativeweb.py line 1314, 1369, 1246.  If you study the code you can see that the object handle becomes the filename, with the object type (ppl) and a couple of characters from the filename as the intermediate sub-directories.  An example usage is at https://github.com/gramps-project/gramps/blob/maintenance/gramps51/gramps/plugins/webreport/basepage.py line 866.

The various objects themselves are in https://github.com/gramps-project/gramps/tree/maintenance/gramps51/gramps/gen/lib; for example a person object is defined in person.py (which inherits from the other objects defined in the "Class Person(...)" line).

Hope this gives you some clues.

Paul C.

On Mon, Dec 16, 2019 at 10:07 AM Emyoulation--- via Gramps-users <[hidden email]> wrote:
Perhaps you might want to start here:

You'll notice that the "See also" and Categories (at the bottom of the article) point toward more 'beginning development' documentation.

-Brian

On Mon, Dec 16, 2019 at 9:43, Patrick Gerlier
--
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
Reply | Threaded
Open this post in threaded view
|

Re: Family line report: including person links

Patrick Gerlier
Thanks Paul,

I found this snippet (baspage.py) and imitated it into gvfamilylines.py.

However, I meet some difficulties. I can generate a .gv file containing
the required links. If I try to generate directly an .svg, the strings
are synthesised as graphic material and the result is not good-looking
(don't know exactly which font was selected, looks like some script one)
and links are not there.

 From the .gv file, with dot utility, I generate an .svg file to provide
an image "background" and a .cmpax file for the image map. I then
combine manully both files into an HTML one, adding the usual header
with the CSS declaration and the like.

But I'm meeting the limitations of my HTML skills because the graph
displays (though scale will have to be tuned) and the image map does not
work.  Links are present in the HTML code, but the image does not seem
to be associated with the image map though the attribute usemap= is there.

Still exporing.

Patrick

Le 16/12/2019 à 18:58, Paul Culley a écrit :

> Links to Narrative web files are created from the object handles.  The
> Narrative web code that does this is at
> https://github.com/gramps-project/gramps/blob/maintenance/gramps51/gramps/plugins/webreport/narrativeweb.py 
> line 1314, 1369, 1246.  If you study the code you can see that the
> object handle becomes the filename, with the object type (ppl) and a
> couple of characters from the filename as the intermediate
> sub-directories.  An example usage is at
> https://github.com/gramps-project/gramps/blob/maintenance/gramps51/gramps/plugins/webreport/basepage.py 
> line 866.
>
> The various objects themselves are in
> https://github.com/gramps-project/gramps/tree/maintenance/gramps51/gramps/gen/lib; 
> for example a person object is defined in person.py (which inherits
> from the other objects defined in the "Class Person(...)" line).
>
> Hope this gives you some clues.
>
> Paul C.



--
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: Family line report: including person links

Patrick Gerlier

To those who read (and participated) in this thread:

Success!

I can now generate various trees (or rather meshes) from the family lines report generator. The procedure is rather twisty:

  1. generate a graphviz file with links embedded in the nodes (I added an option in the report dialog to avoid always having the links when format does not support them, e.g. PNG or JPEG)
  2. from the previous file with graphviz (dot command), create an SVG file (this image will be used as the tree in screen background); links are stripped from SVG by grapviz (no way to prevent it)
  3. also from the first file, create a <map><area>…</map> block to designate the hot spots in the SVG image (cmapx format of graphviz)
  4. manually assemble image and <map> in an HTML page, taking care to force <img> size to the size computed by graphviz (otherwise Firefox -- don't know for other browsers -- converts/rounds size to something of its liking; also add the menu stuff so that the page looks like the others
  5. store image and HTML files into the Narrative Web folder

After that, I can click on a people rectangle to go to its individual page.

To do: automating the procedure with some script.

Question; is the general HTML page structure available in some source file? I had a look at plugins/webreport/basepage.py but I wouldn't call it template.

Patrick



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