2701: Collapsing a family's children, collapses all family's children

svn: r11935
This commit is contained in:
Doug Blank 2009-02-09 12:32:57 +00:00
parent 0671acaf69
commit 419a180e21

View File

@ -1135,20 +1135,21 @@ class RelationshipView(PageView.PersonNavView):
return (handle in self.collapsed_items.get(person_handle, [])) return (handle in self.collapsed_items.get(person_handle, []))
def expand_collapse_press(self, obj, event, pair): def expand_collapse_press(self, obj, event, pair):
""" Calback function for ExpandCollapseArrow, user param is pair, """ Calback function for ExpandCollapseArrow, user param is
which is a tuple (person, handle) with handle the section of which pair, which is a tuple (object, handle) which handles the
the collapse state must change, so a parent, siblings id, section of which the collapse state must change, so a
family id, family children id, etc parent, siblings id, family id, family children id, etc.
NOTE: object must be a thing that has a handle field.
""" """
if button_activated(event, _LEFT_BUTTON): if button_activated(event, _LEFT_BUTTON):
person, handle = pair object, handle = pair
if person.handle in self.collapsed_items: if object.handle in self.collapsed_items:
if handle in self.collapsed_items[person.handle]: if handle in self.collapsed_items[object.handle]:
self.collapsed_items[person.handle].remove(handle) self.collapsed_items[object.handle].remove(handle)
else: else:
self.collapsed_items[person.handle].append(handle) self.collapsed_items[object.handle].append(handle)
else: else:
self.collapsed_items[person.handle] = [handle] self.collapsed_items[object.handle] = [handle]
self.redraw() self.redraw()
def _button_press(self, obj, event, handle): def _button_press(self, obj, event, handle):
@ -1289,14 +1290,14 @@ class RelationshipView(PageView.PersonNavView):
self.write_relationship(box, family) self.write_relationship(box, family)
hbox = gtk.HBox() hbox = gtk.HBox()
if self.check_collapsed(person.handle, "CHILDREN"): if self.check_collapsed(family.handle, "CHILDREN"):
arrow = widgets.ExpandCollapseArrow(True, arrow = widgets.ExpandCollapseArrow(True,
self.expand_collapse_press, self.expand_collapse_press,
(person, "CHILDREN")) (family, "CHILDREN"))
else: else:
arrow = widgets.ExpandCollapseArrow(False, arrow = widgets.ExpandCollapseArrow(False,
self.expand_collapse_press, self.expand_collapse_press,
(person, "CHILDREN")) (family, "CHILDREN"))
hbox.pack_start(arrow, False) hbox.pack_start(arrow, False)
label_cell = self.build_label_cell(_('Children')) label_cell = self.build_label_cell(_('Children'))
hbox.pack_start(label_cell, True) hbox.pack_start(label_cell, True)
@ -1305,7 +1306,7 @@ class RelationshipView(PageView.PersonNavView):
self.row+1, xoptions=gtk.FILL|gtk.SHRINK, self.row+1, xoptions=gtk.FILL|gtk.SHRINK,
yoptions=gtk.FILL) yoptions=gtk.FILL)
if self.check_collapsed(person.handle, "CHILDREN"): if self.check_collapsed(family.handle, "CHILDREN"):
hbox = gtk.HBox() hbox = gtk.HBox()
child_list = family.get_child_ref_list() child_list = family.get_child_ref_list()
if child_list: if child_list: