diff options
Diffstat (limited to 'fungus/splash_window.py')
| -rw-r--r-- | fungus/splash_window.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fungus/splash_window.py b/fungus/splash_window.py index f18918c..4102644 100644 --- a/fungus/splash_window.py +++ b/fungus/splash_window.py @@ -124,6 +124,9 @@ class SplashWindow: """ assert self._window is not None + # Reveal the window if it was hidden when the game started + self._window.show_all() + # Update window title with exit code current_title = self._window.get_title() or "" self._window.set_title(f"{current_title} — exited with code {exit_code}") @@ -142,15 +145,24 @@ class SplashWindow: self._close_button.set_sensitive(True) def close(self) -> None: + """Hide the splash window. + + Called when the game has started — the window is kept alive so + output can continue to be written and it can be shown again if + the game exits with an error. + """ + if self._window is not None: + self._window.hide() + + def _destroy(self) -> None: """Destroy the splash window and invoke the close callback. - The callback is cleared after the first invocation to prevent - an infinite loop: ``close()`` → ``_on_close()`` → ``idle_add(close)`` - → ``close()`` → … + Called during final cleanup (process exit). The callback is + cleared after the first invocation to prevent an infinite loop. """ if self._window is not None: self._window.destroy() # type: ignore[union-attr] - # Clear the callback so repeated close() calls are no-ops. + # Clear the callback so repeated _destroy() calls are no-ops. self._on_close() self._on_close = lambda: None |
