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.items = None
self.url = '' self.url = ''
def __call__(self, database, items): def __call__(self, database, items, uistate):
"""Callable class, usable as a function. This guarantees the class is """Callable class, usable as a function. This guarantees the class is
instantiated once when a service is registered. Afterward only calls instantiated once when a service is registered. Afterward only calls
occur occur
database: Database to work on database: Database to work on
items: list of tuples (place_handle, description), where description items: list of tuples (place_handle, description), where description
is None or a string to use for marker (eg 'birth John Doe') 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.database = database
self.items = items self.items = items
self.uistate = uistate
self.url = '' self.url = ''
#An instance is called, we display the result #An instance is called, we display the result
self.calc_url() self.calc_url()

View File

@ -282,7 +282,7 @@ class PlaceBaseView(ListView):
mod = pmgr.load_plugin(serv) mod = pmgr.load_plugin(serv)
if mod: if mod:
servfunc = eval('mod.' + serv.mapservice) servfunc = eval('mod.' + serv.mapservice)
servfunc()(self.dbstate.db, places) servfunc()(self.dbstate.db, places, self.uistate)
else: else:
print('Failed to load map plugin, see Plugin Manager') print('Failed to load map plugin, see Plugin Manager')

View File

@ -144,7 +144,8 @@ class EniroSVMapService(MapService):
else: else:
msg2 = _("Latitude not within '54.55' to '69.05'\n") + \ msg2 = _("Latitude not within '54.55' to '69.05'\n") + \
_("Longitude not within '8.05' to '24.15'") _("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 return
if coord_ok: if coord_ok:
@ -171,13 +172,15 @@ class EniroSVMapService(MapService):
self.url = path.replace(" ","%20") self.url = path.replace(" ","%20")
return return
else: else:
WarningDialog(_("Eniro map not available"), # no-parent WarningDialog(_("Eniro map not available"), # parent-OK
_("Coordinates needed in Denmark")) _("Coordinates needed in Denmark"),
parent=self.uistate.window)
self.url = "" self.url = ""
return return
WarningDialog(_("Eniro map not available"), # no-parent WarningDialog(_("Eniro map not available"), # parent-OK
_("Latitude and longitude,\n" _("Latitude and longitude,\n"
"or street and city needed")) "or street and city needed"),
parent=self.uistate.window)
return return