* src/EventEdit.py: more robust handler for new place after an edit

svn: r4353
This commit is contained in:
Don Allingham 2005-04-12 15:16:04 +00:00
parent e34124272e
commit dd96e0fb24
2 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2005-04-12 Don Allingham <don@gramps-project.org>
* src/EventEdit.py: more robust handler for new place after an edit
2005-04-12 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-04-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/ArgHandler.py: Fixed typo * src/ArgHandler.py: Fixed typo

View File

@ -95,8 +95,8 @@ class EventEditor:
self.elist.sort() self.elist.sort()
for key in self.parent.db.get_place_handles(): for key in self.parent.db.get_place_handles():
p = self.parent.db.get_place_from_handle(key).get_display_info() title = self.parent.db.get_place_from_handle(key).get_title()
self.pmap[p[0]] = key self.pmap[title] = key
if event: if event:
self.srcreflist = self.event.get_source_references() self.srcreflist = self.event.get_source_references()
@ -300,12 +300,11 @@ class EventEditor:
text = unicode(field.get_text().strip()) text = unicode(field.get_text().strip())
if text: if text:
if self.pmap.has_key(text): if self.pmap.has_key(text):
return self.pdmap[text] return self.db.get_place_from_handle(self.pdmap[text])
else: else:
place = RelLib.Place() place = RelLib.Place()
place.set_title(text) place.set_title(text)
self.db.add_place(place,trans) self.db.add_place(place,trans)
self.pmap[text] = place.get_handle()
return place return place
else: else:
return None return None