2007-02-02 Don Allingham <don@gramps-project.org>
* src/Editors/_EditFamily.py (EditFamily.check_for_family_change): update on data change from family-update signal svn: r8031
This commit is contained in:
parent
d3215c17a4
commit
c408c4582e
@ -1,3 +1,7 @@
|
|||||||
|
2007-02-02 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Editors/_EditFamily.py (EditFamily.check_for_family_change): update on data change
|
||||||
|
from family-update signal
|
||||||
|
|
||||||
2007-02-02 Alex Roitman <shura@gramps-project.org>
|
2007-02-02 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/plugins/WriteCD.py: Properly encode URI.
|
* src/plugins/WriteCD.py: Properly encode URI.
|
||||||
|
|
||||||
|
@ -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,6 @@ 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('person-delete', self.check_for_change)
|
|
||||||
self._add_db_signal('person-rebuild', self.reload_people)
|
|
||||||
self._add_db_signal('family-update', self.check_for_family_change)
|
self._add_db_signal('family-update', self.check_for_family_change)
|
||||||
self._add_db_signal('family-delete', self.check_for_close)
|
self._add_db_signal('family-delete', self.check_for_close)
|
||||||
|
|
||||||
@ -409,23 +406,24 @@ class EditFamily(EditPrimary):
|
|||||||
if self.obj.get_handle() in handles:
|
if self.obj.get_handle() in handles:
|
||||||
self._do_close()
|
self._do_close()
|
||||||
|
|
||||||
def check_for_change(self, handles):
|
def check_for_family_change(self, handles):
|
||||||
print self.obj.get_handle() in handles
|
|
||||||
|
|
||||||
def check_for_change(self,handles):
|
# check to see if the handle matches the current object
|
||||||
|
if self.obj.get_handle() in handles:
|
||||||
chandles = set([ c.ref for c in self.obj.get_child_ref_list() if c ])
|
|
||||||
for node in handles:
|
self.obj = self.dbstate.db.get_family_from_handle(self.obj.get_handle())
|
||||||
if node == self.obj.get_father_handle():
|
self.reload_people()
|
||||||
self.obj.set_father_handle(None)
|
self.event_embed.rebuild()
|
||||||
self.reload_people()
|
self.source_embed.rebuild()
|
||||||
elif node == self.obj.get_mother_handle():
|
self.attr_embed.data = self.obj.get_attribute_list()
|
||||||
self.obj.set_mother_handle(None)
|
self.attr_embed.rebuild()
|
||||||
self.reload_people()
|
self.lds_embed.data = self.obj.get_lds_ord_list()
|
||||||
elif node in chandles:
|
self.lds_embed.rebuild()
|
||||||
new_list = [ c for c in self.obj.get_child_ref_list() if c.ref != node ]
|
|
||||||
self.obj.set_child_ref_list(new_list)
|
QuestionDialog.WarningDialog(
|
||||||
self.reload_people()
|
_("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()
|
||||||
@ -537,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,
|
||||||
@ -560,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()
|
||||||
@ -691,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 '
|
||||||
@ -787,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
|
||||||
|
|
||||||
|
|
||||||
@ -835,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()
|
||||||
|
Loading…
Reference in New Issue
Block a user