Place editor, copy and paste of lat and long text

no longer auto-populating latitude and longitude fields

Fixes #012349
This commit is contained in:
SNoiraud 2021-07-10 17:11:58 +02:00 committed by Nick Hall
parent a3b37b9627
commit 6dcb1d00d5
2 changed files with 16 additions and 6 deletions

View File

@ -187,9 +187,14 @@ class EditPlace(EditPrimary):
def set_latlongitude(self, value): def set_latlongitude(self, value):
try: try:
coma = value.index(', ') # Bug 12349
longitude = value[coma+2:].strip().replace(',','.') parts = value.index(', ')
latitude = value[:coma].strip().replace(',','.') 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.longitude.set_text(longitude)
self.latitude.set_text(latitude) self.latitude.set_text(latitude)
self.top.get_object("lat_entry").validate(force=True) self.top.get_object("lat_entry").validate(force=True)

View File

@ -180,9 +180,14 @@ class EditPlaceRef(EditReference):
def set_latlongitude(self, value): def set_latlongitude(self, value):
try: try:
coma = value.index(', ') # Bug 12349
longitude = value[coma+2:].strip().replace(',','.') parts = value.index(', ')
latitude = value[:coma].strip().replace(',','.') 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.longitude.set_text(longitude)
self.latitude.set_text(latitude) self.latitude.set_text(latitude)
self.top.get_object("lat_entry").validate(force=True) self.top.get_object("lat_entry").validate(force=True)