From 07623a6cf1e446fcec19249044a15c22b4f64d70 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Sat, 15 Sep 2012 07:54:07 +0000 Subject: [PATCH] Geography : bugs #06044 and #05975 : detection of multiple places with same title svn: r20391 --- src/plugins/lib/maps/geography.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/plugins/lib/maps/geography.py b/src/plugins/lib/maps/geography.py index 6381c70ac..22dc8fe7c 100644 --- a/src/plugins/lib/maps/geography.py +++ b/src/plugins/lib/maps/geography.py @@ -960,14 +960,34 @@ class GeoGraphyView(osmGpsMap, NavigationView): loc = place.get_main_location() oldv = (loc.get_country(), loc.get_state(), loc.get_county()) if loc else None places_handle = self.dbstate.db.iter_place_handles() + nb_places = 0 + gids = "" for place_hdl in places_handle: plce = self.dbstate.db.get_place_from_handle(place_hdl) if plce.get_title() == place.get_title(): - self.mark = [None,None,None,None,None,None,None, - None,None,plce.gramps_id,None,None] - self.select_fct = PlaceSelection(self.uistate, self.dbstate, self.osm, - self.selection_layer, self.place_list, - lat, lon, self.__edit_place, oldv) + nb_places += 1 + if gids == "": + gids = plce.gramps_id + else: + gids = gids + ", " + plce.gramps_id + if nb_places > 1: + from QuestionDialog import WarningDialog + WarningDialog( + _('You have at least two places with the same title.'), + _("The title of the places is :\n" + "%(title)s\n" + "The following places are similar : %(gid)s\n" + "Eiher you rename the places either you merge them." + "\n\nI can't proceed your request.\n") % { + 'title': plce.get_title(), + 'gid': gids} + ) + else: + self.mark = [None,None,None,None,None,None,None, + None,None,plce.gramps_id,None,None] + self.select_fct = PlaceSelection(self.uistate, self.dbstate, self.osm, + self.selection_layer, self.place_list, + lat, lon, self.__edit_place, oldv) def __add_place(self, pcountry, pcounty, pstate, plat, plon): """