completion

svn: r5976
This commit is contained in:
Don Allingham 2006-02-23 05:08:25 +00:00
parent 1020a104ff
commit b527871666
3 changed files with 17 additions and 27 deletions

View File

@ -110,10 +110,6 @@ class EventEditor(DisplayState.ManagedWindow):
if self.already_exist:
return
for key in self.db.get_place_handles():
title = self.db.get_place_from_handle(key).get_title()
self.pmap[title] = key
if not event:
self.event = RelLib.Event()
@ -135,6 +131,7 @@ class EventEditor(DisplayState.ManagedWindow):
else:
place_name = self.db.get_place_from_handle(place_handle).get_title()
self.place_field.set_text(place_name)
self.place_field.set_completion(self.dbstate.get_place_completion())
self._create_tabbed_pages()
self._setup_fields()

View File

@ -2045,3 +2045,18 @@ class DbState(GrampsDBCallback):
self.active = None
self.open = False
self.emit('no-database')
def get_place_completion(self):
import locale
store = gtk.ListStore(str,str)
foo = []
for val in self.places.keys():
foo.append((locale.strxform(self.places[val]),val))
foo.sort()
for val in foo:
self.store.append(row=[val[1],val[0]])
self.completion = gtk.EntryCompletion()
self.completion.set_text_column(0)
self.completion.set_model(store)
return self.completion

View File

@ -334,25 +334,3 @@ class MonitoredDate:
field.set_text(DateHandler.displayer.display(self.date))
class MonitoredPlace:
def __init__(self,obj,set_val,get_val,mapping,custom):
self.set_val = set_val
self.get_val = get_val
self.obj = obj
val = get_val()
if val:
default = val[0]
else:
default = None
self.sel = AutoComp.StandardCustomSelector(
mapping, obj, custom, default)
self.obj.connect('changed', self.on_change)
def on_change(self, obj):
self.set_val(self.sel.get_values())