GEPS 002: RelationView Expand and Collapse
Status: Accepted and Completed
Proposed changes for enhancing RelationView by adding expand/collapse
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:
- the expand/collapse is specific to a particular family
- 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.
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.
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).
The code (version 03) necessary to implement these changes can be found here. This patch can be applied to version gramps30.
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.
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.
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:
- Add an edit button to top row, regardless of "Show edit" settings. How else do you edit the active person?
- 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)".
- Move the "Show edit buttons in relation view" from Preferences to View menu to be consistent with "Show siblings" and "Show details".
- Add "Last Change" date/time somewhere, maybe in top section above/below picture.
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:
Line 912, gramps30/src/DataViews/_RelationView.py:
and around line 8688:
label = GrampsWidgets.BasicLabel("%d." % index) label.set_width_chars(1) hbox.pack_start(label,