mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 06:53:18 +08:00
Adding checks to make sure stress-test doesn't run during game
This commit is contained in:
parent
918988f5cd
commit
073013c778
@ -8,7 +8,7 @@ import logging
|
|||||||
from typing import cast, override
|
from typing import cast, override
|
||||||
|
|
||||||
import bauiv1 as bui
|
import bauiv1 as bui
|
||||||
|
import bascenev1 as bs
|
||||||
|
|
||||||
class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||||
"""Window for launching benchmarks or stress tests."""
|
"""Window for launching benchmarks or stress tests."""
|
||||||
@ -372,16 +372,22 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
|||||||
bui.app.classic.run_media_reload_benchmark()
|
bui.app.classic.run_media_reload_benchmark()
|
||||||
|
|
||||||
def _stress_test_pressed(self) -> None:
|
def _stress_test_pressed(self) -> None:
|
||||||
|
from bascenev1lib.mainmenu import MainMenuActivity
|
||||||
|
|
||||||
if bui.app.classic is None:
|
if bui.app.classic is None:
|
||||||
logging.warning('stress-test requires classic')
|
logging.warning('stress-test requires classic')
|
||||||
return
|
return
|
||||||
|
|
||||||
bui.app.classic.run_stress_test(
|
activity = bs.get_foreground_host_activity()
|
||||||
playlist_type=self._stress_test_game_type,
|
if isinstance(activity, MainMenuActivity):
|
||||||
playlist_name=cast(
|
bui.app.classic.run_stress_test(
|
||||||
str, bui.textwidget(query=self._stress_test_playlist_name_field)
|
playlist_type=self._stress_test_game_type,
|
||||||
),
|
playlist_name=cast(
|
||||||
player_count=self._stress_test_player_count,
|
str, bui.textwidget(query=self._stress_test_playlist_name_field)
|
||||||
round_duration=self._stress_test_round_duration,
|
),
|
||||||
)
|
player_count=self._stress_test_player_count,
|
||||||
bui.containerwidget(edit=self._root_widget, transition='out_right')
|
round_duration=self._stress_test_round_duration,
|
||||||
|
)
|
||||||
|
bui.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
|
else:
|
||||||
|
bui.screenmessage(bui.Lstr(value='Already present in another activity.'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user