From b40034531d1805b521cb25f9e9e5eb4442b34f95 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 26 Oct 2001 12:56:39 +0000 Subject: [PATCH] Fixed editing the active person svn: r510 --- gramps/src/MergeData.py | 49 +++++++++++++++++++++------------------ gramps/src/RelLib.py | 11 +++++++++ gramps/src/gramps.glade | 4 ++-- gramps/src/gramps_main.py | 6 ++++- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/gramps/src/MergeData.py b/gramps/src/MergeData.py index 3a48db813..542e7bf1e 100644 --- a/gramps/src/MergeData.py +++ b/gramps/src/MergeData.py @@ -232,40 +232,45 @@ class MergePeople: def on_merge_clicked(self,obj): utils.modified() - anames = self.p1.getAlternateNames()[:] - for xname in self.p2.getAlternateNames(): - for name in anames: - if name.getFirstName() == xname.getFirstName() and \ - name.getSurname() == xname.getSurname() and \ - name.getTitle() == xname.getTitle() and \ - name.getSuffix() == xname.getSuffix(): - self.copy_note(xname,name) - self.copy_sources(xname,name) + list = self.p1.getAlternateNames()[:] + for xdata in self.p2.getAlternateNames(): + for data in list: + if data.are_equal(xdata): + self.copy_note(xdata,data) + self.copy_sources(xdata,data) break else: self.p1.addAlternateName(xname) - anames = self.p1.getAttributeList()[:] - for xname in self.p2.getAttributeList(): - for name in anames: - if name.getType() == xname.getType() and \ - name.getValue() == xname.getValue(): - self.copy_note(xname,name) - self.copy_sources(xname,name) + list = self.p1.getAttributeList()[:] + for xdata in self.p2.getAttributeList(): + for data in list: + if data.getType() == xdata.getType() and \ + data.getValue() == xdata.getValue(): + self.copy_note(xdata,data) + self.copy_sources(xdata,data) break else: self.p1.addAttribute(xname) - elist = self.p1.getEventList()[:] - for xevent in self.p2.getEventList(): - for event in elist: - if event.are_equal(xevent): - self.copy_note(xevent,event) - self.copy_sources(xevent,event) + list = self.p1.getEventList()[:] + for xdata in self.p2.getEventList(): + for data in list: + if data.are_equal(xdata): + self.copy_note(xdata,data) + self.copy_sources(xdata,data) break else: self.p1.addEvent(xevent) + list = self.p1.getUrlList()[:] + for xdata in self.p2.getUrlList(): + for data in list: + if data.are_equal(xdata): + break + else: + self.p1.addUrl(xdata) + if self.bname1.get_active(): if self.altname.get_active(): self.p1.addAlternateName(self.p2.getPrimaryName()) diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 6f3924e5f..8b7478403 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -721,6 +721,17 @@ class Url: """returns the description of the URL""" return self.desc + def are_equal(self,other): + """returns 1 if the specified URL is the same as the instance""" + if other == None: + return 0 + if self.path != other.path: + return 0 + if self.desc != other.desc: + return 0 + return 1 + + class Person: """Represents an individual person in the gramps database""" diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 602b0161e..7d3a60331 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -1110,8 +1110,8 @@ True clicked - on_edit_active_person - Fri, 01 Dec 2000 04:16:55 GMT + on_edit_selected_people + Fri, 26 Oct 2001 12:53:20 GMT GTK_RELIEF_NORMAL diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 5b99bfe75..5e337042f 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -785,7 +785,7 @@ def save_file(filename,comment): # Edit Person window for specified people # #------------------------------------------------------------------------- -def load_active_person(obj): +def load_selected_people(obj): """Display the selected people in the EditPerson display""" if len(person_list.selection) > 5: msg = _("You requested too many people to edit at the same time") @@ -795,6 +795,9 @@ def load_active_person(obj): person = person_list.get_row_data(p) load_person(person[0]) +def load_active_person(obj): + load_person(active_person) + def on_edit_spouse_clicked(obj): """Display the active spouse in the EditPerson display""" load_person(active_spouse) @@ -2656,6 +2659,7 @@ def main(arg): "on_delete_media_clicked" : on_delete_media_clicked, "on_delete_sp_clicked" : on_delete_sp_clicked, "on_edit_active_person" : load_active_person, + "on_edit_selected_people" : load_selected_people, "on_edit_bookmarks_activate" : on_edit_bookmarks_activate, "on_edit_father_clicked" : on_edit_father_clicked, "on_edit_media_clicked" : on_edit_media_clicked,