GEPS 002: RelationView Expand and Collapse

From Gramps
Gnome-important.png
GEPS Closed

This GEPS (Gramps Enhancement Proposal) is closed and available in the version of Gramps indicated below.
Do not edit this page. Submit bugs/features to https://gramps-project.org/bugs/.

Status: Accepted and Completed in Gramps 3.0

Proposed changes for enhancing RelationView by adding expand/collapse

Introduction

This page proposes and discusses possible changes to the RelationView of the GRAMPS GUI (Relationships).

The first proposed change is the addition of expand/collapse buttons on the Parents and Family lines. This would allow the user to hide the details of the Parents, or a particular Family. This functionality helps a researcher focus their attention on one aspect (family) of the person.

This differs from the "View" -> "Show Siblings" and "Show Details" in a couple of ways:

  1. the expand/collapse is specific to a particular family
  2. only lasts for the current session

The change does remember what families have been collapsed, so when you return to a person, you get the same view as previous view (for this session).

The second proposed change is that siblings or children that have children themselves are shown in the same markup style (bold and italic) that the PedigreeView uses to show the same thing.

Example/Screenshot

The first screenshot shows the RelationView as normal, but includes the "Collapse" triangle icons (the same icon used in the PeopleView). Also, the columns in the lower section have been shifted left to make more room. As you move your mouse over the triangles, they turn black, like in the PeopleView.

Expand-5.png

The collapsed view now fit into the window. Notice that Jessie McKinney is bold+italic to show that she has children (as does the PedigreeView).

Expand-4.png

Code

The code (version 03) necessary to implement these changes can be found here. This patch can be applied to version gramps30.

Options

The families/parents to expand/collapse are kept in a list which hangs off of a dictionary entry of the active person's handle. The list is only kept during the current session; it will revert to all expanded when restarted.

Impact

Requires four phrases for translation: "Expand this section", "Collapse this section", "(%d children)", and "(%d siblings)".

Has a minimal screen impact.

The handles of families that are collapsed are placed into a list referenced by a dictionary lookup. A substantial number of families per active-person would have to be collapsed for this to have an effect on performance. This is deemed to be unlikely.

The latest version with the summaries per collapsed line was a little more intrusive into existing code. The code that generates the RelationView is a combination of predetermined columns and dynamic rows counted as it generates entries. In a couple of places, the row was advanced in one place, but required a backup to put the summary on that line. I decided to implement it in such a manner as to keep similar logic together (ie, the code to count children is in the same method that prints the children, depending on collapse/expand).

I had to add person as an argument to a few methods. I gave it a None default in case these are called outside of this file (I didn't see any).

I also added a new GrampsWidget: an ExpandCollapseLabel. In addition, I added a parameter LinkLabel constructor, but made it backward compatible.

Future versions

One could expand/collapse the siblings (which would make it so that the Show Siblings option would not be needed). However, this could make the screen busier.

Other related changes one might consider to make to clean up this view:

  1. Add an edit button to top row, regardless of "Show edit" settings. How else do you edit the active person?
Not needed. The edit button is in the toolbar, as this is a view centered around that person bmcage 05:28, 5 September 2007 (EDT)
True, but it might be more consistent if there were one. Families and Parents have an Edit button regardless. dsblank 08:03, 5 September 2007 (EDT)
  1. Add active person to sibling list, but make it so that you can't click it. I get confused when the active person isn't in the list of the parent's children. The "(n siblings)" label would then change to just "(n+1 children)".
  2. Move the "Show edit buttons in relation view" from Preferences to View menu to be consistent with "Show siblings" and "Show details".
  3. Add "Last Change" date/time somewhere, maybe in top section above/below picture.

User Contributions

A discussion of these ideas can be found on the gramps-dev mailing list.

Also, Stian noticed a nitpick: the names of the children did not line up. How's this:

Indentation-1.png

Line 912, gramps30/src/DataViews/_RelationView.py:

l.set_padding(32, 0)

and around line 8688:

       label = GrampsWidgets.BasicLabel("%d." % index)
       label.set_width_chars(1)
       hbox.pack_start(label,

See also

  • 1782 Further refinements to Relationship View