From eac59d932d35736716edb8412e6bd6ac052108c9 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sat, 22 Oct 2016 12:12:49 +0200 Subject: [PATCH 1/5] 9373: Ability to be able to enter comma separated latitude/longitude pairs --- gramps/gui/editors/editplace.py | 18 ++++++++++++++++++ gramps/gui/glade/editplace.glade | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py index 985f79fef..9b0d14ef1 100644 --- a/gramps/gui/editors/editplace.py +++ b/gramps/gui/editors/editplace.py @@ -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'") + diff --git a/gramps/gui/glade/editplace.glade b/gramps/gui/glade/editplace.glade index a3dacc324..76e5e3e27 100644 --- a/gramps/gui/glade/editplace.glade +++ b/gramps/gui/glade/editplace.glade @@ -127,6 +127,21 @@ 3 + + + True + False + start + LatLon_gitude: + True + center + latlon_entry + + + 0 + 5 + + True @@ -185,6 +200,19 @@ You can set these values via the Geography View by searching the place, or via a 3 + + + True + True + Field used to paste info from a web page like google, openstreetmap, ... + True + + + + 1 + 5 + + True From 593d57dbc0126ad9fbe9482cfb4e572b12b61a59 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Wed, 26 Oct 2016 08:56:26 +0200 Subject: [PATCH 2/5] 9373: justifying the three input fields. --- gramps/gui/glade/editplace.glade | 91 +++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 32 deletions(-) diff --git a/gramps/gui/glade/editplace.glade b/gramps/gui/glade/editplace.glade index 76e5e3e27..c6363bf1f 100644 --- a/gramps/gui/glade/editplace.glade +++ b/gramps/gui/glade/editplace.glade @@ -97,11 +97,26 @@ 1 + + + True + True + start + Either use the two fields below to enter coordinates(latitude and longitude), + Field used to paste info from a web page like google, openstreetmap, ... + True + + + 0 + 3 + 5 + + True False - start + center L_atitude: True center @@ -109,7 +124,7 @@ 0 - 3 + 4 @@ -124,22 +139,7 @@ 2 - 3 - - - - - True - False - start - LatLon_gitude: - True - center - latlon_entry - - - 0 - 5 + 4 @@ -167,7 +167,7 @@ 0 - 4 + 6 @@ -182,7 +182,7 @@ You can set these values via the Geography View by searching the place, or via a 1 - 3 + 4 @@ -197,20 +197,47 @@ You can set these values via the Geography View by searching the place, or via a 3 - 3 + 4 - + True - True - Field used to paste info from a web page like google, openstreetmap, ... - True - + False + 6 + + + True + False + start + or use copy/paste from your favorite map provider (format : latitude,longitude) in the following field: + True + + + False + True + 0 + + + + + True + True + Field used to paste info from a web page like google, openstreetmap, ... + True + + + + False + True + 1 + + - 1 + 0 5 + 4 @@ -264,7 +291,7 @@ You can set these values via the Geography View by searching the place, or via a 1 - 4 + 6 @@ -294,7 +321,7 @@ You can set these values via the Geography View by searching the place, or via a 4 - 3 + 2 @@ -305,7 +332,7 @@ You can set these values via the Geography View by searching the place, or via a 4 - 4 + 6 @@ -360,7 +387,7 @@ You can set these values via the Geography View by searching the place, or via a 2 - 4 + 6 @@ -372,7 +399,7 @@ You can set these values via the Geography View by searching the place, or via a 3 - 4 + 6 From b6bb8ccdcc25e42784718b820432c3e2f3fae004 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Thu, 3 Nov 2016 19:28:51 +0100 Subject: [PATCH 3/5] 9373: Added EditPlaceRef and suppressed a useless tooltip --- gramps/gui/editors/editplaceref.py | 18 +++++++ gramps/gui/glade/editplace.glade | 1 - gramps/gui/glade/editplaceref.glade | 76 ++++++++++++++++++++++++----- 3 files changed, 83 insertions(+), 12 deletions(-) diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index 1adda4ed6..eede8cfd3 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -167,6 +167,24 @@ class EditPlaceRef(EditReference): #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'") + diff --git a/gramps/gui/glade/editplace.glade b/gramps/gui/glade/editplace.glade index c6363bf1f..2b14957ed 100644 --- a/gramps/gui/glade/editplace.glade +++ b/gramps/gui/glade/editplace.glade @@ -103,7 +103,6 @@ True start Either use the two fields below to enter coordinates(latitude and longitude), - Field used to paste info from a web page like google, openstreetmap, ... True diff --git a/gramps/gui/glade/editplaceref.glade b/gramps/gui/glade/editplaceref.glade index 591df732f..4b6b4bd6c 100644 --- a/gramps/gui/glade/editplaceref.glade +++ b/gramps/gui/glade/editplaceref.glade @@ -220,6 +220,20 @@ 2 + + + True + True + start + Either use the two fields below to enter coordinates(latitude and longitude), + True + + + 0 + 3 + 5 + + True @@ -233,7 +247,7 @@ 0 - 4 + 6 @@ -246,7 +260,7 @@ 0 - 3 + 4 @@ -291,7 +305,7 @@ 0 - 5 + 7 5 @@ -320,7 +334,47 @@ 2 - 3 + 4 + + + + + True + False + 6 + + + True + False + start + or use copy/paste from your favorite map provider (format : latitude,longitude) in the following field: + True + + + False + True + 0 + + + + + True + True + Field used to paste info from a web page like google, openstreetmap, ... + True + + + + False + True + 1 + + + + + 0 + 5 + 4 @@ -369,7 +423,7 @@ 4 - 3 + 4 @@ -398,7 +452,7 @@ You can set these values via the Geography View by searching the place, or via a 1 - 3 + 4 @@ -413,7 +467,7 @@ You can set these values via the Geography View by searching the place, or via a 3 - 3 + 4 @@ -467,7 +521,7 @@ You can set these values via the Geography View by searching the place, or via a 1 - 4 + 6 @@ -479,7 +533,7 @@ You can set these values via the Geography View by searching the place, or via a 2 - 4 + 6 @@ -491,7 +545,7 @@ You can set these values via the Geography View by searching the place, or via a 3 - 4 + 6 @@ -502,7 +556,7 @@ You can set these values via the Geography View by searching the place, or via a 4 - 4 + 6 From 6b38e74ecb81e05bc2395633b4c380799a8e38f1 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Fri, 25 Nov 2016 22:50:36 +0100 Subject: [PATCH 4/5] 9373: Values not saved and bug in monitoredwidgets --- gramps/gui/editors/editplace.py | 3 ++- gramps/gui/editors/editplaceref.py | 2 ++ gramps/gui/widgets/monitoredwidgets.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py index 9b0d14ef1..c4ae13193 100644 --- a/gramps/gui/editors/editplace.py +++ b/gramps/gui/editors/editplace.py @@ -186,6 +186,8 @@ class EditPlace(EditPrimary): self.latitude.set_text(value[:coma]) self.top.get_object("lat_entry").validate(force=True) self.top.get_object("lon_entry").validate(force=True) + self.obj.set_latitude(self.latitude.get_value()) + self.obj.set_longitude(self.longitude.get_value()) except: pass @@ -297,7 +299,6 @@ class EditPlace(EditPrimary): def save(self, *obj): self.ok_button.set_sensitive(False) - if self.obj.get_name().get_value().strip() == '': msg1 = _("Cannot save place. Name not entered.") msg2 = _("You must enter a name before saving.") diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index eede8cfd3..f69e85c00 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -179,6 +179,8 @@ class EditPlaceRef(EditReference): self.latitude.set_text(value[:coma]) self.top.get_object("lat_entry").validate(force=True) self.top.get_object("lon_entry").validate(force=True) + self.obj.set_latitude(self.latitude.get_value()) + self.obj.set_longitude(self.longitude.get_value()) except: pass diff --git a/gramps/gui/widgets/monitoredwidgets.py b/gramps/gui/widgets/monitoredwidgets.py index 52bb8ceb0..4a2c59c60 100644 --- a/gramps/gui/widgets/monitoredwidgets.py +++ b/gramps/gui/widgets/monitoredwidgets.py @@ -144,7 +144,7 @@ class MonitoredEntry: def force_value(self, value): self.obj.set_text(value) - def get_value(self, value): + def get_value(self): return str(self.obj.get_text()) def enable(self, value): From f03dab0be300504cbf825335439abda758e994a7 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Tue, 24 Jan 2017 11:33:34 +0100 Subject: [PATCH 5/5] 9373 : split the third field in two lines. --- gramps/gui/glade/editplace.glade | 24 ++++++++++++++++++------ gramps/gui/glade/editplaceref.glade | 26 +++++++++++++++++++------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/gramps/gui/glade/editplace.glade b/gramps/gui/glade/editplace.glade index 2b14957ed..49c017b9a 100644 --- a/gramps/gui/glade/editplace.glade +++ b/gramps/gui/glade/editplace.glade @@ -166,7 +166,7 @@ 0 - 6 + 7 @@ -218,6 +218,18 @@ You can set these values via the Geography View by searching the place, or via a 0 + + + 0 + 5 + 4 + + + + + True + False + 6 True @@ -235,7 +247,7 @@ You can set these values via the Geography View by searching the place, or via a 0 - 5 + 6 4 @@ -290,7 +302,7 @@ You can set these values via the Geography View by searching the place, or via a 1 - 6 + 7 @@ -331,7 +343,7 @@ You can set these values via the Geography View by searching the place, or via a 4 - 6 + 7 @@ -386,7 +398,7 @@ You can set these values via the Geography View by searching the place, or via a 2 - 6 + 7 @@ -398,7 +410,7 @@ You can set these values via the Geography View by searching the place, or via a 3 - 6 + 7 diff --git a/gramps/gui/glade/editplaceref.glade b/gramps/gui/glade/editplaceref.glade index 4b6b4bd6c..4f9fd213f 100644 --- a/gramps/gui/glade/editplaceref.glade +++ b/gramps/gui/glade/editplaceref.glade @@ -247,7 +247,7 @@ 0 - 6 + 7 @@ -305,7 +305,7 @@ 0 - 7 + 8 5 @@ -356,6 +356,18 @@ 0 + + + 0 + 5 + 4 + + + + + True + False + 6 True @@ -373,7 +385,7 @@ 0 - 5 + 6 4 @@ -521,7 +533,7 @@ You can set these values via the Geography View by searching the place, or via a 1 - 6 + 7 @@ -533,7 +545,7 @@ You can set these values via the Geography View by searching the place, or via a 2 - 6 + 7 @@ -545,7 +557,7 @@ You can set these values via the Geography View by searching the place, or via a 3 - 6 + 7 @@ -556,7 +568,7 @@ You can set these values via the Geography View by searching the place, or via a 4 - 6 + 7