update from trunk

svn: r8034
This commit is contained in:
Don Allingham 2007-02-03 18:08:43 +00:00
parent 631b781d53
commit bef178af13

View File

@ -62,6 +62,7 @@ from DisplayTabs import \
EmbeddedList,EventEmbedList,SourceEmbedList,FamilyAttrEmbedList,\ EmbeddedList,EventEmbedList,SourceEmbedList,FamilyAttrEmbedList,\
NoteTab,GalleryTab,FamilyLdsEmbedList, ChildModel NoteTab,GalleryTab,FamilyLdsEmbedList, ChildModel
from GrampsWidgets import * from GrampsWidgets import *
import QuestionDialog
#from ObjectSelector import PersonSelector,PersonFilterSpec #from ObjectSelector import PersonSelector,PersonFilterSpec
@ -371,7 +372,6 @@ class EditFamily(EditPrimary):
for i in self.hidden: for i in self.hidden:
i.set_sensitive(False) i.set_sensitive(False)
import QuestionDialog
QuestionDialog.MessageHideDialog( QuestionDialog.MessageHideDialog(
_("Adding parents to a person"), _("Adding parents to a person"),
_("It is possible to accidentally create multiple " _("It is possible to accidentally create multiple "
@ -393,9 +393,8 @@ class EditFamily(EditPrimary):
self.mname = None self.mname = None
self.fname = None self.fname = None
self._add_db_signal('person-update', self.check_for_change) self._add_db_signal('family-update', self.check_for_family_change)
self._add_db_signal('person-delete', self.check_for_change) self._add_db_signal('family-delete', self.check_for_close)
self._add_db_signal('person-rebuild', self.reload_people)
self.added = self.obj.handle == None self.added = self.obj.handle == None
if self.added: if self.added:
@ -403,20 +402,28 @@ class EditFamily(EditPrimary):
self.load_data() self.load_data()
def check_for_change(self,handles): def check_for_close(self, handles):
if self.obj.get_handle() in handles:
chandles = set([ c.ref for c in self.obj.get_child_ref_list() if c ]) self._do_close()
for node in handles:
if node == self.obj.get_father_handle(): def check_for_family_change(self, handles):
self.obj.set_father_handle(None)
self.reload_people() # check to see if the handle matches the current object
elif node == self.obj.get_mother_handle(): if self.obj.get_handle() in handles:
self.obj.set_mother_handle(None)
self.reload_people() self.obj = self.dbstate.db.get_family_from_handle(self.obj.get_handle())
elif node in chandles: self.reload_people()
new_list = [ c for c in self.obj.get_child_ref_list() if c.ref != node ] self.event_embed.rebuild()
self.obj.set_child_ref_list(new_list) self.source_embed.rebuild()
self.reload_people() self.attr_embed.data = self.obj.get_attribute_list()
self.attr_embed.rebuild()
self.lds_embed.data = self.obj.get_lds_ord_list()
self.lds_embed.rebuild()
QuestionDialog.WarningDialog(
_("Family has changed"),
_("The family you are editing has changed. GRAMPS has updated the data. "
"Any edits you have made may have been lost."))
def reload_people(self): def reload_people(self):
fhandle = self.obj.get_father_handle() fhandle = self.obj.get_father_handle()
@ -528,18 +535,15 @@ class EditFamily(EditPrimary):
notebook, notebook,
ChildEmbedList(self.dbstate,self.uistate, self.track, self.obj)) ChildEmbedList(self.dbstate,self.uistate, self.track, self.obj))
self.event_list = self._add_tab( self.event_embed = EventEmbedList(self.dbstate,self.uistate, self.track,self.obj)
notebook, self.event_list = self._add_tab(notebook, self.event_embed)
EventEmbedList(self.dbstate,self.uistate, self.track,self.obj))
self.src_list = self._add_tab( self.source_embed = SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)
notebook, self.src_list = self._add_tab(notebook, self.source_embed)
SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj))
self.attr_list = self._add_tab( self.attr_embed = FamilyAttrEmbedList(self.dbstate, self.uistate, self.track,
notebook, self.obj.get_attribute_list())
FamilyAttrEmbedList(self.dbstate, self.uistate, self.track, self.attr_list = self._add_tab(notebook, self.attr_embed)
self.obj.get_attribute_list()))
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
@ -551,10 +555,9 @@ class EditFamily(EditPrimary):
GalleryTab(self.dbstate, self.uistate, self.track, GalleryTab(self.dbstate, self.uistate, self.track,
self.obj.get_media_list())) self.obj.get_media_list()))
self.lds_list = self._add_tab( self.lds_embed = FamilyLdsEmbedList(self.dbstate, self.uistate, self.track,
notebook, self.obj.get_lds_ord_list())
FamilyLdsEmbedList(self.dbstate,self.uistate,self.track, self.lds_list = self._add_tab(notebook, self.lds_embed)
self.obj.get_lds_ord_list()))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()
@ -682,7 +685,6 @@ class EditFamily(EditPrimary):
common = list(mfam.intersection(ffam)) common = list(mfam.intersection(ffam))
if len(common) > 0: if len(common) > 0:
if self.add_parent or self.obj.handle not in common: if self.add_parent or self.obj.handle not in common:
import QuestionDialog
QuestionDialog.WarningDialog( QuestionDialog.WarningDialog(
_('Duplicate Family'), _('Duplicate Family'),
_('A family with these parents already exists ' _('A family with these parents already exists '
@ -778,24 +780,22 @@ class EditFamily(EditPrimary):
child_list = [ ref.ref for ref in self.obj.get_child_ref_list() ] child_list = [ ref.ref for ref in self.obj.get_child_ref_list() ]
if self.obj.get_father_handle() in child_list: if self.obj.get_father_handle() in child_list:
from QuestionDialog import ErrorDialog
father = self.db.get_person_from_handle(self.obj.get_father_handle()) father = self.db.get_person_from_handle(self.obj.get_father_handle())
name = "%s [%s]" % (NameDisplay.displayer.display(father), name = "%s [%s]" % (NameDisplay.displayer.display(father),
father.gramps_id) father.gramps_id)
ErrorDialog(_("A father cannot be his own child"), QuestionDialog.ErrorDialog(_("A father cannot be his own child"),
_("%s is listed as both the father and child " _("%s is listed as both the father and child "
"of the family.") % name) "of the family.") % name)
return return
elif self.obj.get_mother_handle() in child_list: elif self.obj.get_mother_handle() in child_list:
from QuestionDialog import ErrorDialog
mother = self.db.get_person_from_handle(self.obj.get_mother_handle()) mother = self.db.get_person_from_handle(self.obj.get_mother_handle())
name = "%s [%s]" % (NameDisplay.displayer.display(mother), name = "%s [%s]" % (NameDisplay.displayer.display(mother),
mother.gramps_id) mother.gramps_id)
ErrorDialog(_("A mother cannot be her own child"), QuestionDialog.ErrorDialog(_("A mother cannot be her own child"),
_("%s is listed as both the mother and child " _("%s is listed as both the mother and child "
"of the family.") % name) "of the family.") % name)
return return
@ -826,10 +826,9 @@ class EditFamily(EditPrimary):
self.db.add_family(self.obj,trans) self.db.add_family(self.obj,trans)
self.db.transaction_commit(trans,_("Add Family")) self.db.transaction_commit(trans,_("Add Family"))
elif not original and self.object_is_empty(): elif not original and self.object_is_empty():
from QuestionDialog import ErrorDialog QuestionDialog.ErrorDialog(_("Cannot save family"),
ErrorDialog(_("Cannot save family"), _("No data exists for this family. Please "
_("No data exists for this family. Please " "enter data or cancel the edit."))
"enter data or cancel the edit."))
return return
elif original and self.object_is_empty(): elif original and self.object_is_empty():
trans = self.db.transaction_begin() trans = self.db.transaction_begin()