Fixed editing the active person

svn: r510
This commit is contained in:
Don Allingham 2001-10-26 12:56:39 +00:00
parent c523dea85d
commit b40034531d
4 changed files with 45 additions and 25 deletions

View File

@ -232,40 +232,45 @@ class MergePeople:
def on_merge_clicked(self,obj): def on_merge_clicked(self,obj):
utils.modified() utils.modified()
anames = self.p1.getAlternateNames()[:] list = self.p1.getAlternateNames()[:]
for xname in self.p2.getAlternateNames(): for xdata in self.p2.getAlternateNames():
for name in anames: for data in list:
if name.getFirstName() == xname.getFirstName() and \ if data.are_equal(xdata):
name.getSurname() == xname.getSurname() and \ self.copy_note(xdata,data)
name.getTitle() == xname.getTitle() and \ self.copy_sources(xdata,data)
name.getSuffix() == xname.getSuffix():
self.copy_note(xname,name)
self.copy_sources(xname,name)
break break
else: else:
self.p1.addAlternateName(xname) self.p1.addAlternateName(xname)
anames = self.p1.getAttributeList()[:] list = self.p1.getAttributeList()[:]
for xname in self.p2.getAttributeList(): for xdata in self.p2.getAttributeList():
for name in anames: for data in list:
if name.getType() == xname.getType() and \ if data.getType() == xdata.getType() and \
name.getValue() == xname.getValue(): data.getValue() == xdata.getValue():
self.copy_note(xname,name) self.copy_note(xdata,data)
self.copy_sources(xname,name) self.copy_sources(xdata,data)
break break
else: else:
self.p1.addAttribute(xname) self.p1.addAttribute(xname)
elist = self.p1.getEventList()[:] list = self.p1.getEventList()[:]
for xevent in self.p2.getEventList(): for xdata in self.p2.getEventList():
for event in elist: for data in list:
if event.are_equal(xevent): if data.are_equal(xdata):
self.copy_note(xevent,event) self.copy_note(xdata,data)
self.copy_sources(xevent,event) self.copy_sources(xdata,data)
break break
else: else:
self.p1.addEvent(xevent) 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.bname1.get_active():
if self.altname.get_active(): if self.altname.get_active():
self.p1.addAlternateName(self.p2.getPrimaryName()) self.p1.addAlternateName(self.p2.getPrimaryName())

View File

@ -721,6 +721,17 @@ class Url:
"""returns the description of the URL""" """returns the description of the URL"""
return self.desc 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: class Person:
"""Represents an individual person in the gramps database""" """Represents an individual person in the gramps database"""

View File

@ -1110,8 +1110,8 @@
<can_focus>True</can_focus> <can_focus>True</can_focus>
<signal> <signal>
<name>clicked</name> <name>clicked</name>
<handler>on_edit_active_person</handler> <handler>on_edit_selected_people</handler>
<last_modification_time>Fri, 01 Dec 2000 04:16:55 GMT</last_modification_time> <last_modification_time>Fri, 26 Oct 2001 12:53:20 GMT</last_modification_time>
</signal> </signal>
<label>Edit/View Person</label> <label>Edit/View Person</label>
<relief>GTK_RELIEF_NORMAL</relief> <relief>GTK_RELIEF_NORMAL</relief>

View File

@ -785,7 +785,7 @@ def save_file(filename,comment):
# Edit Person window for specified people # Edit Person window for specified people
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def load_active_person(obj): def load_selected_people(obj):
"""Display the selected people in the EditPerson display""" """Display the selected people in the EditPerson display"""
if len(person_list.selection) > 5: if len(person_list.selection) > 5:
msg = _("You requested too many people to edit at the same time") 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) person = person_list.get_row_data(p)
load_person(person[0]) load_person(person[0])
def load_active_person(obj):
load_person(active_person)
def on_edit_spouse_clicked(obj): def on_edit_spouse_clicked(obj):
"""Display the active spouse in the EditPerson display""" """Display the active spouse in the EditPerson display"""
load_person(active_spouse) load_person(active_spouse)
@ -2656,6 +2659,7 @@ def main(arg):
"on_delete_media_clicked" : on_delete_media_clicked, "on_delete_media_clicked" : on_delete_media_clicked,
"on_delete_sp_clicked" : on_delete_sp_clicked, "on_delete_sp_clicked" : on_delete_sp_clicked,
"on_edit_active_person" : load_active_person, "on_edit_active_person" : load_active_person,
"on_edit_selected_people" : load_selected_people,
"on_edit_bookmarks_activate" : on_edit_bookmarks_activate, "on_edit_bookmarks_activate" : on_edit_bookmarks_activate,
"on_edit_father_clicked" : on_edit_father_clicked, "on_edit_father_clicked" : on_edit_father_clicked,
"on_edit_media_clicked" : on_edit_media_clicked, "on_edit_media_clicked" : on_edit_media_clicked,