8128: GtkDialog mapped without a transient parent

This commit is contained in:
Paul Franklin 2016-07-30 17:01:34 -07:00
parent bedf94056b
commit ea82fc981d
18 changed files with 52 additions and 34 deletions

View File

@ -431,6 +431,8 @@ class MessageHideDialog:
self.xml.get_object('message').set_text(message)
dont_show.connect('toggled', self.update_checkbox, key)
if parent:
self.top.set_transient_for(parent)
self.top.run()
self.top.destroy()

View File

@ -157,7 +157,7 @@ class AddMedia(ManagedWindow):
if self.file_text.get_filename() is None:
msgstr = _("Import failed")
msgstr2 = _("The filename supplied could not be found.")
ErrorDialog(msgstr, msgstr2)
ErrorDialog(msgstr, msgstr2, parent=self.window)
return
filename = self.file_text.get_filename()
@ -168,7 +168,8 @@ class AddMedia(ManagedWindow):
if not os.path.exists(pname):
msgstr = _("Cannot import %s")
msgstr2 = _("Directory specified in preferences: Base path for relative media paths: %s does not exist. Change preferences or do not use relative path when importing")
ErrorDialog(msgstr % filename, msgstr2 % pname)
ErrorDialog(msgstr % filename, msgstr2 % pname,
parent=self.window)
return
filename = relative_path(filename, pname)

View File

@ -147,7 +147,8 @@ class EditAttributeRoot(EditSecondary):
from ..dialog import ErrorDialog
ErrorDialog(
_("Cannot save attribute"),
_("The attribute type cannot be empty"))
_("The attribute type cannot be empty"),
parent=self.window)
return
if self.callback:
self.callback(self.obj)

View File

@ -291,7 +291,7 @@ class EditCitation(EditPrimary):
"derived. To create a citation, first select the "
"required source, and then record the location of "
"the information referenced within the source in the "
"'Volume/Page' field."))
"'Volume/Page' field."), parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -305,7 +305,7 @@ class EditCitation(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : gramps_id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -238,7 +238,8 @@ class EditEvent(EditPrimary):
if self.object_is_empty():
ErrorDialog(_("Cannot save event"),
_("No data exists for this event. Please "
"enter data or cancel the edit."))
"enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -252,7 +253,7 @@ class EditEvent(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -260,7 +261,8 @@ class EditEvent(EditPrimary):
if t.is_custom() and str(t) == '':
ErrorDialog(
_("Cannot save event"),
_("The event type cannot be empty"))
_("The event type cannot be empty"),
parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -371,7 +371,8 @@ class EditFamily(EditPrimary):
"are available when you create a new family. The "
"remaining fields will become available after you "
"attempt to select a parent."),
'preferences.family-warn')
'preferences.family-warn',
parent=self.window)
else:
self.add_parent = False
@ -1062,7 +1063,8 @@ class EditFamily(EditPrimary):
father.gramps_id)
ErrorDialog(_("A father cannot be his own child"),
_("%s is listed as both the father and child "
"of the family.") % name)
"of the family.") % name,
parent=self.window)
self.ok_button.set_sensitive(True)
return
elif self.obj.get_mother_handle() in child_list:
@ -1072,7 +1074,8 @@ class EditFamily(EditPrimary):
mother.gramps_id)
ErrorDialog(_("A mother cannot be her own child"),
_("%s is listed as both the mother and child "
"of the family.") % name)
"of the family.") % name,
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -1080,7 +1083,8 @@ class EditFamily(EditPrimary):
ErrorDialog(
_("Cannot save family"),
_("No data exists for this family. "
"Please enter data or cancel the edit."))
"Please enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -1092,7 +1096,7 @@ class EditFamily(EditPrimary):
"enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id}
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -287,7 +287,8 @@ class EditMedia(EditPrimary):
if self.object_is_empty():
ErrorDialog(_("Cannot save media object"),
_("No data exists for this media object. Please "
"enter data or cancel the edit."))
"enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -301,7 +302,7 @@ class EditMedia(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -315,7 +316,7 @@ class EditMedia(EditPrimary):
"value '%(path)s'. This path does not exist!"
" Please enter a different path") % {
'path' : path }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -383,7 +383,8 @@ class EditName(EditSecondary):
) % { 'surname' : surname,
'group_name':group_as},
_("Continue"),
_("Return to Name Editor"))
_("Return to Name Editor"),
parent=self.window)
val = q.run()
if val:
#delete the grouping link on database
@ -415,7 +416,8 @@ class EditName(EditSecondary):
) % { 'surname' : surname,
'group_name':group_as},
_("Group all"),
_("Group this name only"))
_("Group this name only"),
parent=self.window)
val = q.run()
if val:
if group_as == surname :

View File

@ -312,7 +312,8 @@ class EditNote(EditPrimary):
if self.object_is_empty():
ErrorDialog(_("Cannot save note"),
_("No data exists for this note. Please "
"enter data or cancel the edit."))
"enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -324,7 +325,7 @@ class EditNote(EditPrimary):
"enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -810,7 +810,7 @@ class EditPerson(EditPrimary):
msg = _("Changing the gender caused problems "
"with marriage information.\nPlease check "
"the person's marriages.")
ErrorDialog(msg2, msg)
ErrorDialog(msg2, msg, parent=self.window)
def save(self, *obj):
"""
@ -820,7 +820,8 @@ class EditPerson(EditPrimary):
if self.object_is_empty():
ErrorDialog(_("Cannot save person"),
_("No data exists for this person. Please "
"enter data or cancel the edit."))
"enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
# fix surname problems
@ -848,7 +849,7 @@ class EditPerson(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -285,7 +285,7 @@ class EditPlace(EditPrimary):
if self.obj.get_name().get_value().strip() == '':
msg1 = _("Cannot save place. Name not entered.")
msg2 = _("You must enter a name before saving.")
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -299,7 +299,7 @@ class EditPlace(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -136,7 +136,8 @@ class EditPlaceName(EditSecondary):
def save(self, *obj):
if not self.obj.get_value():
ErrorDialog(_("Cannot save place name"),
_("The place name cannot be empty"))
_("The place name cannot be empty"),
parent=self.window)
return
if self.callback:

View File

@ -276,7 +276,7 @@ class EditPlaceRef(EditReference):
if self.source.get_name().get_value().strip() == '':
msg1 = _("Cannot save place. Name not entered.")
msg2 = _("You must enter a name before saving.")
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -240,7 +240,7 @@ class EditPrimary(ManagedWindow, DbGUIElement, metaclass=abc.ABCMeta):
'have made will be lost'),
self._do_close,
self.save,
self.window)
parent=self.window)
return True
else:
self._do_close()

View File

@ -297,6 +297,6 @@ class EditReference(ManagedWindow, DbGUIElement):
"different ID or leave blank to get the next "
"available ID value.") % {
'id' : new_id}
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
return True
return False

View File

@ -178,7 +178,8 @@ class EditRepository(EditPrimary):
if self.object_is_empty():
ErrorDialog(_("Cannot save repository"),
_("No data exists for this repository. Please "
"enter data or cancel the edit."))
"enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -192,7 +193,7 @@ class EditRepository(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -198,7 +198,8 @@ class EditSource(EditPrimary):
if self.object_is_empty():
ErrorDialog(_("Cannot save source"),
_("No data exists for this source. Please "
"enter data or cancel the edit."))
"enter data or cancel the edit."),
parent=self.window)
self.ok_button.set_sensitive(True)
return
@ -212,7 +213,7 @@ class EditSource(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2)
ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True)
return

View File

@ -1184,7 +1184,7 @@ class FilterEditor(ManagedWindow):
'other filters that depend on it.'),
_('Delete Filter'),
self._do_delete_selected_filter,
self.window)
parent=self.window)
else:
self._do_delete_selected_filter()