Add sub-events: let events belong to one or more super-events#2456
Open
dsblank wants to merge 2 commits into
Open
Add sub-events: let events belong to one or more super-events#2456dsblank wants to merge 2 commits into
dsblank wants to merge 2 commits into
Conversation
Events can now reference zero or more super-events via a new super_event_list field (Event.get_super_event_list/set_super_event_list/ add_super_event), mirroring how Place.placeref_list already lets a place belong to more than one enclosing place. This lets researchers group related events (e.g. individual legs of a multi-day emigration journey) under a containing event, and browse them hierarchically. Database changes: - Event gains super_event_list; handle-reference methods, merge(), and get_referenced_handles() are updated so deleting or merging a super-event keeps every sub-event's list consistent. - Schema version bumped to (23, 0, 0) with a matching upgrade step. - Sub-event lookups reuse the existing indexed backlink table via find_backlink_handles(), so no full-table scan is needed. - Merging an event that others reference as their super-event no longer raises MergeError; a self-reference guard prevents a merged event from becoming its own super-event. UI changes: - The event editor gains a "Part of" tab to add, remove, and reorder an event's super-events, with a cycle guard reusing the same find_backlink_handles pattern already used by the place editor. - A new "Event Tree" view shows events nested under their primary super-event, alongside the existing flat Events view, following the same List/Tree split already used for Places. Gramps XML changes: - Events can now write and read a <partof hlink="..."/> element per super-event; the DTD, RelaxNG schema, and XML version are updated accordingly so the relationship survives export/import. Issue #10672.
supereventembedlist.py and eventtreeview.py contain translatable strings and are added to POTFILES.in. The new test files and the plain supereventmodel.py have none and are added to POTFILES.skip. Issue #10672.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the community-requested sub-events feature (events can belong to one or more "super-events", browsable as a hierarchy) discussed in:
Design mirrors the existing Place hierarchy (
placeref_list): a plainsuper_event_list: list[EventHandle]onEvent, no new secondary-object class, no new database tables.Event.super_event_list, with serialize/schema, handle-reference methods,merge()union with a self-reference guard, and accessors.(23, 0, 0)withgramps_upgrade_23(). Sub-event lookups reuse the existing indexed backlink table viafind_backlink_handles()— no full-table scan.MergeErrorthat would otherwise fire as soon as an event gains anEvent-class backlink (merging a super-event that other events point to).find_backlink_handlespattern the place editor already uses.<partof hlink="..."/>added toexportxml.py/importxml.py,grampsxml.dtd,grampsxml.rng, with the XML version bumped so the relationship survives export/import instead of being silently dropped.Deferred (not in this PR, by design): an optional merge-dialog warning when merging events with sub-event relationships, and gramplet/report support for showing sub-event structure (existing reports are unaffected — every event still appears in flat listings).
Test plan
python3 -m unittest.mypyclean on the full project.black --checkclean on all changed files.EventTreeModel's tree-building logic against a real SQLite-backed database (multi-level nesting, multiple children, unrelated roots, and a cycle-safety case) since a full interactive GTK session wasn't renderable in the sandbox this was built in.🤖 Generated with Claude Code