Fixed parent/child relationships on deletion of spouse
svn: r281
This commit is contained in:
parent
c6fe293ef1
commit
a8e7c9e8a0
@ -5394,7 +5394,7 @@ Unknown
|
|||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkCombo</class>
|
<class>GtkCombo</class>
|
||||||
<name>combo1</name>
|
<name>mcombo</name>
|
||||||
<value_in_list>True</value_in_list>
|
<value_in_list>True</value_in_list>
|
||||||
<ok_if_empty>False</ok_if_empty>
|
<ok_if_empty>False</ok_if_empty>
|
||||||
<case_sensitive>True</case_sensitive>
|
<case_sensitive>True</case_sensitive>
|
||||||
@ -5479,7 +5479,7 @@ Unknown
|
|||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkCombo</class>
|
<class>GtkCombo</class>
|
||||||
<name>combo2</name>
|
<name>fcombo</name>
|
||||||
<value_in_list>True</value_in_list>
|
<value_in_list>True</value_in_list>
|
||||||
<ok_if_empty>False</ok_if_empty>
|
<ok_if_empty>False</ok_if_empty>
|
||||||
<case_sensitive>True</case_sensitive>
|
<case_sensitive>True</case_sensitive>
|
||||||
|
@ -212,11 +212,33 @@ def on_contents_activate(obj):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_remove_child_clicked(obj):
|
def on_remove_child_clicked(obj):
|
||||||
|
global active_family
|
||||||
|
|
||||||
if not active_family or not active_child:
|
if not active_family or not active_child:
|
||||||
return
|
return
|
||||||
|
|
||||||
active_family.removeChild(active_child)
|
active_family.removeChild(active_child)
|
||||||
active_child.setMainFamily(None)
|
active_child.setMainFamily(None)
|
||||||
|
if len(active_family.getChildList()) == 0:
|
||||||
|
if active_family.getFather() == None:
|
||||||
|
p = active_family.getMother()
|
||||||
|
p.removeFamily(active_family)
|
||||||
|
database.deleteFamily(active_family)
|
||||||
|
flist = active_person.getFamilyList()
|
||||||
|
if len(flist) > 0:
|
||||||
|
active_family = flist[0]
|
||||||
|
else:
|
||||||
|
active_family = None
|
||||||
|
elif active_family.getMother() == None:
|
||||||
|
p = active_family.getFather()
|
||||||
|
p.removeFamily(active_family)
|
||||||
|
database.deleteFamily(active_family)
|
||||||
|
flist = active_person.getFamilyList()
|
||||||
|
if len(flist) > 0:
|
||||||
|
active_family = flist[0]
|
||||||
|
else:
|
||||||
|
active_family = None
|
||||||
|
|
||||||
utils.modified()
|
utils.modified()
|
||||||
load_family()
|
load_family()
|
||||||
|
|
||||||
@ -323,11 +345,11 @@ def redraw_child_list(filter):
|
|||||||
slist.append(c)
|
slist.append(c)
|
||||||
|
|
||||||
for person in person_list:
|
for person in person_list:
|
||||||
if person.getMainFamily() == active_person.getMainFamily():
|
|
||||||
continue
|
|
||||||
if person in slist:
|
|
||||||
continue
|
|
||||||
if filter:
|
if filter:
|
||||||
|
if person.getMainFamily() == active_person.getMainFamily():
|
||||||
|
continue
|
||||||
|
if person in slist:
|
||||||
|
continue
|
||||||
if person.getMainFamily() != None:
|
if person.getMainFamily() != None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -400,15 +422,27 @@ def on_add_new_child_clicked(obj):
|
|||||||
else:
|
else:
|
||||||
surname = ""
|
surname = ""
|
||||||
|
|
||||||
father = active_family.getFather()
|
if active_family:
|
||||||
if father != None:
|
father = active_family.getFather()
|
||||||
fname = father.getPrimaryName().getName()
|
if father != None:
|
||||||
newChildWindow.get_widget("flabel").set_text(_("Relationship to %s") % fname)
|
fname = father.getPrimaryName().getName()
|
||||||
|
label = _("Relationship to %s") % fname
|
||||||
|
newChildWindow.get_widget("flabel").set_text(label)
|
||||||
|
|
||||||
mother = active_family.getMother()
|
mother = active_family.getMother()
|
||||||
if mother != None:
|
if mother != None:
|
||||||
mname = mother.getPrimaryName().getName()
|
mname = mother.getPrimaryName().getName()
|
||||||
newChildWindow.get_widget("mlabel").set_text(_("Relationship to %s") % mname)
|
label = _("Relationship to %s") % mname
|
||||||
|
newChildWindow.get_widget("mlabel").set_text(label)
|
||||||
|
else:
|
||||||
|
fname = active_person.getPrimaryName().getName()
|
||||||
|
label = _("Relationship to %s") % fname
|
||||||
|
if active_person.getGender() == Person.male:
|
||||||
|
newChildWindow.get_widget("flabel").set_text(label)
|
||||||
|
newChildWindow.get_widget("mcombo").set_sensitive(0)
|
||||||
|
else:
|
||||||
|
newChildWindow.get_widget("mlabel").set_text(label)
|
||||||
|
newChildWindow.get_widget("fcombo").set_sensitive(0)
|
||||||
|
|
||||||
newChildWindow.get_widget("childSurname").set_text(surname)
|
newChildWindow.get_widget("childSurname").set_text(surname)
|
||||||
newChildWindow.get_widget("addChild").show()
|
newChildWindow.get_widget("addChild").show()
|
||||||
@ -1306,17 +1340,18 @@ def on_delete_parents_clicked(obj):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def delete_spouse():
|
def delete_spouse():
|
||||||
import Check
|
|
||||||
global active_family
|
global active_family
|
||||||
|
|
||||||
if active_person == active_family.getFather():
|
if active_person == active_family.getFather():
|
||||||
person = active_family.getMother()
|
person = active_family.getMother()
|
||||||
|
active_family.setMother(None)
|
||||||
else:
|
else:
|
||||||
person = active_family.getFather()
|
person = active_family.getFather()
|
||||||
|
active_family.setFather(None)
|
||||||
|
|
||||||
if person:
|
if person:
|
||||||
person.removeFamily(active_family)
|
person.removeFamily(active_family)
|
||||||
|
|
||||||
if len(active_family.getChildList()) == 0:
|
if len(active_family.getChildList()) == 0:
|
||||||
active_person.removeFamily(active_family)
|
active_person.removeFamily(active_family)
|
||||||
database.deleteFamily(active_family)
|
database.deleteFamily(active_family)
|
||||||
@ -1324,16 +1359,10 @@ def delete_spouse():
|
|||||||
active_family = active_person.getFamilyIndex(0)
|
active_family = active_person.getFamilyIndex(0)
|
||||||
else:
|
else:
|
||||||
active_family = None
|
active_family = None
|
||||||
else:
|
|
||||||
active_family.setMother(None)
|
|
||||||
|
|
||||||
load_family()
|
load_family()
|
||||||
utils.modified()
|
utils.modified()
|
||||||
|
|
||||||
checker = Check.CheckIntegrity(database)
|
|
||||||
checker.cleanup_empty_families(1)
|
|
||||||
checker.check_for_broken_family_links()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
from RelLib import *
|
from RelLib import *
|
||||||
from Date import *
|
from Date import *
|
||||||
|
import string
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -29,7 +30,7 @@ from Date import *
|
|||||||
def build_sort_name(person):
|
def build_sort_name(person):
|
||||||
n = person[0]
|
n = person[0]
|
||||||
nm = "%-25s%-30s%s" % (n.Surname,n.FirstName,n.Suffix)
|
nm = "%-25s%-30s%s" % (n.Surname,n.FirstName,n.Suffix)
|
||||||
return (nm,person)
|
return (string.upper(nm),person)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user