Fixed mergine and name types
svn: r1060
This commit is contained in:
parent
4f0ca1eb03
commit
36bc41d845
@ -779,10 +779,14 @@ def name_of(p):
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
# Merge Places
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MergePlaces:
|
class MergePlaces:
|
||||||
|
"""
|
||||||
|
Merges to places into a single place. Displays a dialog box that
|
||||||
|
allows the places to be combined into one.
|
||||||
|
"""
|
||||||
def __init__(self,database,place1,place2,update):
|
def __init__(self,database,place1,place2,update):
|
||||||
self.db = database
|
self.db = database
|
||||||
self.p1 = place1
|
self.p1 = place1
|
||||||
@ -803,23 +807,39 @@ class MergePlaces:
|
|||||||
self.top.show()
|
self.top.show()
|
||||||
|
|
||||||
def on_merge_places_clicked(self,obj):
|
def on_merge_places_clicked(self,obj):
|
||||||
|
"""
|
||||||
|
Performs the merge of the places when the merge button is clicked.
|
||||||
|
"""
|
||||||
t2active = self.glade.get_widget("title2").get_active()
|
t2active = self.glade.get_widget("title2").get_active()
|
||||||
|
|
||||||
old_id = self.p1.getId()
|
old_id = self.p1.getId()
|
||||||
|
|
||||||
if t2active:
|
if t2active:
|
||||||
self.p1.set_title(self.p2.get_title())
|
self.p1.set_title(self.p2.get_title())
|
||||||
elif self.glade.get_widget("title3").get_active():
|
elif self.glade.get_widget("title3").get_active():
|
||||||
self.p1.set_title(self.t3.get_text())
|
self.p1.set_title(self.t3.get_text())
|
||||||
|
|
||||||
|
# Set longitude
|
||||||
if self.p1.get_longitude() == "" and self.p2.get_longitude() != "":
|
if self.p1.get_longitude() == "" and self.p2.get_longitude() != "":
|
||||||
self.p1.set_longitude(self.p2.get_longitude())
|
self.p1.set_longitude(self.p2.get_longitude())
|
||||||
|
|
||||||
|
# Set latitude
|
||||||
if self.p1.get_latitude() == "" and self.p2.get_latitude() != "":
|
if self.p1.get_latitude() == "" and self.p2.get_latitude() != "":
|
||||||
self.p1.set_latitude(self.p2.get_latitude())
|
self.p1.set_latitude(self.p2.get_latitude())
|
||||||
|
|
||||||
|
# Add URLs from P2 to P1
|
||||||
for url in self.p2.getUrlList():
|
for url in self.p2.getUrlList():
|
||||||
self.p1.addUrl(url)
|
self.p1.addUrl(url)
|
||||||
|
|
||||||
|
# Copy photos from P2 to P1
|
||||||
for photo in self.p2.getPhotoList():
|
for photo in self.p2.getPhotoList():
|
||||||
self.p1.addPhoto(photo)
|
self.p1.addPhoto(photo)
|
||||||
|
|
||||||
|
# Copy sources from P2 to P1
|
||||||
for source in self.p2.getSourceRefList():
|
for source in self.p2.getSourceRefList():
|
||||||
self.p1.addSource(source)
|
self.p1.addSource(source)
|
||||||
|
|
||||||
|
# Add notes from P2 to P1
|
||||||
note = self.p2.getNote()
|
note = self.p2.getNote()
|
||||||
if note != "":
|
if note != "":
|
||||||
if self.p1.getNote() == "":
|
if self.p1.getNote() == "":
|
||||||
@ -839,20 +859,23 @@ class MergePlaces:
|
|||||||
if not l.is_empty():
|
if not l.is_empty():
|
||||||
self.p1.add_alternate_locations(l)
|
self.p1.add_alternate_locations(l)
|
||||||
|
|
||||||
|
# loop through people, changing event references to P2 to P1
|
||||||
for key in self.db.getPersonKeys():
|
for key in self.db.getPersonKeys():
|
||||||
p = self.db.getPerson(key)
|
p = self.db.getPerson(key)
|
||||||
for event in [p.getBirth(), p.getDeath()] + p.getEventList():
|
for event in [p.getBirth(), p.getDeath()] + p.getEventList():
|
||||||
if event.getPlace() == self.p2:
|
if event.getPlace() == self.p2:
|
||||||
event.setPlace(self.p1)
|
event.setPlace(self.p1)
|
||||||
|
|
||||||
|
# loop through families, changing event references to P2 to P1
|
||||||
for f in self.db.getFamilyMap().values():
|
for f in self.db.getFamilyMap().values():
|
||||||
for event in f.getEventList():
|
for event in f.getEventList():
|
||||||
if event.getPlace() == self.p2:
|
if event.getPlace() == self.p2:
|
||||||
event.setPlace(self.p1)
|
event.setPlace(self.p1)
|
||||||
|
|
||||||
self.db.removePlace(self.p2.getId())
|
self.db.removePlace(self.p2.getId())
|
||||||
self.db.buildPlaceDisplay(self.p1.getId(),old_id)
|
self.db.buildPlaceDisplay(self.p1.getId(),old_id)
|
||||||
|
|
||||||
self.update()
|
self.update(self.p1.getId())
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
Utils.destroy_passed_object(obj)
|
Utils.destroy_passed_object(obj)
|
||||||
|
|
||||||
|
@ -81,26 +81,31 @@ class PlaceView:
|
|||||||
def change_db(self,db):
|
def change_db(self,db):
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
||||||
def load_places(self):
|
def load_places(self,id=None):
|
||||||
"""Rebuilds the entire place view. This can be very time consuming
|
"""Rebuilds the entire place view. This can be very time consuming
|
||||||
on large databases, and should only be called when absolutely
|
on large databases, and should only be called when absolutely
|
||||||
necessary"""
|
necessary"""
|
||||||
|
|
||||||
if len(self.place_list.selection) == 0:
|
|
||||||
current_row = 0
|
|
||||||
else:
|
|
||||||
current_row = self.place_list.selection[0]
|
|
||||||
|
|
||||||
self.place_list.freeze()
|
self.place_list.freeze()
|
||||||
self.place_list.clear()
|
self.place_list.clear()
|
||||||
self.place_list.set_column_visibility(1,GrampsCfg.id_visible)
|
self.place_list.set_column_visibility(1,GrampsCfg.id_visible)
|
||||||
|
|
||||||
|
if len(self.place_list.selection) == 0:
|
||||||
|
current_row = 0
|
||||||
|
else:
|
||||||
|
current_row = self.place_list.selection[0]
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
for key in self.db.getPlaceKeys():
|
for key in self.db.getPlaceKeys():
|
||||||
self.place_list.append(self.db.getPlaceDisplay(key))
|
self.place_list.append(self.db.getPlaceDisplay(key))
|
||||||
self.place_list.set_row_data(index,key)
|
self.place_list.set_row_data(index,key)
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
|
||||||
|
self.place_sort.sort_list()
|
||||||
|
|
||||||
|
if id:
|
||||||
|
current_row = self.place_list.find_row_from_data(id)
|
||||||
|
|
||||||
if index > 0:
|
if index > 0:
|
||||||
self.place_list.select_row(current_row,0)
|
self.place_list.select_row(current_row,0)
|
||||||
self.place_list.moveto(current_row)
|
self.place_list.moveto(current_row)
|
||||||
@ -109,7 +114,6 @@ class PlaceView:
|
|||||||
else:
|
else:
|
||||||
self.active = None
|
self.active = None
|
||||||
|
|
||||||
self.place_sort.sort_list()
|
|
||||||
self.place_list.thaw()
|
self.place_list.thaw()
|
||||||
|
|
||||||
def select_row(self,obj,row,b,c):
|
def select_row(self,obj,row,b,c):
|
||||||
|
@ -478,7 +478,7 @@ class XmlWriter:
|
|||||||
def dump_name(self,label,name,index=1):
|
def dump_name(self,label,name,index=1):
|
||||||
sp = " "*index
|
sp = " "*index
|
||||||
type = name.getType()
|
type = name.getType()
|
||||||
if type and type != "Birth Name":
|
if type:
|
||||||
self.g.write('%s<%s type="%s"%s>\n' % (sp,label,type,conf_priv(name)))
|
self.g.write('%s<%s type="%s"%s>\n' % (sp,label,type,conf_priv(name)))
|
||||||
else:
|
else:
|
||||||
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
|
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
|
||||||
|
1975
src/po/it.po
1975
src/po/it.po
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user