* src/AddSpouse.py (select_spouse_clicked): Display warning and

provide a way to override when trying to add child/parent as a spouse.


svn: r4612
This commit is contained in:
Alex Roitman 2005-05-18 04:53:28 +00:00
parent 3182ef4191
commit 76fe79a9c0
2 changed files with 27 additions and 11 deletions

View File

@ -7,6 +7,9 @@
* src/GenericFilter.py: Support existing custom_filters.xml files * src/GenericFilter.py: Support existing custom_filters.xml files
by adding an old2new mapping for names. by adding an old2new mapping for names.
* src/AddSpouse.py (select_spouse_clicked): Display warning and
provide a way to override when trying to add child/parent as a spouse.
2005-05-17 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-05-17 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/ImportGeneWeb.py (decode): Decode characters and named * src/plugins/ImportGeneWeb.py (decode): Decode characters and named
entities. Because gramps is not web browser based we can simply use entities. Because gramps is not web browser based we can simply use

View File

@ -57,7 +57,7 @@ import DateHandler
import Marriage import Marriage
import NameDisplay import NameDisplay
import GenericFilter import GenericFilter
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog, QuestionDialog2
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -114,7 +114,8 @@ class AddSpouse:
name = NameDisplay.displayer.display(person) name = NameDisplay.displayer.display(person)
title = _("Choose Spouse/Partner of %s") % name title = _("Choose Spouse/Partner of %s") % name
Utils.set_titles(self.glade.get_widget('spouseDialog'), self.window = self.glade.get_widget('spouseDialog')
Utils.set_titles(self.window,
self.glade.get_widget('title'),title, self.glade.get_widget('title'),title,
_('Choose Spouse/Partner')) _('Choose Spouse/Partner'))
@ -254,14 +255,20 @@ class AddSpouse:
_("A person cannot be linked as his/her spouse")) _("A person cannot be linked as his/her spouse"))
return return
# don't do anything if adding a parent # display warning if adding a parent
for (family_handle,frel,mrel) in self.person.get_parent_family_handle_list(): for (family_handle,frel,mrel) in self.person.get_parent_family_handle_list():
family = self.db.get_family_from_handle(family_handle) family = self.db.get_family_from_handle(family_handle)
if spouse_id in [family.get_mother_handle(),family.get_father_handle()]: if spouse_id in [family.get_mother_handle(),family.get_father_handle()]:
ErrorDialog(_("Error adding a spouse"), dialog = QuestionDialog2(
_("A person cannot be linked as his/her " _("Spouse is a parent"),
"child's spouse")) _("The person selected as a spouse is a parent of the "
return "active person. Usually, this is a mistake. You may "
"choose either to proceed with adding a spouse, or to "
"return to the Choose Spouse dialog to fix the problem."),
_("Proceed with adding"), _("Return to dialog"),
self.window)
if not dialog.run():
return
# don't do anything if the marriage already exists # don't do anything if the marriage already exists
for f in self.person.get_family_handle_list(): for f in self.person.get_family_handle_list():
@ -273,10 +280,16 @@ class AddSpouse:
_("The spouse is already present in this family")) _("The spouse is already present in this family"))
return return
if spouse_id in fam.get_child_handle_list(): if spouse_id in fam.get_child_handle_list():
ErrorDialog(_("Error adding a spouse"), dialog = QuestionDialog2(
_("A person cannot be linked as his/her " _("Spouse is a child"),
"parent's spouse")) _("The person selected as a spouse is a child of the "
return "active person. Usually, this is a mistake. You may "
"choose either to proceed with adding a spouse, or to "
"return to the Choose Spouse dialog to fix the problem."),
_("Proceed with adding"), _("Return to dialog"),
self.window)
if not dialog.run():
return
trans = self.db.transaction_begin() trans = self.db.transaction_begin()