* src/ListBox.py (EventListBox.set_place): Fix place setting.

svn: r4830
This commit is contained in:
Alex Roitman 2005-06-16 03:46:47 +00:00
parent 3d595d685c
commit f9a01d5854
2 changed files with 31 additions and 8 deletions

View File

@ -1,3 +1,6 @@
2005-06-15 Alex Roitman <shura@gramps-project.org>
* src/ListBox.py (EventListBox.set_place): Fix place setting.
2005-06-14 Alex Roitman <shura@gramps-project.org>
* src/events.png, src/repos.png, src/repos24.png: Add GNOME icons
for the stock calendar and drawer.

View File

@ -319,6 +319,13 @@ class EventListBox(ReorderListBox):
rolenames = filter(lambda x: x != role_custom_str,
self.role_dict.values())
self.place_dict = {}
for handle in self.parent.db.get_place_handles():
title = self.parent.db.get_place_from_handle(handle).get_title()
self.place_dict[title] = handle
placenames = self.place_dict.keys()
placenames.sort(locale.strcoll)
evalues = [
# Title Sort Col Size, Type Argument
(_('Event'), NOSORT, 100, COMBO, eventnames,self.set_type),
@ -359,7 +366,20 @@ class EventListBox(ReorderListBox):
self.change_list.add(self.data[index])
def set_place(self,index,value):
self.data[index][1].set_description(value)
if not value.strip():
return
handle = self.place_dict.get(value,None)
if handle:
place = self.parent.db.get_place_from_handle(handle)
else:
place = RelLib.Place()
place.set_title(value)
trans = self.parent.db.transaction_begin()
self.parent.db.add_place(place,trans)
self.parent.db.transaction_commit(trans,_("Add Place"))
handle = place.get_handle()
self.data[index][1].set_place_handle(handle)
self.change_list.add(self.data[index])
def set_date(self,index,value):