9373: Ability to be able to enter comma separated latitude/longitude pairs

This commit is contained in:
SNoiraud 2016-10-22 12:12:49 +02:00 committed by Nick Hall
parent db81851195
commit eac59d932d
2 changed files with 46 additions and 0 deletions

View File

@ -174,6 +174,24 @@ class EditPlace(EditPrimary):
#force validation now with initial entry
self.top.get_object("lat_entry").validate(force=True)
self.latlon = MonitoredEntry(
self.top.get_object("latlon_entry"),
self.set_latlongitude, self.get_latlongitude,
self.db.readonly)
def set_latlongitude(self, value):
try:
coma = value.index(',')
self.longitude.set_text(value[coma+1:])
self.latitude.set_text(value[:coma])
self.top.get_object("lat_entry").validate(force=True)
self.top.get_object("lon_entry").validate(force=True)
except:
pass
def get_latlongitude(self):
return ""
def _validate_coordinate(self, widget, text, typedeg):
if (typedeg == 'lat') and not conv_lat_lon(text, "0", "ISO-D"):
return ValidationError(_("Invalid latitude (syntax: 18\u00b09'") +

View File

@ -127,6 +127,21 @@
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="latlon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">LatLon_gitude:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">latlon_entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="UndoableEntry" id="place_title">
<property name="can_focus">True</property>
@ -185,6 +200,19 @@ You can set these values via the Geography View by searching the place, or via a
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="ValidatableMaskedEntry" id="latlon_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Field used to paste info from a web page like google, openstreetmap, ... </property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>