8128: GtkDialog mapped without a transient parent

This commit is contained in:
SNoiraud 2016-08-03 22:42:45 +02:00
parent 2a7907c6c1
commit 675ae1a8d4
3 changed files with 12 additions and 7 deletions

View File

@ -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()

View File

@ -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')

View File

@ -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