From dc34c7f0bb23e706b2b399dedc715d93aa457ec9 Mon Sep 17 00:00:00 2001 From: jmichault Date: Sat, 27 May 2023 15:42:21 +0200 Subject: [PATCH] add a splash screen on startup --- gramps/gui/grampsgui.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gramps/gui/grampsgui.py b/gramps/gui/grampsgui.py index b5ee1b52354..52c21a9de46 100644 --- a/gramps/gui/grampsgui.py +++ b/gramps/gui/grampsgui.py @@ -38,7 +38,7 @@ # #------------------------------------------------------------------------- from gramps.gen.config import config -from gramps.gen.const import DATA_DIR, IMAGE_DIR, GTK_GETTEXT_DOMAIN +from gramps.gen.const import DATA_DIR, IMAGE_DIR, GTK_GETTEXT_DOMAIN, SPLASH from gramps.gen.constfunc import has_display, lin from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext @@ -440,6 +440,20 @@ "Gramps will terminate now.")) sys.exit(1) +# Create splash screen +try: + from gi.repository import Gtk, Gdk + splash = Gtk.Window() + splash.props.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN + splash.set_decorated(False) + splash.set_position(Gtk.WindowPosition.CENTER) + splash.add(Gtk.Image().new_from_file(SPLASH)) + splash.show_all() + while Gtk.events_pending(): + Gtk.main_iteration() +except: + print("Failed to create splash screen") + #------------------------------------------------------------------------- # # Functions @@ -710,3 +724,4 @@ def do_activate(self): else: print('Gramps is already running.') self.window.present() + splash.destroy()