Allow entering place latlong without space (#1190)

* Allow entering place latlong without space

* Allow entering place latlong without space in editplaceref
This commit is contained in:
Benedikt Werner 2021-05-06 17:16:21 +02:00 committed by GitHub
parent 12ee1f2b8a
commit 410cffe832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -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)

View File

@ -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)