2006-09-12 Don Allingham <don@gramps-project.org>

* src/DataViews/_RelationView.py: provide a waring if a broken
	family is detected
	* src/plugins/Check.py: Don't remove families with no parents 
	unless no children exist



svn: r7321
This commit is contained in:
Don Allingham 2006-09-13 02:57:45 +00:00
parent 86ba2f1338
commit 43fc029947
3 changed files with 26 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2006-09-12 Don Allingham <don@gramps-project.org>
* src/DataViews/_RelationView.py: provide a waring if a broken
family is detected
* src/plugins/Check.py: Don't remove families with no parents
unless no children exist
2006-09-12 Alex Roitman <shura@gramps-project.org> 2006-09-12 Alex Roitman <shura@gramps-project.org>
* src/plugins/TestcaseGenerator.py (fill_object): Use integer * src/plugins/TestcaseGenerator.py (fill_object): Use integer
confidence level; (generate_date_tests): Remove invalid dates. confidence level; (generate_date_tests): Remove invalid dates.

View File

@ -723,20 +723,30 @@ class RelationshipView(PageView.PersonNavView):
if dobj: if dobj:
if pname: if pname:
self.write_data(vbox, _('%(event_type)s: %(date)s in %(place)s') % self.write_data(
vbox, _('%(event_type)s: %(date)s in %(place)s') %
value, start_col, stop_col) value, start_col, stop_col)
else: else:
self.write_data(vbox, _('%(event_type)s: %(date)s') % value, self.write_data(
vbox, _('%(event_type)s: %(date)s') % value,
start_col, stop_col) start_col, stop_col)
elif pname: elif pname:
self.write_data(vbox, _('%(event_type)s: %(place)s') % value, self.write_data(
vbox, _('%(event_type)s: %(place)s') % value,
start_col, stop_col) start_col, stop_col)
else: else:
self.write_data(vbox, _('%(event_type)s:') % value, self.write_data(
start_col, stop_col) vbox, _('%(event_type)s:') % value, start_col, stop_col)
def write_family(self, family_handle): def write_family(self, family_handle):
family = self.dbstate.db.get_family_from_handle(family_handle) family = self.dbstate.db.get_family_from_handle(family_handle)
if family == None:
from QuestionDialog import WarningDialog
WarningDialog(
_('Broken family detected'),
_('Please run the Check and Repair Database tool'))
return
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if self.dbstate.active.handle == father_handle: if self.dbstate.active.handle == father_handle:

View File

@ -514,24 +514,10 @@ class CheckIntegrity:
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if not father_handle and not mother_handle: if not father_handle and not mother_handle and \
len(family.get_child_ref_list()) == 0:
self.empty_family.append(family_id) self.empty_family.append(family_id)
self.delete_empty_family(family_handle) self.delete_empty_family(family_handle)
continue
elif not father_handle and len(family.get_child_ref_list()) == 0:
person = self.db.get_person_from_handle(mother_handle)
person.remove_family_handle(family_handle)
self.db.commit_person(person,self.trans)
self.db.remove_family(family_handle,self.trans)
self.empty_family.append(family_id)
continue
elif not mother_handle and len(family.get_child_ref_list()) == 0:
person = self.db.get_person_from_handle(father_handle)
person.remove_family_handle(family_handle)
self.db.commit_person(person,self.trans)
self.db.remove_family(family_handle,self.trans)
self.empty_family.append(family_id)
continue
def delete_empty_family(self,family_handle): def delete_empty_family(self,family_handle):
for key in self.db.get_person_handles(sort_handles=False): for key in self.db.get_person_handles(sort_handles=False):