From 4e9f90908366c0254a18786dab86cb10be0f811a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Charette?= Date: Thu, 8 Nov 2007 09:12:01 +0000 Subject: [PATCH] issue #1352, include all children as siblings in relationship view svn: r9323 --- ChangeLog | 5 +++++ src/DataViews/_RelationView.py | 29 ++++++++++++++++++++--------- src/GrampsWidgets.py | 22 ++++++++++++---------- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1e4db8f1..4a3115358 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-11-08 Stéphane Charette + * src/DataViews/_RelationView.py: issue #1352 + * src/GrampsWidgets.py: issue #1352, include all siblings in + relationship view, but make current person non-linkable + 2007-11-07 Benny Malengier * src/AddMedia.py: fix issue #1350, relative path not working addmedia * src/Editors/_EditPerson.py: family rebuild callback error diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index cee7f1b03..0f6a156a0 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -772,8 +772,7 @@ class RelationshipView(PageView.PersonNavView): if self.show_siblings: active = self.dbstate.active.handle - child_list = [ref.ref for ref in family.get_child_ref_list()\ - if ref.ref != active] + child_list = [ref.ref for ref in family.get_child_ref_list()] if child_list: eventbox = gtk.EventBox() @@ -789,7 +788,8 @@ class RelationshipView(PageView.PersonNavView): i = 1 for child_handle in child_list: - self.write_child(vbox, child_handle, i) + child_should_be_linked = (child_handle != active) + self.write_child(vbox, child_handle, i, child_should_be_linked) i += 1 eventbox.add(vbox) @@ -892,19 +892,30 @@ class RelationshipView(PageView.PersonNavView): lbl.set_padding(0, 5) return lbl - def write_child(self, vbox, handle, index): + def write_child(self, vbox, handle, index, child_should_be_linked): parent = has_children(self.dbstate.db, self.dbstate.db.get_person_from_handle(handle)) - if parent: + + format = '' + if child_should_be_linked and parent: format = 'underline="single" weight="heavy" style="italic"' - else: + elif child_should_be_linked and not parent: format = 'underline="single"' + elif parent and not child_should_be_linked: + format = 'weight="heavy" style="italic"' + + if child_should_be_linked: + link_func = self._button_press + else: + link_func = None + link_label = GrampsWidgets.LinkLabel(self.get_name(handle, True), - self._button_press, handle, format) + link_func, handle, format) + if self.use_shade: link_label.modify_bg(gtk.STATE_NORMAL, self.color) link_label.set_padding(3, 0) - if Config.get(Config.RELEDITBTN): + if child_should_be_linked and Config.get(Config.RELEDITBTN): button = GrampsWidgets.IconButton(self.edit_button_press, handle) else: button = None @@ -1137,7 +1148,7 @@ class RelationshipView(PageView.PersonNavView): i = 1 for child_ref in child_list: - self.write_child(vbox, child_ref.ref, i) + self.write_child(vbox, child_ref.ref, i, True) i += 1 eventbox.add(vbox) diff --git a/src/GrampsWidgets.py b/src/GrampsWidgets.py index 2bf3bc61c..57d4d64b4 100644 --- a/src/GrampsWidgets.py +++ b/src/GrampsWidgets.py @@ -126,12 +126,13 @@ class LinkLabel(gtk.EventBox): self.decoration = decoration text = '%s' % (self.decoration, self.orig_text) - msg = _('Click to make the active person\n' - 'Right click to display the edit menu') - if not Config.get(Config.RELEDITBTN): - msg += "\n" + _('Edit icons can be enabled in the Preferences dialog') + if func: + msg = _('Click to make the active person\n' + 'Right click to display the edit menu') + if not Config.get(Config.RELEDITBTN): + msg += "\n" + _('Edit icons can be enabled in the Preferences dialog') - self.tooltips.set_tip(self, msg) + self.tooltips.set_tip(self, msg) self.label = gtk.Label(text) self.label.set_use_markup(True) @@ -143,11 +144,12 @@ class LinkLabel(gtk.EventBox): hbox.pack_start(GenderLabel(label[1]), False, False, 0) hbox.set_spacing(4) self.add(hbox) - - self.connect('button-press-event', func, handle) - self.connect('enter-notify-event', self.enter_text, handle) - self.connect('leave-notify-event', self.leave_text, handle) - self.connect('realize', realize_cb) + + if func: + self.connect('button-press-event', func, handle) + self.connect('enter-notify-event', self.enter_text, handle) + self.connect('leave-notify-event', self.leave_text, handle) + self.connect('realize', realize_cb) def set_padding(self, x, y): self.label.set_padding(x, y)