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>
* src/AddMedia.py: fix issue #1350, relative path not working addmedia
* src/Editors/_EditPerson.py: family rebuild callback error

View File

@ -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)

View File

@ -126,12 +126,13 @@ class LinkLabel(gtk.EventBox):
self.decoration = decoration
text = '<span %s>%s</span>' % (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)