Skip to content

Commit 7d50129

Browse files
committed
Add relationship to associations
1 parent cca8cf6 commit 7d50129

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

CombinedView/combinedview.gpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
id = 'combinedview',
2323
name = _("Combined"),
2424
description = _("A view showing relationships and events for a person"),
25-
version = '1.0.15',
25+
version = '1.0.16',
2626
gramps_target_version = '5.1',
2727
status = STABLE,
2828
fname = 'combinedview.py',

CombinedView/combinedview.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
from gramps.gen.datehandler import displayer, get_date
7070
from gramps.gen.utils.thumbnails import get_thumbnail_image
7171
from gramps.gen.config import config
72+
from gramps.gen.relationship import get_relationship_calculator
7273
from gramps.gui import widgets
7374
from gramps.gui.widgets.reorderfam import Reorder
7475
from gramps.gui.widgets.styledtexteditor import StyledTextEditor
@@ -1282,7 +1283,10 @@ def write_citation(self, vbox, chandle):
12821283
citation = self.dbstate.db.get_citation_from_handle(chandle)
12831284
shandle = citation.get_reference_handle()
12841285
source = self.dbstate.db.get_source_from_handle(shandle)
1285-
heading = source.get_title() + ' ' + citation.get_page()
1286+
heading = source.get_title()
1287+
page = citation.get_page()
1288+
if page:
1289+
heading += ' \u2022 ' + page
12861290

12871291
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
12881292
url_label = self.get_url(citation)
@@ -1431,15 +1435,24 @@ def write_associations(self, person):
14311435
self.stack.add_titled(scroll, 'associations', _('Associations'))
14321436

14331437
for person_ref in person.get_person_ref_list():
1434-
self.write_association(person_ref)
1438+
self.write_association(person, person_ref)
14351439

14361440

1437-
def write_association(self, person_ref):
1441+
def write_association(self, person1, person_ref):
14381442

14391443
vbox = self.write_person('assoc', person_ref.ref)
1440-
rel = Gtk.Label(person_ref.rel)
1444+
1445+
assoc = Gtk.Label(_('Association') + _(': ') + person_ref.rel)
1446+
assoc.set_halign(Gtk.Align.START)
1447+
vbox.pack_start(assoc, False, False, 0)
1448+
1449+
calc = get_relationship_calculator()
1450+
person2 = self.dbstate.db.get_person_from_handle(person_ref.ref)
1451+
rel_txt = calc.get_one_relationship(self.dbstate.db, person1, person2)
1452+
rel = Gtk.Label(_('Relationship') + _(': ') + rel_txt)
14411453
rel.set_halign(Gtk.Align.START)
14421454
vbox.pack_start(rel, False, False, 0)
1455+
14431456
eventbox = self.make_dragbox(vbox, 'Person', person_ref.ref)
14441457
eventbox.show_all()
14451458
self.vbox2.pack_start(eventbox, False, False, 1)

0 commit comments

Comments
 (0)