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): def set_latlongitude(self, value):
try: try:
coma = value.index(', ') parts = value.index(', ')
longitude = value[coma+2:].strip().replace(',','.') if len(parts) == 2:
latitude = value[:coma].strip().replace(',','.') 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

@ -181,9 +181,13 @@ class EditPlaceRef(EditReference):
def set_latlongitude(self, value): def set_latlongitude(self, value):
try: try:
coma = value.index(', ') parts = value.index(', ')
longitude = value[coma+2:].strip().replace(',','.') if len(parts) == 2:
latitude = value[:coma].strip().replace(',','.') 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)