* src/EditPlace.py: check to make sure a duplicate title is not

entered


svn: r4841
This commit is contained in:
Don Allingham 2005-06-18 03:22:26 +00:00
parent 1d78512f16
commit 74f29ec489
2 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2005-06-17 Don Allingham <don@gramps-project.org>
* src/EditPlace.py: check to make sure a duplicate title is not
entered
2005-06-17 Alex Roitman <shura@gramps-project.org> 2005-06-17 Alex Roitman <shura@gramps-project.org>
* src/WriteGedcom.py (write_sources): Pass handle to the id * src/WriteGedcom.py (write_sources): Pass handle to the id
creator; (write_person): write person sources; (sid): return creator; (write_person): write person sources; (sid): return

View File

@ -243,11 +243,25 @@ class EditPlace:
self.add_itself_to_menu() self.add_itself_to_menu()
self.top_window.get_widget('ok').set_sensitive(not self.db.readonly) self.top_window.get_widget('ok').set_sensitive(not self.db.readonly)
self.top.show() self.top.show()
self.pdmap = {}
self.build_pdmap()
if self.ref_not_loaded: if self.ref_not_loaded:
Utils.temp_label(self.refs_label,self.top) Utils.temp_label(self.refs_label,self.top)
gobject.idle_add(self.display_references) gobject.idle_add(self.display_references)
self.ref_not_loaded = 0 self.ref_not_loaded = 0
def build_pdmap(self):
self.pdmap.clear()
cursor = self.db.get_place_cursor()
data = cursor.next()
while data:
if data[1][2]:
self.pdmap[data[1][2]] = data[0]
data = cursor.next()
cursor.close()
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.glry.close() self.glry.close()
self.close_child_windows() self.close_child_windows()
@ -371,6 +385,15 @@ class EditPlace:
format = self.preform.get_active() format = self.preform.get_active()
mloc = self.place.get_main_location() mloc = self.place.get_main_location()
title = self.title.get_text()
if self.pdmap.has_key(title) and self.pdmap[title] != self.place.handle:
import QuestionDialog
QuestionDialog.ErrorDialog(_("Place title is already in use"),
_("Each place must have a unique title, and "
"title you have selected is already used by "
"another place"))
return
self.set(self.city,mloc.get_city,mloc.set_city) self.set(self.city,mloc.get_city,mloc.set_city)
self.set(self.parish,mloc.get_parish,mloc.set_parish) self.set(self.parish,mloc.get_parish,mloc.set_parish)
self.set(self.state,mloc.get_state,mloc.set_state) self.set(self.state,mloc.get_state,mloc.set_state)