From ea82fc981d6617b4d48d90825136fa73336b451e Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sat, 30 Jul 2016 17:01:34 -0700 Subject: [PATCH] 8128: GtkDialog mapped without a transient parent --- gramps/gui/dialog.py | 2 ++ gramps/gui/editors/addmedia.py | 5 +++-- gramps/gui/editors/editattribute.py | 3 ++- gramps/gui/editors/editcitation.py | 4 ++-- gramps/gui/editors/editevent.py | 8 +++++--- gramps/gui/editors/editfamily.py | 14 +++++++++----- gramps/gui/editors/editmedia.py | 7 ++++--- gramps/gui/editors/editname.py | 6 ++++-- gramps/gui/editors/editnote.py | 5 +++-- gramps/gui/editors/editperson.py | 7 ++++--- gramps/gui/editors/editplace.py | 4 ++-- gramps/gui/editors/editplacename.py | 3 ++- gramps/gui/editors/editplaceref.py | 2 +- gramps/gui/editors/editprimary.py | 2 +- gramps/gui/editors/editreference.py | 2 +- gramps/gui/editors/editrepository.py | 5 +++-- gramps/gui/editors/editsource.py | 5 +++-- gramps/gui/editors/filtereditor.py | 2 +- 18 files changed, 52 insertions(+), 34 deletions(-) diff --git a/gramps/gui/dialog.py b/gramps/gui/dialog.py index 541d050fd..817909425 100644 --- a/gramps/gui/dialog.py +++ b/gramps/gui/dialog.py @@ -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() diff --git a/gramps/gui/editors/addmedia.py b/gramps/gui/editors/addmedia.py index b1cbbe181..a713554ed 100644 --- a/gramps/gui/editors/addmedia.py +++ b/gramps/gui/editors/addmedia.py @@ -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) diff --git a/gramps/gui/editors/editattribute.py b/gramps/gui/editors/editattribute.py index 3de9da775..4a36d9240 100644 --- a/gramps/gui/editors/editattribute.py +++ b/gramps/gui/editors/editattribute.py @@ -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) diff --git a/gramps/gui/editors/editcitation.py b/gramps/gui/editors/editcitation.py index 191d1d357..d0bc1a7aa 100644 --- a/gramps/gui/editors/editcitation.py +++ b/gramps/gui/editors/editcitation.py @@ -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 diff --git a/gramps/gui/editors/editevent.py b/gramps/gui/editors/editevent.py index 061f45e97..a26959ea9 100644 --- a/gramps/gui/editors/editevent.py +++ b/gramps/gui/editors/editevent.py @@ -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 diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py index 125616ec7..78ed117ff 100644 --- a/gramps/gui/editors/editfamily.py +++ b/gramps/gui/editors/editfamily.py @@ -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 diff --git a/gramps/gui/editors/editmedia.py b/gramps/gui/editors/editmedia.py index 594d2cb42..b027dccbb 100644 --- a/gramps/gui/editors/editmedia.py +++ b/gramps/gui/editors/editmedia.py @@ -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 diff --git a/gramps/gui/editors/editname.py b/gramps/gui/editors/editname.py index a8c02330e..0ec2763d3 100644 --- a/gramps/gui/editors/editname.py +++ b/gramps/gui/editors/editname.py @@ -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 : diff --git a/gramps/gui/editors/editnote.py b/gramps/gui/editors/editnote.py index 63ab37602..ffb536574 100644 --- a/gramps/gui/editors/editnote.py +++ b/gramps/gui/editors/editnote.py @@ -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 diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index 9fa3a6336..579cbf750 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -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 diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py index e6c734cba..12a5247a5 100644 --- a/gramps/gui/editors/editplace.py +++ b/gramps/gui/editors/editplace.py @@ -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 diff --git a/gramps/gui/editors/editplacename.py b/gramps/gui/editors/editplacename.py index b04683d51..e627d51a1 100644 --- a/gramps/gui/editors/editplacename.py +++ b/gramps/gui/editors/editplacename.py @@ -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: diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index 01cd44806..9592f648a 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -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 diff --git a/gramps/gui/editors/editprimary.py b/gramps/gui/editors/editprimary.py index 9a7acc75c..29df45f68 100644 --- a/gramps/gui/editors/editprimary.py +++ b/gramps/gui/editors/editprimary.py @@ -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() diff --git a/gramps/gui/editors/editreference.py b/gramps/gui/editors/editreference.py index bcfdce3a1..5282d1f8c 100644 --- a/gramps/gui/editors/editreference.py +++ b/gramps/gui/editors/editreference.py @@ -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 diff --git a/gramps/gui/editors/editrepository.py b/gramps/gui/editors/editrepository.py index d0e898c95..1f1291b06 100644 --- a/gramps/gui/editors/editrepository.py +++ b/gramps/gui/editors/editrepository.py @@ -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 diff --git a/gramps/gui/editors/editsource.py b/gramps/gui/editors/editsource.py index c75d9ba99..bb8a98aed 100644 --- a/gramps/gui/editors/editsource.py +++ b/gramps/gui/editors/editsource.py @@ -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 diff --git a/gramps/gui/editors/filtereditor.py b/gramps/gui/editors/filtereditor.py index f1223e345..2ab8b29e9 100644 --- a/gramps/gui/editors/filtereditor.py +++ b/gramps/gui/editors/filtereditor.py @@ -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()