From 675ae1a8d4d931a88a908c0b2832cdbbc000c941 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Wed, 3 Aug 2016 22:42:45 +0200 Subject: [PATCH] 8128: GtkDialog mapped without a transient parent --- gramps/plugins/lib/libmapservice.py | 4 +++- gramps/plugins/lib/libplaceview.py | 2 +- gramps/plugins/mapservices/eniroswedenmap.py | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gramps/plugins/lib/libmapservice.py b/gramps/plugins/lib/libmapservice.py index aecd1c770..1ffad52ae 100644 --- a/gramps/plugins/lib/libmapservice.py +++ b/gramps/plugins/lib/libmapservice.py @@ -46,16 +46,18 @@ class MapService: self.items = None self.url = '' - def __call__(self, database, items): + def __call__(self, database, items, uistate): """Callable class, usable as a function. This guarantees the class is instantiated once when a service is registered. Afterward only calls occur database: Database to work on items: list of tuples (place_handle, description), where description is None or a string to use for marker (eg 'birth John Doe') + uistate: This is only used for transient windows if needed """ self.database = database self.items = items + self.uistate = uistate self.url = '' #An instance is called, we display the result self.calc_url() diff --git a/gramps/plugins/lib/libplaceview.py b/gramps/plugins/lib/libplaceview.py index 53d7c7501..23b96b8b2 100644 --- a/gramps/plugins/lib/libplaceview.py +++ b/gramps/plugins/lib/libplaceview.py @@ -282,7 +282,7 @@ class PlaceBaseView(ListView): mod = pmgr.load_plugin(serv) if mod: servfunc = eval('mod.' + serv.mapservice) - servfunc()(self.dbstate.db, places) + servfunc()(self.dbstate.db, places, self.uistate) else: print('Failed to load map plugin, see Plugin Manager') diff --git a/gramps/plugins/mapservices/eniroswedenmap.py b/gramps/plugins/mapservices/eniroswedenmap.py index 2163f2c8f..2df215007 100644 --- a/gramps/plugins/mapservices/eniroswedenmap.py +++ b/gramps/plugins/mapservices/eniroswedenmap.py @@ -144,7 +144,8 @@ class EniroSVMapService(MapService): else: msg2 = _("Latitude not within '54.55' to '69.05'\n") + \ _("Longitude not within '8.05' to '24.15'") - WarningDialog(_("Eniro map not available"), msg2) # no-parent + WarningDialog(_("Eniro map not available"), msg2, # parent-OK + parent=self.uistate.window) return if coord_ok: @@ -171,13 +172,15 @@ class EniroSVMapService(MapService): self.url = path.replace(" ","%20") return else: - WarningDialog(_("Eniro map not available"), # no-parent - _("Coordinates needed in Denmark")) + WarningDialog(_("Eniro map not available"), # parent-OK + _("Coordinates needed in Denmark"), + parent=self.uistate.window) self.url = "" return - WarningDialog(_("Eniro map not available"), # no-parent + WarningDialog(_("Eniro map not available"), # parent-OK _("Latitude and longitude,\n" - "or street and city needed")) + "or street and city needed"), + parent=self.uistate.window) return