diff --git a/gramps/gui/plug/report/_bookdialog.py b/gramps/gui/plug/report/_bookdialog.py index 3d8285133..5b633d799 100644 --- a/gramps/gui/plug/report/_bookdialog.py +++ b/gramps/gui/plug/report/_bookdialog.py @@ -493,8 +493,9 @@ class BookSelector(ManagedWindow): '%s.\n\n This makes references to the central person ' 'saved in the book invalid.\n\n' 'Therefore, the central person for each item is being set ' - 'to the active person of the currently opened database.' ) - % book.get_dbname() ) + 'to the active person of the currently opened database.') + % book.get_dbname(), + parent=self.window) self.book.clear() self.book_model.clear() @@ -591,8 +592,8 @@ class BookSelector(ManagedWindow): store, the_iter = self.book_model.get_selected() if not the_iter: WarningDialog(_('No selected book item'), - _('Please select a book item to configure.') - ) + _('Please select a book item to configure.'), + parent=self.window) return data = self.book_model.get_data(the_iter, list(range(self.book_nr_cols))) row = self.book_model.get_selected_row() @@ -705,7 +706,8 @@ class BookSelector(ManagedWindow): BookDialog(self.dbstate, self.uistate, self.book, BookOptions) else: - WarningDialog(_('No items'), _('This book has no items.')) + WarningDialog(_('No items'), _('This book has no items.'), + parent=self.window) return self.close() @@ -718,8 +720,8 @@ class BookSelector(ManagedWindow): if not name: WarningDialog(_('No book name'), _( 'You are about to save away a book with no name.\n\n' - 'Please give it a name before saving it away.') - ) + 'Please give it a name before saving it away.'), + parent=self.window) return if name in self.book_list.get_book_names(): from ...dialog import QuestionDialog2 @@ -729,7 +731,8 @@ class BookSelector(ManagedWindow): 'book with a name which already exists.' ), _('Proceed'), - _('Cancel')) + _('Cancel'), + parent=self.window) if q.run(): self.book.set_name(name) else: @@ -925,7 +928,7 @@ class BookDialog(DocReportDialog): try: self.make_book() except (IOError, OSError) as msg: - ErrorDialog(str(msg)) + ErrorDialog(str(msg), parent=self.window) self.close() def setup_style_frame(self): pass diff --git a/gramps/gui/plug/report/_fileentry.py b/gramps/gui/plug/report/_fileentry.py index 42902bf05..1a61b09ac 100644 --- a/gramps/gui/plug/report/_fileentry.py +++ b/gramps/gui/plug/report/_fileentry.py @@ -26,10 +26,11 @@ from gi.repository import GObject from gramps.gen.constfunc import conv_to_unicode, get_curr_dir class FileEntry(Gtk.Box): """ A widget that allows the user to select a file from the file system """ - def __init__(self, defname, title): + def __init__(self, defname, title, parent=None): Gtk.Box.__init__(self) self.title = title + self.parent = parent self.dir = False self.__base_path = "" self.__file_name = "" @@ -54,6 +55,7 @@ class FileEntry(Gtk.Box): my_action = Gtk.FileChooserAction.SAVE dialog = Gtk.FileChooserDialog(self.title, + self.parent, action=my_action, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, diff --git a/gramps/gui/plug/report/_reportdialog.py b/gramps/gui/plug/report/_reportdialog.py index 6a4c3512a..9fc7d54f5 100644 --- a/gramps/gui/plug/report/_reportdialog.py +++ b/gramps/gui/plug/report/_reportdialog.py @@ -445,7 +445,7 @@ class ReportDialog(ManagedWindow): hid = self.style_name if hid[-4:] == ".xml": hid = hid[0:-4] - self.target_fileentry = FileEntry(hid, _("Save As")) + self.target_fileentry = FileEntry(hid, _("Save As"), parent=self.window) spath = self.get_default_directory() self.target_fileentry.set_filename(spath) # need any labels at top: @@ -499,8 +499,8 @@ class ReportDialog(ManagedWindow): _("You do not have permission to write " "under the directory %s\n\n" "Please select another directory or correct " - "the permissions.") % self.target_path - ) + "the permissions.") % self.target_path, + parent=self.window) return None # selected path is an existing file and we need a file @@ -509,7 +509,8 @@ class ReportDialog(ManagedWindow): _('You can choose to either overwrite the ' 'file, or change the selected filename.'), _('_Overwrite'), None, - _('_Change filename'), None) + _('_Change filename'), None, + parent=self.window) if a.get_response() == Gtk.ResponseType.YES: return None @@ -524,8 +525,8 @@ class ReportDialog(ManagedWindow): _("You do not have permission to create " "%s\n\n" "Please select another path or correct " - "the permissions.") % self.target_path - ) + "the permissions.") % self.target_path, + parent=self.window) return None self.set_default_directory(os.path.dirname(self.target_path) + os.sep) @@ -651,7 +652,8 @@ def report(dbstate, uistate, person, report_class, options_class, ErrorDialog( _('Active person has not been set'), _('You must select an active person for this report to work ' - 'properly.')) + 'properly.'), + parent=uistate.window) return if category == CATEGORY_TEXT: @@ -699,14 +701,16 @@ def report(dbstate, uistate, person, report_class, options_class, except FilterError as msg: (m1, m2) = msg.messages() - ErrorDialog(m1, m2) + ErrorDialog(m1, m2, parent=uistate.window) except IOError as msg: - ErrorDialog(_("Report could not be created"), str(msg)) + ErrorDialog(_("Report could not be created"), str(msg), + parent=uistate.window) except ReportError as msg: (m1, m2) = msg.messages() - ErrorDialog(m1, m2) + ErrorDialog(m1, m2, parent=uistate.window) except DatabaseError as msg: - ErrorDialog(_("Report could not be created"), str(msg)) + ErrorDialog(_("Report could not be created"), str(msg), + parent=uistate.window) # The following except statement will catch all "NoneType" exceptions. # This is useful for released code where the exception is most likely # a corrupt database. But it is less useful for developing new reports