From 113175218569626920ae4621a07355c0ddcfc489 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Wed, 17 Jun 2020 22:18:46 -0700 Subject: [PATCH] Fixed main menu return location (Issue #59) --- assets/src/ba_data/python/ba/_app.py | 7 +++++-- assets/src/ba_data/python/bastd/ui/mainmenu.py | 2 +- docs/ba_module.md | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/src/ba_data/python/ba/_app.py b/assets/src/ba_data/python/ba/_app.py index 9232a9ee..abe571f2 100644 --- a/assets/src/ba_data/python/ba/_app.py +++ b/assets/src/ba_data/python/ba/_app.py @@ -661,13 +661,16 @@ class App: # FIXME: This should not be an actor attr. activity.paused_text = None - def return_to_main_menu_session_gracefully(self) -> None: + def return_to_main_menu_session_gracefully(self, + reset_ui: bool = True) -> None: """Attempt to cleanly get back to the main menu.""" # pylint: disable=cyclic-import from ba import _benchmark from ba._general import Call from bastd.mainmenu import MainMenuSession - _ba.app.main_window = None + if reset_ui: + _ba.app.main_window = None + if isinstance(_ba.get_foreground_host_session(), MainMenuSession): # It may be possible we're on the main menu but the screen is faded # so fade back in. diff --git a/assets/src/ba_data/python/bastd/ui/mainmenu.py b/assets/src/ba_data/python/bastd/ui/mainmenu.py index 113f86b7..95a3135c 100644 --- a/assets/src/ba_data/python/bastd/ui/mainmenu.py +++ b/assets/src/ba_data/python/bastd/ui/mainmenu.py @@ -874,7 +874,7 @@ class MainMenuWindow(ba.Window): if not self._root_widget: return ba.containerwidget(edit=self._root_widget, transition='out_left') - ba.app.return_to_main_menu_session_gracefully() + ba.app.return_to_main_menu_session_gracefully(reset_ui=False) def _leave(self) -> None: if self._input_player: diff --git a/docs/ba_module.md b/docs/ba_module.md index ea3a1495..0f85eb2b 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-06-16 for Ballistica version 1.5.5 build 20071

+

last updated on 2020-06-17 for Ballistica version 1.5.6 build 20074

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


@@ -990,7 +990,7 @@ to resume.

return_to_main_menu_session_gracefully()

-

return_to_main_menu_session_gracefully(self) -> None

+

return_to_main_menu_session_gracefully(self, reset_ui: bool = True) -> None

Attempt to cleanly get back to the main menu.