From efcaf0d6e15688bda545d2782b9a9d0faec61ab0 Mon Sep 17 00:00:00 2001 From: Zsolt Foldvari Date: Tue, 13 Mar 2007 22:12:10 +0000 Subject: [PATCH] * src/Editors/_EditPlace.py (_setup_fields): validate coordinates * src/glade/gramps.glade: delete long, lat entries from place_editor 2007-03-13 Zsolt Foldvari svn: r8293 --- ChangeLog | 4 ++++ src/Editors/_EditPlace.py | 32 +++++++++++++++++++++++++-- src/glade/gramps.glade | 46 --------------------------------------- 3 files changed, 34 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b281cfb8..6c65d8d5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-03-13 Zsolt Foldvari + * src/Editors/_EditPlace.py (_setup_fields): validate coordinates + * src/glade/gramps.glade: delete long, lat entries from place_editor + 2007-03-13 Zsolt Foldvari * src/RelLib/_Note.py: import const from MarkupText module * src/MarkupText.py: use actions instead of widgets on the interface; diff --git a/src/Editors/_EditPlace.py b/src/Editors/_EditPlace.py index be687d3e3..7f1487556 100644 --- a/src/Editors/_EditPlace.py +++ b/src/Editors/_EditPlace.py @@ -49,6 +49,7 @@ from _EditPrimary import EditPrimary from DisplayTabs import * from GrampsWidgets import * +from PlaceUtils import conv_lat_lon #------------------------------------------------------------------------- # @@ -134,16 +135,43 @@ class EditPlace(EditPrimary): self.top.get_widget("country"), mloc.set_country, mloc.get_country, self.db.readonly) + table = self.top.get_widget("table66") + + entry = ValidatableMaskedEntry() + entry.connect("validate", self._validate_coordinate, "lon") + tip = gtk.Tooltips() + tip.set_tip(entry, "East/West position, eg -2.88589, 2°53'" + + '9.23" W or -2:53:9.23') + entry.show() + table.attach(entry, 3, 4, 1, 2) + self.longitude = MonitoredEntry( - self.top.get_widget("longitude"), + entry, self.obj.set_longitude, self.obj.get_longitude, self.db.readonly) + entry = ValidatableMaskedEntry() + entry.connect("validate", self._validate_coordinate, "lat") + tip = gtk.Tooltips() + tip.set_tip(entry, "North/South position, eg 50.84988, 50°50'" + + '59.60"N or 50:50:59.60') + entry.show() + table.attach(entry, 1, 2, 1, 2) + self.latitude = MonitoredEntry( - self.top.get_widget("latitude"), + entry, self.obj.set_latitude, self.obj.get_latitude, self.db.readonly) + def _validate_coordinate(self, widget, text, typedeg): + if typedeg == 'lat': + result = conv_lat_lon(text, "0", "ISO-D") + elif typedeg == 'lon': + result = conv_lat_lon("0", text, "ISO-D") + + if not result: + return ValidationError("Wrong coordinate") + def build_menu_names(self,place): return (_('Edit Place'), self.get_menu_title()) diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index d69e614c7..bf3e695d9 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -1564,7 +1564,6 @@ 0.5 0 0 - latitude PANGO_ELLIPSIZE_NONE -1 False @@ -1580,28 +1579,6 @@ - - - True - North/South position, eg 50.84988, 50°50'59.60"N or 50:50:59.60 - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - True @@ -1615,7 +1592,6 @@ 0.5 0 0 - longitude PANGO_ELLIPSIZE_NONE -1 False @@ -1631,28 +1607,6 @@ - - - True - East/West position, eg -2.88589, 2°53'9.23" W or -2:53:9.23 - True - True - True - 0 - - True - * - False - - - 3 - 4 - 1 - 2 - - - - True