Fixed main menu return location (Issue #59)

This commit is contained in:
Eric Froemling 2020-06-17 22:18:46 -07:00
parent baac8eb489
commit 1131752185
3 changed files with 8 additions and 5 deletions

View File

@ -661,13 +661,16 @@ class App:
# FIXME: This should not be an actor attr. # FIXME: This should not be an actor attr.
activity.paused_text = None 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.""" """Attempt to cleanly get back to the main menu."""
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from ba import _benchmark from ba import _benchmark
from ba._general import Call from ba._general import Call
from bastd.mainmenu import MainMenuSession 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): if isinstance(_ba.get_foreground_host_session(), MainMenuSession):
# It may be possible we're on the main menu but the screen is faded # It may be possible we're on the main menu but the screen is faded
# so fade back in. # so fade back in.

View File

@ -874,7 +874,7 @@ class MainMenuWindow(ba.Window):
if not self._root_widget: if not self._root_widget:
return return
ba.containerwidget(edit=self._root_widget, transition='out_left') 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: def _leave(self) -> None:
if self._input_player: if self._input_player:

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-06-16 for Ballistica version 1.5.5 build 20071</em></h4> <h4><em>last updated on 2020-06-17 for Ballistica version 1.5.6 build 20074</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <p>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 <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p> 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 <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr> <hr>
@ -990,7 +990,7 @@ to resume.</p>
</dd> </dd>
<dt><h4><a name="method_ba_App__return_to_main_menu_session_gracefully">return_to_main_menu_session_gracefully()</a></dt></h4><dd> <dt><h4><a name="method_ba_App__return_to_main_menu_session_gracefully">return_to_main_menu_session_gracefully()</a></dt></h4><dd>
<p><span>return_to_main_menu_session_gracefully(self) -&gt; None</span></p> <p><span>return_to_main_menu_session_gracefully(self, reset_ui: bool = True) -&gt; None</span></p>
<p>Attempt to cleanly get back to the main menu.</p> <p>Attempt to cleanly get back to the main menu.</p>