diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py index 117f7cecd..df724da25 100644 --- a/gramps/gui/editors/editplace.py +++ b/gramps/gui/editors/editplace.py @@ -187,9 +187,13 @@ class EditPlace(EditPrimary): def set_latlongitude(self, value): try: - coma = value.index(', ') - longitude = value[coma+2:].strip().replace(',','.') - latitude = value[:coma].strip().replace(',','.') + parts = value.index(', ') + if len(parts) == 2: + longitude = parts[0].strip().replace(',', '.') + latitude = parts[1].strip().replace(',', '.') + else: + longitude, latitude = value.split(',') + self.longitude.set_text(longitude) self.latitude.set_text(latitude) self.top.get_object("lat_entry").validate(force=True) diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index eee6c3ae2..89590ee67 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -181,9 +181,13 @@ class EditPlaceRef(EditReference): def set_latlongitude(self, value): try: - coma = value.index(', ') - longitude = value[coma+2:].strip().replace(',','.') - latitude = value[:coma].strip().replace(',','.') + parts = value.index(', ') + if len(parts) == 2: + longitude = parts[0].strip().replace(',', '.') + latitude = parts[1].strip().replace(',', '.') + else: + longitude, latitude = value.split(',') + self.longitude.set_text(longitude) self.latitude.set_text(latitude) self.top.get_object("lat_entry").validate(force=True)