From b6d8223192cd76f81f99b76cb7d4c7d04c2d7115 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Fri, 22 Jul 2016 19:26:24 -0700 Subject: [PATCH] 8128: GtkDialog mapped without a transient parent --- gramps/gui/grampsgui.py | 69 ++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/gramps/gui/grampsgui.py b/gramps/gui/grampsgui.py index b93eee7fc..a13a34418 100644 --- a/gramps/gui/grampsgui.py +++ b/gramps/gui/grampsgui.py @@ -120,7 +120,7 @@ except ImportError: # #------------------------------------------------------------------------- -def _display_welcome_message(): +def _display_welcome_message(parent=None): """ Display a welcome message to the user. """ @@ -145,11 +145,37 @@ def _display_welcome_message(): "them with this version, and make sure to export your " "data to XML every now and then.") % { 'bold_start' : '', - 'bold_end' : '' } ) + 'bold_end' : '' }, + parent=parent) config.set('behavior.autoload', False) config.set('behavior.betawarn', True) config.set('behavior.betawarn', config.get('behavior.betawarn')) +def _display_gtk_gettext_message(parent=None): + """ + Display a GTK-translations-missing message to the user. + """ + LOG.warning("GTK translations missing, GUI will be broken, " + "especially for RTL languages!") + from .dialog import WarningDialog + # Note: the warning dialog below will likely have wrong stock icons! + # Translators: the current language will be the one you translate into. + WarningDialog(_("Gramps detected an incomplete GTK installation"), + _("GTK translations for the current language (%(language)s) " + "are missing.\n" + "%(bold_start)sGramps%(bold_end)s will " + "proceed nevertheless.\n" + "The GUI will likely be broken " + "as a result, especially for RTL languages!\n\n" + "See the Gramps README documentation for installation " + "prerequisites,\n" + "typically located in " + "/usr/share/doc/gramps.\n" + ) % {'language' : glocale.lang, + 'bold_start' : '', + 'bold_end' : ''}, + parent=parent) + #------------------------------------------------------------------------- # # Main Gramps class @@ -172,33 +198,21 @@ class Gramps: from .dialog import WarningDialog import gettext - _display_welcome_message() - # Append image directory to the theme search path theme = Gtk.IconTheme.get_default() theme.append_search_path(IMAGE_DIR) - if lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN): - LOG.warning("GTK translations missing, GUI will be broken, " - "especially for RTL languages!") - # Note: the warning dialog below will likely have wrong stock icons! - # Translators: the current language will be the one you translate into. - WarningDialog( - _("Gramps detected an incomplete GTK installation"), - _("GTK translations for the current language (%(language)s) " - "are missing.\n%(bold_start)sGramps%(bold_end)s will " - "proceed nevertheless.\nThe GUI will likely be broken " - "as a result, especially for RTL languages!\n\n" - "See the Gramps README documentation for installation " - "prerequisites,\ntypically located in " - "/usr/share/doc/gramps.\n") % { - 'language' : glocale.lang , - 'bold_start' : '' , - 'bold_end' : '' } ) - dbstate = DbState() self.vm = ViewManager(dbstate, - config.get("interface.view-categories")) + config.get("interface.view-categories")) + + if (lin() + and glocale.lang != 'C' + and not gettext.find(GTK_GETTEXT_DOMAIN)): + _display_gtk_gettext_message(parent=self.vm.window) + + _display_welcome_message(parent=self.vm.window) + self.vm.init_interface() #act based on the given arguments @@ -226,9 +240,14 @@ class Gramps: TipOfDay(self.vm.uistate) def argerrorfunc(self, string): - from .dialog import ErrorDialog """ Show basic errors in argument handling in GUI fashion""" - ErrorDialog(_("Error parsing arguments"), string) + from .dialog import ErrorDialog + parent = None + if hasattr(self, 'vm'): + if hasattr(self.vm, 'uistate'): + if hasattr(self.vm.uistate, 'window'): + parent = self.vm.uistate.window + ErrorDialog(_("Error parsing arguments"), string, parent=parent) #------------------------------------------------------------------------- #