select parents from relationship view

svn: r6283
This commit is contained in:
Don Allingham 2006-04-07 02:54:33 +00:00
parent 57d6df04c9
commit 54a86db801
2 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,6 @@
2006-04-06 Don Allingham <don@gramps-project.org>
* src/DataViews/_FamilyView.py: add select parents function
2006-04-06 Alex Roitman <shura@gramps-project.org> 2006-04-06 Alex Roitman <shura@gramps-project.org>
* various: Revert back to using gettext except for the modules * various: Revert back to using gettext except for the modules
that need context -- those will use TransUtils.sgettext that need context -- those will use TransUtils.sgettext

View File

@ -424,6 +424,11 @@ class FamilyView(PageView.PersonNavView):
add = GrampsWidgets.IconButton(call_fcn,None,gtk.STOCK_ADD) add = GrampsWidgets.IconButton(call_fcn,None,gtk.STOCK_ADD)
hbox.pack_start(add,False) hbox.pack_start(add,False)
if is_parent:
add = GrampsWidgets.IconButton(self.select_family,None,gtk.STOCK_INDEX)
hbox.pack_start(add,False)
if family: if family:
edit = GrampsWidgets.IconButton(self.edit_family,family.handle, edit = GrampsWidgets.IconButton(self.edit_family,family.handle,
gtk.STOCK_EDIT) gtk.STOCK_EDIT)
@ -682,6 +687,27 @@ class FamilyView(PageView.PersonNavView):
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass
def select_family(self, obj, event, handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
from SelectFamily import SelectFamily
dialog = SelectFamily(self.dbstate.db, _('Select Family'))
family = dialog.run()
person = self.dbstate.db.get_person_from_handle(self.dbstate.active.handle)
family.add_child_handle(person.handle)
person.add_parent_family_handle(
family.handle,
(RelLib.Person.CHILD_BIRTH,''),
(RelLib.Person.CHILD_BIRTH,''))
trans = self.dbstate.db.transaction_begin()
self.dbstate.db.commit_person(person,trans)
self.dbstate.db.commit_family(family,trans)
self.dbstate.db.transaction_commit(trans,_("Add Family"))
def add_parent_family(self,obj,event,handle): def add_parent_family(self,obj,event,handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
from Editors import EditFamily from Editors import EditFamily