completion
svn: r5976
This commit is contained in:
parent
72d064f5b5
commit
17873c0d3a
@ -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()
|
||||
|
||||
@ -125,7 +121,7 @@ class EventEditor(DisplayState.ManagedWindow):
|
||||
etitle = _('Event Editor')
|
||||
Utils.set_titles(self.window,title_label, etitle,
|
||||
_('Event Editor'))
|
||||
|
||||
|
||||
self.place_field = self.top.get_widget("eventPlace")
|
||||
self.place_field.set_editable(not self.db.readonly)
|
||||
|
||||
@ -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()
|
||||
|
@ -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
|
||||
|
@ -333,26 +333,4 @@ class MonitoredDate:
|
||||
button.set_sensitive(not readonly)
|
||||
|
||||
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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user