Improved integrity check, fix parent lists when no active parents

svn: r294
This commit is contained in:
Don Allingham 2001-08-05 19:11:26 +00:00
parent 1afe1d5a02
commit 541f9bbb11
3 changed files with 38 additions and 8 deletions

View File

@ -589,8 +589,8 @@ def on_choose_parents_clicked(obj):
family_window.get_widget("frel").set_text(_(f[2])) family_window.get_widget("frel").set_text(_(f[2]))
break break
else: else:
family_window.get_widget("mrel").set_text(_("Unknown")) family_window.get_widget("mrel").set_text(_("Birth"))
family_window.get_widget("frel").set_text(_("Unknown")) family_window.get_widget("frel").set_text(_("Birth"))
fcombo = family_window.get_widget("prel_combo") fcombo = family_window.get_widget("prel_combo")
prel = family_window.get_widget("prel") prel = family_window.get_widget("prel")
@ -610,6 +610,8 @@ def on_choose_parents_clicked(obj):
family_window.get_widget("chooseTitle").set_text(text) family_window.get_widget("chooseTitle").set_text(text)
if active_parents: if active_parents:
prel.set_text(active_parents.getRelationship()) prel.set_text(active_parents.getRelationship())
else:
on_prel_changed(prel)
familyDialog.show() familyDialog.show()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -85,6 +85,7 @@ class CheckIntegrity:
if family_type[0] == family: if family_type[0] == family:
break break
else: else:
family.removeChild(child)
self.broken_links.append((child,family)) self.broken_links.append((child,family))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -140,6 +141,8 @@ class CheckIntegrity:
mother = family.getMother() mother = family.getMother()
type = family.getRelationship() type = family.getRelationship()
if not father or not mother:
continue
if type != "Partners": if type != "Partners":
if father.getGender() == mother.getGender(): if father.getGender() == mother.getGender():
family.setRelationship("Partners") family.setRelationship("Partners")
@ -176,10 +179,24 @@ class CheckIntegrity:
return return
text = "" text = ""
if blink > 0:
if blink == 1: if blink == 1:
text = text + _("1 broken family link was found\n") text = text + _("1 broken family link was fixed\n")
elif blink > 1: else:
text = text + _("%d broken family links were found\n") % blink text = text + _("%d broken family links were found\n") % blink
for c in self.broken_links:
cn = c[0].getPrimaryName().getName()
f = c[1].getFather()
m = c[1].getMother()
if f and m:
pn = _("%s and %s") % (f.getPrimaryName().getName(),\
m.getPrimaryName().getName())
elif f:
pn = f.getPrimaryName().getName()
else:
pn = m.getPrimaryName().getName()
text = text + '\t' + \
_("%s was removed from the family of %s\n") % (cn,pn)
if efam == 1: if efam == 1:
text = text + _("1 empty family was found\n") text = text + _("1 empty family was found\n")
elif efam > 1: elif efam > 1:
@ -197,7 +214,18 @@ class CheckIntegrity:
elif pphotos > 1: elif pphotos > 1:
text = text + _("%d broken personal images were found\n") % pphotos text = text + _("%d broken personal images were found\n") % pphotos
GnomeWarningDialog(string.strip(text)) base = os.path.dirname(__file__)
glade_file = base + os.sep + "summary.glade"
topDialog = GladeXML(glade_file,"summary")
topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
})
title = _("Check Integrity")
top = topDialog.get_widget("summary")
textwindow = topDialog.get_widget("textwindow")
topDialog.get_widget("summaryTitle").set_text(title)
textwindow.show_string(text)
top.show()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -90,7 +90,7 @@
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>summaryTitle</name> <name>summaryTitle</name>
<width>400</width> <width>500</width>
<height>16</height> <height>16</height>
<label>Database Summary</label> <label>Database Summary</label>
<justify>GTK_JUSTIFY_CENTER</justify> <justify>GTK_JUSTIFY_CENTER</justify>