8128: GtkDialog mapped without a transient parent -- partial

This commit is contained in:
Paul Franklin 2016-04-16 10:48:48 -07:00
parent 5628198bb2
commit 269f9e7626
7 changed files with 26 additions and 13 deletions

View File

@ -114,7 +114,7 @@ class User():
finally:
self.end_progress()
def prompt(self, title, message, accept_label, reject_label):
def prompt(self, title, message, accept_label, reject_label, parent=None):
"""
Prompt the user with a message to select an alternative.

View File

@ -1222,7 +1222,8 @@ class GuiPersonListOption(Gtk.Box):
prompt = OptionDialog(_('Select Person'),
text,
_('No'), None,
_('Yes'), None)
_('Yes'), None,
parent=self.__uistate.window)
if prompt.get_response() == Gtk.ResponseType.YES:
gid = spouse.get_gramps_id()
self.__model.append([spouse_name, gid])

View File

@ -127,7 +127,7 @@ class ChangeTypes(tool.BatchTool, ManagedWindow):
"{number_of} event records were modified.", modified
).format(number_of=modified)
self.user.info(_('Change types'), msg, parent_window)
self.user.info(_('Change types'), msg, parent=parent_window)
return (bool(modified),msg)
def on_apply_clicked(self, obj):

View File

@ -111,15 +111,21 @@ class EventNames(tool.BatchTool):
self.db.enable_signals()
self.db.request_rebuild()
if hasattr(self.user.uistate, 'window'):
parent_window = self.user.uistate.window
else:
parent_window = None
if self.change == True:
# translators: leave all/any {...} untranslated
message = ngettext("{quantity} event description has been added",
"{quantity} event descriptions have been added",
counter).format(quantity=counter)
self.user.info(_('Modifications made'), message)
self.user.info(_('Modifications made'), message,
parent=parent_window)
else:
self.user.info(_('No modifications made'),
_("No event description has been added."))
_("No event description has been added."),
parent=parent_window)
#-------------------------------------------------------------------------
#

View File

@ -415,18 +415,18 @@ class ExtractCity(tool.BatchTool, ManagedWindow):
"""
def __init__(self, dbstate, user, options_class, name, callback=None):
uistate = user.uistate
self.uistate = user.uistate
self.label = _('Extract Place data')
ManagedWindow.__init__(self, uistate, [], self.__class__)
ManagedWindow.__init__(self, self.uistate, [], self.__class__)
self.set_window(Gtk.Window(), Gtk.Label(), '')
tool.BatchTool.__init__(self, dbstate, user, options_class, name)
if not self.fail:
uistate.set_busy_cursor(True)
self.uistate.set_busy_cursor(True)
self.run(dbstate.db)
uistate.set_busy_cursor(False)
self.uistate.set_busy_cursor(False)
def run(self, db):
"""
@ -521,7 +521,8 @@ class ExtractCity(tool.BatchTool, ManagedWindow):
self.close()
from gramps.gui.dialog import OkDialog
OkDialog(_('No modifications made'),
_("No place information could be extracted."))
_("No place information could be extracted."),
parent=self.uistate.window)
def display(self):

View File

@ -91,6 +91,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
def __init__(self, dbstate, user, options_class, name, callback=None):
uistate = user.uistate
self.user = user
ManagedWindow.__init__(self, uistate, [], self.__class__)
self.dbstate = dbstate
@ -124,6 +125,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
self.menu.set_active(fields)
window = top.toplevel
window.set_transient_for(self.user.uistate.window)
window.show()
# self.set_window(window, top.get_object('title'),
# _('Merge citations'))
@ -179,7 +181,8 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
# Save options
self.options.handler.save_options()
self.progress = ProgressMeter(_('Checking Sources'), '')
self.progress = ProgressMeter(_('Checking Sources'), '',
parent=self.user.uistate.window)
self.progress.set_pass(_('Looking for citation fields'),
self.db.get_number_of_citations())
@ -230,7 +233,8 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
# translators: leave all/any {...} untranslated
ngettext("{number_of} citation merged",
"{number_of} citations merged", num_merges
).format(number_of=num_merges) )
).format(number_of=num_merges),
parent=self.user.uistate.window)
self.close(obj)
#------------------------------------------------------------------------

View File

@ -361,7 +361,8 @@ class PatchNames(tool.BatchTool, ManagedWindow):
self.progress.close()
self.close()
OkDialog(_('No modifications made'),
_("No titles, nicknames or prefixes were found"))
_("No titles, nicknames or prefixes were found"),
parent=self.uistate.window)
def build_menu_names(self, obj):
return (self.label, None)