issue #1352, include all children as siblings in relationship view

svn: r9323
This commit is contained in:
Stéphane Charette 2007-11-08 09:12:01 +00:00
parent 766d9147b8
commit 4e9f909083
3 changed files with 37 additions and 19 deletions

View File

@ -1,3 +1,8 @@
2007-11-08 Stéphane Charette <stephanecharette@gmail.com>
* 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 <benny.malengier@gramps-project.org> 2007-11-07 Benny Malengier <benny.malengier@gramps-project.org>
* src/AddMedia.py: fix issue #1350, relative path not working addmedia * src/AddMedia.py: fix issue #1350, relative path not working addmedia
* src/Editors/_EditPerson.py: family rebuild callback error * src/Editors/_EditPerson.py: family rebuild callback error

View File

@ -772,8 +772,7 @@ class RelationshipView(PageView.PersonNavView):
if self.show_siblings: if self.show_siblings:
active = self.dbstate.active.handle active = self.dbstate.active.handle
child_list = [ref.ref for ref in family.get_child_ref_list()\ child_list = [ref.ref for ref in family.get_child_ref_list()]
if ref.ref != active]
if child_list: if child_list:
eventbox = gtk.EventBox() eventbox = gtk.EventBox()
@ -789,7 +788,8 @@ class RelationshipView(PageView.PersonNavView):
i = 1 i = 1
for child_handle in child_list: 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 i += 1
eventbox.add(vbox) eventbox.add(vbox)
@ -892,19 +892,30 @@ class RelationshipView(PageView.PersonNavView):
lbl.set_padding(0, 5) lbl.set_padding(0, 5)
return lbl 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, parent = has_children(self.dbstate.db,
self.dbstate.db.get_person_from_handle(handle)) 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"' format = 'underline="single" weight="heavy" style="italic"'
else: elif child_should_be_linked and not parent:
format = 'underline="single"' 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), link_label = GrampsWidgets.LinkLabel(self.get_name(handle, True),
self._button_press, handle, format) link_func, handle, format)
if self.use_shade: if self.use_shade:
link_label.modify_bg(gtk.STATE_NORMAL, self.color) link_label.modify_bg(gtk.STATE_NORMAL, self.color)
link_label.set_padding(3, 0) 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) button = GrampsWidgets.IconButton(self.edit_button_press, handle)
else: else:
button = None button = None
@ -1137,7 +1148,7 @@ class RelationshipView(PageView.PersonNavView):
i = 1 i = 1
for child_ref in child_list: 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 i += 1
eventbox.add(vbox) eventbox.add(vbox)

View File

@ -126,6 +126,7 @@ class LinkLabel(gtk.EventBox):
self.decoration = decoration self.decoration = decoration
text = '<span %s>%s</span>' % (self.decoration, self.orig_text) text = '<span %s>%s</span>' % (self.decoration, self.orig_text)
if func:
msg = _('Click to make the active person\n' msg = _('Click to make the active person\n'
'Right click to display the edit menu') 'Right click to display the edit menu')
if not Config.get(Config.RELEDITBTN): if not Config.get(Config.RELEDITBTN):
@ -144,6 +145,7 @@ class LinkLabel(gtk.EventBox):
hbox.set_spacing(4) hbox.set_spacing(4)
self.add(hbox) self.add(hbox)
if func:
self.connect('button-press-event', func, handle) self.connect('button-press-event', func, handle)
self.connect('enter-notify-event', self.enter_text, handle) self.connect('enter-notify-event', self.enter_text, handle)
self.connect('leave-notify-event', self.leave_text, handle) self.connect('leave-notify-event', self.leave_text, handle)