diff --git a/gramps/src/MergeData.py b/gramps/src/MergeData.py index fb9405809..c5f038a2a 100644 --- a/gramps/src/MergeData.py +++ b/gramps/src/MergeData.py @@ -282,7 +282,7 @@ class MergePeople: self.p1.setNote(old_note + self.p2.getNote()) del self.db.getPersonMap()[self.p2.getId()] - self.update(self.p2) + self.update(self.p1,self.p2) utils.destroy_passed_object(self.top) #--------------------------------------------------------------------- diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index f5e33ba99..5b99bfe75 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -164,7 +164,7 @@ def on_merge_activate(obj): import MergeData p1 = person_list.get_row_data(person_list.selection[0]) p2 = person_list.get_row_data(person_list.selection[1]) - MergeData.MergePeople(database,p1[0],p2[0],remove_from_person_list) + MergeData.MergePeople(database,p1[0],p2[0],merge_update) elif page == 4: if len(place_list.selection) != 2: msg = _("Exactly two places must be selected to perform a merge") @@ -883,6 +883,9 @@ def remove_from_person_list(person): (active_person,alt) = person_list.get_row_data(row) person_list.thaw() +def merge_update(p1,p2): + remove_from_person_list(p2) + #------------------------------------------------------------------------- # # diff --git a/gramps/src/mergedata.glade b/gramps/src/mergedata.glade index 4855fec72..a14e35964 100644 --- a/gramps/src/mergedata.glade +++ b/gramps/src/mergedata.glade @@ -13,30 +13,42 @@ - GtkDialog - merge - Gramps - Merge People + GnomeDialog + merge_places + 400 + Gramps - Merge Places GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE - False - True + True + False True False + False + False GtkVBox - Dialog:vbox - dialog-vbox1 + GnomeDialog:vbox + dialog-vbox2 False - 0 + 8 + + 4 + True + True + - GtkHBox - Dialog:action_area - dialog-action_area1 - 10 - True - 5 + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + 400 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 0 False @@ -45,14 +57,80 @@ - GtkHButtonBox - hbuttonbox1 - GTK_BUTTONBOX_END - 30 - 85 - 27 - 7 - 0 + GtkButton + button7 + True + True + + clicked + on_merge_places_clicked + merge_places + Tue, 23 Oct 2001 23:26:52 GMT + + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button9 + True + True + + clicked + destroy_passed_object + merge_places + Tue, 23 Oct 2001 23:00:28 GMT + + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkVBox + vbox2 + False + 0 + + 0 + True + True + + + + GtkLabel + label56 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkHSeparator + hseparator6 + + 10 + False + True + + + + + GtkTable + table5 + 3 + 2 + False + 0 + 0 0 True @@ -60,49 +138,239 @@ - GtkButton - merge_btn - True + GtkEntry + title3_text True - - clicked - on_merge_clicked - merge - Wed, 21 Feb 2001 00:49:36 GMT - - - GTK_RELIEF_NORMAL + True + True + 0 + + + 1 + 2 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + - GtkButton - next_btn - True - True - - clicked - on_next_clicked - merge - Tue, 20 Feb 2001 23:29:49 GMT - - - GTK_RELIEF_NORMAL + GtkLabel + title1_text + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + - GtkButton - button4 - True - True - - clicked - destroy_passed_object - merge - Tue, 20 Feb 2001 23:27:39 GMT - - GNOME_STOCK_BUTTON_CANCEL - GTK_RELIEF_NORMAL + GtkLabel + title2_text + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + GtkRadioButton + title1 + True + + True + True + title + + 0 + 1 + 0 + 1 + 5 + 5 + False + False + False + False + True + False + + + + + GtkRadioButton + title2 + True + + False + True + title + + 0 + 1 + 1 + 2 + 5 + 5 + False + False + False + False + True + False + + + + + GtkRadioButton + title3 + True + + False + True + title + + 0 + 1 + 2 + 3 + 5 + 5 + False + False + False + False + True + False + + + + + + + + + GnomeDialog + merge + Gramps - Merge People + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox3 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area3 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button12 + True + True + + clicked + on_merge_clicked + merge + Thu, 25 Oct 2001 17:00:40 GMT + + + + + + GtkButton + button13 + True + True + + clicked + on_next_clicked + merge + Thu, 25 Oct 2001 17:00:18 GMT + + + + + + GtkButton + button14 + True + True + + clicked + destroy_passed_object + merge + Thu, 25 Oct 2001 16:59:59 GMT + + GNOME_STOCK_BUTTON_CANCEL @@ -1488,281 +1756,4 @@ - - GnomeDialog - merge_places - 400 - Gramps - Merge Places - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox2 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area2 - 400 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button7 - True - True - - clicked - on_merge_places_clicked - merge_places - Tue, 23 Oct 2001 23:26:52 GMT - - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button9 - True - True - - clicked - destroy_passed_object - merge_places - Tue, 23 Oct 2001 23:00:28 GMT - - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - vbox2 - False - 0 - - 0 - True - True - - - - GtkLabel - label56 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkHSeparator - hseparator6 - - 10 - False - True - - - - - GtkTable - table5 - 3 - 2 - False - 0 - 0 - - 0 - True - True - - - - GtkEntry - title3_text - True - True - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - title1_text - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - title2_text - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkRadioButton - title1 - True - - True - True - title - - 0 - 1 - 0 - 1 - 5 - 5 - False - False - False - False - True - False - - - - - GtkRadioButton - title2 - True - - False - True - title - - 0 - 1 - 1 - 2 - 5 - 5 - False - False - False - False - True - False - - - - - GtkRadioButton - title3 - True - - False - True - title - - 0 - 1 - 2 - 3 - 5 - 5 - False - False - False - False - True - False - - - - - - - diff --git a/gramps/src/plugins/Check.py b/gramps/src/plugins/Check.py index 9b3793c3d..bbbea3c37 100644 --- a/gramps/src/plugins/Check.py +++ b/gramps/src/plugins/Check.py @@ -63,8 +63,7 @@ class CheckIntegrity: #------------------------------------------------------------------------- def __init__(self,db): self.db = db - self.bad_family_photo = [] - self.bad_person_photo = [] + self.bad_photo = [] self.empty_family = [] self.broken_links = [] self.fam_rel = [] @@ -95,15 +94,9 @@ class CheckIntegrity: # #------------------------------------------------------------------------- def cleanup_missing_photos(self): - for family in self.db.getFamilyMap().values(): - for photo in family.getPhotoList(): - if not os.path.isfile(photo.getPath()): - self.bad_family_photo.append(family,photo) - - for person in self.db.getPersonMap().values(): - for photo in person.getPhotoList(): - if not os.path.isfile(photo.getPath()): - self.bad_person_photo.append(person,photo) + for photo in self.db.getObjectMap().values(): + if not os.path.isfile(photo.getPath()): + self.bad_photo.append(photo) #------------------------------------------------------------------------- # @@ -166,13 +159,12 @@ class CheckIntegrity: # #------------------------------------------------------------------------- def report(self): - fphotos = len(self.bad_family_photo) - pphotos = len(self.bad_person_photo) + photos = len(self.bad_photo) efam = len(self.empty_family) blink = len(self.broken_links) rel = len(self.fam_rel) - errors = blink + efam + pphotos + fphotos + rel + errors = blink + efam + photos + rel if errors == 0: GnomeOkDialog(_("No errors were found")) @@ -205,15 +197,11 @@ class CheckIntegrity: text = text + _("1 corrupted family relationship fixed\n") elif rel > 1: text = text + _("%d corrupted family relationship fixed\n") % rel - if fphotos == 1: - text = text + _("1 broken family image was found\n") - elif fphotos > 1: - text = text + _("%d broken family images were found\n") % fphotos - if pphotos == 1: - text = text + _("1 broken personal image was found\n") - elif pphotos > 1: - text = text + _("%d broken personal images were found\n") % pphotos - + if photos == 1: + text = text + _("1 media object was referenced, but not found\n") + elif photos > 1: + text = text + _("%d media objects were referenced, but not found\n") % photos + base = os.path.dirname(__file__) glade_file = base + os.sep + "summary.glade" topDialog = GladeXML(glade_file,"summary") diff --git a/gramps/src/plugins/Merge.py b/gramps/src/plugins/Merge.py index 51dc4bd3a..18d558f16 100644 --- a/gramps/src/plugins/Merge.py +++ b/gramps/src/plugins/Merge.py @@ -23,17 +23,19 @@ import RelLib import utils import soundex -import Check import intl +import Config _ = intl.gettext import string import os +import MergeData from gtk import * from gnome.ui import * from libglade import * + #------------------------------------------------------------------------- # # @@ -48,13 +50,7 @@ def is_initial(name): else: return name[0] in string.uppercase -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- def ancestors_of(p1,list): - if p1 == None: return list.append(p1) @@ -63,17 +59,6 @@ def ancestors_of(p1,list): ancestors_of(f1.getFather(),list) ancestors_of(f1.getMother(),list) -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- -def get_name_obj(p1): - if p1 == None: - return None - else: - return p1.getPrimaryName() - #------------------------------------------------------------------------- # # @@ -195,6 +180,11 @@ class Merge: index = index + 1 if p1 == p2: continue + if self.map.has_key(p2): + (v,c) = self.map[p2] + if v == p1: + continue + chance = self.compare_people(p1,p2) if chance >= thresh: if self.map.has_key(p1): @@ -208,6 +198,7 @@ class Merge: self.list.sort(by_id) self.length = len(self.list) self.topWin.destroy() + self.dellist = {} #--------------------------------------------------------------------- # @@ -215,422 +206,57 @@ class Merge: # #--------------------------------------------------------------------- def show(self): - self.topDialog = GladeXML(self.glade_file,"merge") - self.merge_btn = self.topDialog.get_widget("merge_btn") - self.next_btn = self.topDialog.get_widget("next_btn") - self.altname = self.topDialog.get_widget("altname") - - self.topDialog.signal_autoconnect({ - "on_next_clicked" : self.on_next_clicked, - "on_merge_clicked" : self.on_merge_clicked, - "destroy_passed_object" : self.update_and_destroy + top = GladeXML(self.glade_file,"mergelist") + self.window = top.get_widget("mergelist") + self.mlist = top.get_widget("mlist") + top.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_do_merge_clicked" : self.on_do_merge_clicked, }) + self.redraw() - if len(self.map) > 0: - top = self.topDialog.get_widget("merge") - top.show() - self.load_next() + def redraw(self): + list = [] + for p1 in self.map.keys(): + if self.dellist.has_key(p1): + continue + (p2,c) = self.map[p1] + if self.dellist.has_key(p2): + p2 = self.dellist[p2] + if p1 == p2: + continue + list.append(c,p1,p2) + list.sort() + list.reverse() + + index = 0 + self.mlist.freeze() + self.mlist.clear() + for (c,p1,p2) in list: + c = "%5.2f" % c + self.mlist.append([c, name_of(p1), name_of(p2)]) + self.mlist.set_row_data(index,(p1,p2)) + index = index + 1 + self.mlist.thaw() + + def on_do_merge_clicked(self,obj): + if len(self.mlist.selection) != 1: + return + row = self.mlist.selection[0] + (p1,p2) = self.mlist.get_row_data(row) + MergeData.MergePeople(self.db,p1,p2,self.on_update) + + def on_update(self,p1,p2): + self.dellist[p2] = p1 + for key in self.dellist.keys(): + if self.dellist[key] == p2: + self.dellist[key] = p1 + self.redraw() - def on_merge_clicked(self,obj): - self.merge() - - def on_next_clicked(self,obj): - self.load_next() - def update_and_destroy(self,obj): self.update(1) utils.destroy_passed_object(obj) - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- - def merge(self): - self.merge_btn.set_sensitive(0) - utils.modified() - if self.topDialog.get_widget("bname2").get_active(): - if self.altname.get_active(): - self.mergee.addAlternateName(self.mergee.getPrimaryName()) - self.mergee.setPrimaryName(self.merger.getPrimaryName()) - else: - if self.altname.get_active(): - self.mergee.addAlternateName(self.merger.getPrimaryName()) - if self.topDialog.get_widget("bbirth2").get_active(): - self.mergee.getBirth().setDate(self.merger.getBirth().getDate()) - if self.topDialog.get_widget("bplace2").get_active(): - self.mergee.getBirth().setPlace(self.merger.getBirth().getPlace()) - if self.topDialog.get_widget("death2").get_active(): - self.mergee.getDeath().setDate(self.merger.getDeath().getDate()) - if self.topDialog.get_widget("dplace2").get_active(): - self.mergee.getDeath().setPlace(self.merger.getDeath().getPlace()) - - if self.topDialog.get_widget("bfather2").get_active(): - orig_family = self.mergee.getMainFamily() - if orig_family: - orig_family.removeChild(self.mergee) - - source_family = self.merger.getMainFamily() - self.mergee.setMainFamily(source_family) - - if source_family: - if self.merger in source_family.getChildList(): - source_family.removeChild(self.merger) - if self.mergee not in source_family.getChildList(): - source_family.addChild(self.mergee) - else: - source_family = self.merger.getMainFamily() - if source_family: - source_family.removeChild(self.merger) - self.merger.setMainFamily(None) - - self.merge_families() - - for event in self.merger.getEventList(): - self.mergee.addEvent(event) - for photo in self.merger.getPhotoList(): - self.mergee.addPhoto(photo) - for name in self.merger.getAlternateNames(): - self.mergee.addAlternateName(name) - if self.mergee.getNickName() == "": - self.mergee.setNickName(self.merger.getNickName()) - if self.merger.getNote() != "": - old_note = self.mergee.getNote() - if old_note: - old_note = old_note + "\n\n" - self.mergee.setNote(old_note + self.merger.getNote()) - - del self.db.getPersonMap()[self.merger.getId()] - - self.removed[self.merger] = self.mergee - self.removed[self.mergee] = self.mergee - - checker = Check.CheckIntegrity(self.db) - checker.cleanup_empty_families(1) - checker.check_for_broken_family_links() - self.load_next() - - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- - def find_family(self,family): - if self.mergee.getGender() == RelLib.Person.male: - mother = family.getMother() - father = self.mergee - else: - father = family.getFather() - mother = self.mergee - - for myfamily in self.family_list: - if myfamily.getFather() == father and \ - myfamily.getMother() == mother: - return myfamily - - return None - - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- - def merge_families(self): - - family_num = 0 - mylist = self.merger.getFamilyList()[:] - for src_family in mylist: - - family_num = family_num + 1 - - if not self.db.getFamilyMap().has_key(src_family.getId()): - continue - if src_family in self.mergee.getFamilyList(): - continue - - tgt_family = self.find_family(src_family) - - - # - # This is the case where a new family to be added to the - # mergee as a result of the merge already exists as a - # family. In this case, we need to remove the old source - # family (with the pre-merge identity of the mergee) from - # both the parents - # - if tgt_family in self.mergee.getFamilyList(): - if tgt_family.getFather() != None and \ - src_family in tgt_family.getFather().getFamilyList(): - tgt_family.getFather().removeFamily(src_family) - if tgt_family.getMother() != None and \ - src_family in tgt_family.getMother().getFamilyList(): - tgt_family.getMother().removeFamily(src_family) - - # copy children from source to target - - # delete the old source family - del self.db.getFamilyMap()[src_family.getId()] - - continue - - # - # This is the case where a new family to be added - # and it is not already in the list. - # - - if tgt_family: - - # tgt_family a duplicate family, transfer children from - # the merger family, and delete the family. Not sure - # what to do about marriage/divorce date/place yet. - - # transfer child to new family, alter children to - # point to the correct family - - for child in src_family.getChildList(): - if child not in tgt_family.getChildList(): - tgt_family.addChild(child) - if child.getMainFamily() == src_family: - child.setMainFamily(tgt_family) - else: - index = 0 - for fam in child.getAltFamilies(): - if fam == src_family: - child.getAltFamilies()[index] = tgt_family - index = index + 1 - - # add family events from the old to the new - for event in src_family.getEventList(): - tgt_family.addEvent(event) - - # change parents of the family to point to the new - # family - - if src_family.getFather(): - src_family.getFather().removeFamily(src_family) - src_family.getFather().addFamily(tgt_family) - - if src_family.getMother(): - src_family.getMother().removeFamily(src_family) - src_family.getMother().addFamily(tgt_family) - - del self.db.getFamilyMap()[src_family.getId()] - else: - self.remove_marriage(src_family,self.merger) - if src_family not in self.mergee.getFamilyList(): - self.mergee.addFamily(src_family) - if self.mergee.getGender() == RelLib.Person.male: - src_family.setFather(self.mergee) - else: - src_family.setMother(self.mergee) - - # a little debugging here - - for fam in self.db.getFamilyMap().values(): - name = self.merger.getPrimaryName().getName() - if self.merger in fam.getChildList(): - fam.removeChild(self.merger) - fam.addChild(self.mergee) - if self.merger == fam.getFather(): - fam.setFather(self.mergee) - if self.merger == fam.getMother(): - fam.setMother(self.mergee) - - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- - def remove_marriage(self,family,person): - if not person: - return - index = 0 - for fam in person.getFamilyList(): - if fam == family: - del person.getFamilyList()[index] - return - index = index + 1 - - #--------------------------------------------------------------------- - # - # - # - #--------------------------------------------------------------------- - def load_next(self): - - if self.length == 0: - return - - done = 0 - while not done: - person1 = self.list[self.index] - self.index = self.index + 1 - if self.index > len(self.list): - return - if self.removed.has_key(person1): - continue - (person2,val) = self.map[person1] - if self.removed.has_key(person2): - continue - done = 1 - - label_text = "Merge %d of %d" % (self.index,self.length) - self.topDialog.get_widget("progress").set_text(label_text) - f1 = person1.getMainFamily() - f2 = person2.getMainFamily() - - name1 = person1.getPrimaryName().getName() - death1 = person1.getDeath().getDate() - dplace1 = person1.getDeath().getPlaceName() - birth1 = person1.getBirth().getDate() - bplace1 = person1.getBirth().getPlaceName() - - name2 = person2.getPrimaryName().getName() - death2 = person2.getDeath().getDate() - dplace2 = person2.getDeath().getPlaceName() - birth2 = person2.getBirth().getDate() - bplace2 = person2.getBirth().getPlaceName() - - if f2 and not f1: - self.topDialog.get_widget("bfather2").set_active(1) - else: - self.topDialog.get_widget("bfather1").set_active(1) - - if f1 and f1.getFather(): - father1 = f1.getFather().getPrimaryName().getName() - else: - father1 = "" - - if f1 and f1.getMother(): - mother1 = f1.getMother().getPrimaryName().getName() - else: - mother1 = "" - - if f2 and f2.getFather(): - father2 = f2.getFather().getPrimaryName().getName() - else: - father2 = "" - - if f2 and f2.getMother(): - mother2 = f2.getMother().getPrimaryName().getName() - else: - mother2 = "" - - label1 = "%s (%s)" % (_("First Person"),person1.getId()) - label2 = "%s (%s)" % (_("Second Person"),person2.getId()) - - self.topDialog.get_widget("PersonFrame1").set_label(label1) - self.topDialog.get_widget("PersonFrame2").set_label(label2) - self.topDialog.get_widget("name1_text").set_text(name1) - self.topDialog.get_widget("name1_text").set_position(0) - self.topDialog.get_widget("name2_text").set_text(name2) - self.topDialog.get_widget("name2_text").set_position(0) - - self.topDialog.get_widget("bname1").set_active(1) - - self.topDialog.get_widget("birth1_text").set_text(birth1) - self.topDialog.get_widget("birth1_text").set_position(0) - self.topDialog.get_widget("birth2_text").set_text(birth2) - self.topDialog.get_widget("birth2_text").set_position(0) - if birth2 and not birth1: - self.topDialog.get_widget("bbirth2").set_active(1) - else: - self.topDialog.get_widget("bbirth1").set_active(1) - - self.topDialog.get_widget("bplace1_text").set_text(bplace1) - self.topDialog.get_widget("bplace1_text").set_position(0) - self.topDialog.get_widget("bplace2_text").set_text(bplace2) - self.topDialog.get_widget("bplace2_text").set_position(0) - if bplace2 and not bplace1: - self.topDialog.get_widget("bplace2").set_active(1) - else: - self.topDialog.get_widget("bplace1").set_active(1) - - self.topDialog.get_widget("death1_text").set_text(death1) - self.topDialog.get_widget("death1_text").set_position(0) - self.topDialog.get_widget("death2_text").set_text(death2) - self.topDialog.get_widget("death2_text").set_position(0) - if death2 and not death1: - self.topDialog.get_widget("death2").set_active(1) - else: - self.topDialog.get_widget("death1").set_active(1) - - self.topDialog.get_widget("dplace1_text").set_text(dplace1) - self.topDialog.get_widget("dplace1_text").set_position(0) - self.topDialog.get_widget("dplace2_text").set_text(dplace2) - self.topDialog.get_widget("dplace2_text").set_position(0) - if dplace2 and not dplace1: - self.topDialog.get_widget("dplace2").set_active(1) - else: - self.topDialog.get_widget("dplace1").set_active(1) - - self.topDialog.get_widget("father1").set_text(father1) - self.topDialog.get_widget("father1").set_position(0) - self.topDialog.get_widget("father2").set_text(father2) - self.topDialog.get_widget("father2").set_position(0) - self.topDialog.get_widget("mother1").set_text(mother1) - self.topDialog.get_widget("mother1").set_position(0) - self.topDialog.get_widget("mother2").set_text(mother2) - self.topDialog.get_widget("mother2").set_position(0) - - p1list = person1.getFamilyList() - p2list = person2.getFamilyList() - - length = min(len(p1list),3) - self.topDialog.get_widget("spouse1").clear() - for index in range(0,3): - if index < length and p1list[index]: - if person1.getGender() == RelLib.Person.male: - spouse = p1list[index].getMother() - x = p1list[index].getFather() - else: - spouse = p1list[index].getFather() - x = p1list[index].getMother() - - if spouse == None: - name = "unknown" - else: - name = spouse.getPrimaryName().getName() + \ - " (" + spouse.getId() + ")" - self.topDialog.get_widget("spouse1").append([name]) - - length = min(len(p2list),3) - self.topDialog.get_widget("spouse2").clear() - for index in range(0,3): - if index < length and p2list[index]: - if person2.getGender() == RelLib.Person.male: - spouse = p2list[index].getMother() - x = p2list[index].getFather() - else: - spouse = p2list[index].getFather() - x = p2list[index].getMother() - - if spouse == None: - name = "unknown" - else: - name = spouse.getPrimaryName().getName() + \ - " (" + spouse.getId() + ")" - self.topDialog.get_widget("spouse2").append([name]) - - self.mergee = person1 - self.merger = person2 - - self.topDialog.get_widget("chance").set_text(str(val)) - - if len(self.list) > self.index+1: - self.merge_btn.set_sensitive(1) - self.next_btn.set_sensitive(1) - else: - self.merge_btn.set_sensitive(0) - self.next_btn.set_sensitive(0) - - if name1 != name2: - self.altname.set_sensitive(1) - self.altname.set_active(1) - else: - self.altname.set_sensitive(0) - self.altname.set_active(0) - #--------------------------------------------------------------------- # # @@ -775,6 +401,9 @@ class Merge: # #--------------------------------------------------------------------- def place_match(self,p1,p2): + if p1 == p2: + return 1 + if p1 == None: name1 = "" else: @@ -908,6 +537,18 @@ class Merge: return chance + +def name_of(p): + if not p: + return "" + return "%s (%s)" % ( Config.nameof(p),p.getId()) + +def get_name_obj(person): + if person: + return person.getPrimaryName() + else: + return None + #------------------------------------------------------------------------- # # @@ -933,7 +574,7 @@ from Plugins import register_tool register_tool( runTool, - _("Merge people"), + _("Find possible duplicate people"), category=_("Database Processing"), description=_("Searches the entire database, looking for individual entries that may represent the same person.") ) diff --git a/gramps/src/plugins/merge.glade b/gramps/src/plugins/merge.glade index 0948de78b..f08e071e4 100644 --- a/gramps/src/plugins/merge.glade +++ b/gramps/src/plugins/merge.glade @@ -12,1528 +12,6 @@ True - - GtkDialog - merge - Gramps - Merge People - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - True - False - - - GtkVBox - Dialog:vbox - dialog-vbox1 - False - 0 - - - GtkHBox - Dialog:action_area - dialog-action_area1 - 10 - True - 5 - - 0 - False - True - GTK_PACK_END - - - - GtkHButtonBox - hbuttonbox1 - GTK_BUTTONBOX_END - 30 - 85 - 27 - 7 - 0 - - 0 - True - True - - - - GtkButton - merge_btn - True - True - - clicked - on_merge_clicked - merge - Wed, 21 Feb 2001 00:49:36 GMT - - - GTK_RELIEF_NORMAL - - - - GtkButton - next_btn - True - True - - clicked - on_next_clicked - merge - Tue, 20 Feb 2001 23:29:49 GMT - - GNOME_STOCK_BUTTON_NEXT - GTK_RELIEF_NORMAL - - - - GtkButton - button4 - True - True - - clicked - destroy_passed_object - merge - Tue, 20 Feb 2001 23:27:39 GMT - - GNOME_STOCK_BUTTON_CLOSE - GTK_RELIEF_NORMAL - - - - - - GtkVBox - vbox1 - 600 - False - 0 - - 0 - True - True - - - - GtkLabel - progress - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 10 - False - False - - - - - GtkHSeparator - hseparator1 - - 5 - False - True - - - - - GtkHBox - hbox1 - True - 0 - - 0 - True - True - - - - GtkFrame - PersonFrame1 - 300 - - 0 - GTK_SHADOW_ETCHED_IN - - 2 - True - True - - - - GtkTable - table3 - 10 - 3 - False - 0 - 2 - - - GtkRadioButton - bname1 - True - - False - True - name - - 2 - 3 - 0 - 1 - 0 - 0 - False - False - True - False - False - False - - - - - GtkLabel - label8 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label12 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label22 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 7 - 8 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label4 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label26 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False - - - - - GtkRadioButton - bfather1 - True - - False - True - father - - 2 - 3 - 6 - 7 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - dplace1 - True - - False - True - dplace - - 2 - 3 - 4 - 5 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - death1 - True - - True - True - death - - 2 - 3 - 3 - 4 - 0 - 0 - False - False - True - True - False - False - - - - - GtkRadioButton - bplace1 - True - - False - True - bplace - - 2 - 3 - 2 - 3 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - bbirth1 - True - - False - True - birth - - 2 - 3 - 1 - 2 - 0 - 0 - False - False - True - True - False - False - - - - - GtkEntry - name1_text - True - False - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - birth1_text - True - False - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - bplace1_text - True - False - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - death1_text - True - False - True - 0 - - - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - dplace1_text - True - False - True - 0 - - - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - father1 - True - False - True - 0 - - - 1 - 2 - 6 - 7 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - mother1 - True - False - True - 0 - - - 1 - 2 - 7 - 8 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label16 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 6 - 7 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHSeparator - hseparator2 - - 0 - 3 - 5 - 6 - 0 - 5 - False - False - False - False - True - True - - - - - GtkHSeparator - hseparator4 - - 0 - 3 - 8 - 9 - 0 - 5 - False - False - False - False - True - True - - - - - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 3 - 9 - 10 - 0 - 0 - False - False - False - False - True - True - - - - GtkCList - spouse1 - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label51 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 1 - 0 - 5 - 0 - - 0 - 1 - 9 - 10 - 0 - 0 - False - True - False - False - True - True - - - - - - - GtkFrame - PersonFrame2 - 300 - - 0 - GTK_SHADOW_ETCHED_IN - - 2 - True - True - - - - GtkTable - table4 - 10 - 3 - False - 0 - 2 - - - GtkRadioButton - bname2 - True - - False - True - name - - 2 - 3 - 0 - 1 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - death2 - True - - False - True - death - - 2 - 3 - 3 - 4 - 0 - 0 - False - False - True - False - False - False - - - - - GtkLabel - label13 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 7 - 8 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label5 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label27 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label9 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkRadioButton - bbirth2 - True - - False - True - birth - - 2 - 3 - 1 - 2 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - bplace2 - True - - False - True - bplace - - 2 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - False - False - - - - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False - - - - - GtkRadioButton - bfather2 - True - - False - True - father - - 2 - 3 - 6 - 7 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - dplace2 - True - - False - True - dplace - - 2 - 3 - 4 - 5 - 0 - 0 - False - False - True - False - False - False - - - - - GtkEntry - name2_text - True - False - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - birth2_text - True - False - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - bplace2_text - True - False - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - death2_text - True - False - True - 0 - - - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - dplace2_text - True - False - True - 0 - - - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - father2 - True - False - True - 0 - - - 1 - 2 - 6 - 7 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - mother2 - True - False - True - 0 - - - 1 - 2 - 7 - 8 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 1 - 0 - 5 - 0 - - 0 - 1 - 9 - 10 - 0 - 0 - False - True - False - False - True - True - - - - - GtkLabel - label19 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 6 - 7 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHSeparator - hseparator3 - - 0 - 3 - 5 - 6 - 0 - 5 - False - False - False - False - True - True - - - - - GtkHSeparator - hseparator5 - - 0 - 3 - 8 - 9 - 0 - 5 - False - False - False - False - True - True - - - - - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 3 - 9 - 10 - 0 - 0 - False - False - False - False - True - True - - - - GtkCList - spouse2 - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label50 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - - - GtkHBox - hbox7 - False - 0 - - 10 - False - True - - - - GtkLabel - label53 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - True - True - - - - - GtkCheckButton - altname - True - - False - True - - 0 - False - False - - - - - GtkLabel - label54 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - True - True - - - - - - GtkHSeparator - hseparator8 - - 0 - False - True - - - - - GtkHBox - hbox2 - True - 0 - - 0 - False - True - - - - GtkLabel - label41 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 0 - 5 - - 0 - False - True - - - - - GtkLabel - chance - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 5 - - 0 - False - True - - - - - - - GtkWindow message @@ -1638,30 +116,40 @@ - GtkDialog - dialog - Gramps - Merge People - GTK_WINDOW_DIALOG + GnomeDialog + mergelist + Gramps - Merge List + GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False - True + False True False + False + False GtkVBox - Dialog:vbox - dialog-vbox2 + GnomeDialog:vbox + dialog-vbox3 False - 0 + 8 + + 4 + True + True + - GtkHBox - Dialog:action_area - dialog-action_area2 - 10 - True - 5 + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area3 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 0 False @@ -1670,14 +158,78 @@ - GtkHButtonBox - hbuttonbox2 - GTK_BUTTONBOX_END - 30 - 85 - 27 - 7 - 0 + GtkButton + button7 + True + True + + clicked + on_do_merge_clicked + Thu, 25 Oct 2001 15:43:37 GMT + + + + + + GtkButton + button9 + True + True + + clicked + destroy_passed_object + mergelist + Thu, 25 Oct 2001 15:32:35 GMT + + GNOME_STOCK_BUTTON_CLOSE + + + + + GtkVBox + vbox5 + False + 0 + + 0 + True + True + + + + GtkLabel + label59 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkHSeparator + hseparator9 + + 10 + False + True + + + + + GtkScrolledWindow + scrolledwindow3 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS 0 True @@ -1685,40 +237,135 @@ - GtkButton - button5 - True + GtkCList + mlist + 600 + 300 True - - clicked - on_merge_ok_clicked - dialog - Tue, 13 Mar 2001 23:56:17 GMT - - GNOME_STOCK_BUTTON_OK - GTK_RELIEF_NORMAL - + 3 + 80,247,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN - - GtkButton - button6 - True - True - - clicked - destroy_passed_object - dialog - Tue, 13 Mar 2001 23:55:52 GMT - - GNOME_STOCK_BUTTON_CANCEL - GTK_RELIEF_NORMAL + + GtkLabel + CList:title + label56 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label57 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label58 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GnomeDialog + dialog + Gramps - Merge People + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox4 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area4 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button10 + True + True + + clicked + on_merge_ok_clicked + dialog + Thu, 25 Oct 2001 17:08:02 GMT + + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button12 + True + True + + clicked + destroy_passed_object + dialog + Thu, 25 Oct 2001 17:07:32 GMT + + GNOME_STOCK_BUTTON_CANCEL + + GtkVBox - vbox3 + vbox6 False 0 @@ -1738,7 +385,7 @@ 0 0 - 10 + 0 False False @@ -1748,103 +395,85 @@ GtkHSeparator hseparator7 - 10 - False + 5 + True True - GtkHBox - hbox5 - False - 0 + GtkFrame + frame2 + 8 + + 0 + GTK_SHADOW_ETCHED_IN - 10 + 0 True True - - GtkLabel - label46 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 0 - 0 - - 5 - False - True - - - GtkOptionMenu menu + 5 True - + + 0 - - 5 - True - True - - - - - GtkFrame - frame1 - 8 - - 0 - GTK_SHADOW_ETCHED_IN - - 2 - True - True - - GtkVBox - vbox4 - False - 0 + GtkFrame + frame1 + 8 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + - GtkCheckButton - soundex - True - - True - True - - 0 - False - False - - + GtkVBox + vbox4 + False + 0 - - GtkLabel - label55 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - + + GtkCheckButton + soundex + True + + True + True + + 0 + False + False + + + + + GtkLabel + label55 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + +