mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 13:25:31 +08:00
Update benchmarks.py
This commit is contained in:
parent
6efd0822a7
commit
50bc3865d4
@ -8,7 +8,6 @@ import logging
|
||||
from typing import cast, override
|
||||
|
||||
import bauiv1 as bui
|
||||
import bascenev1 as bs
|
||||
|
||||
|
||||
class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||
@ -26,13 +25,16 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||
uiscale = bui.app.ui_v1.uiscale
|
||||
self._width = width = 650 if uiscale is bui.UIScale.SMALL else 580
|
||||
self._height = height = (
|
||||
330
|
||||
400
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 420 if uiscale is bui.UIScale.MEDIUM else 520
|
||||
)
|
||||
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
|
||||
|
||||
self._scroll_width = self._width - 100
|
||||
self._scroll_height = self._height - 120
|
||||
self._scroll_height = self._height - (
|
||||
180 if uiscale is bui.UIScale.SMALL else 120
|
||||
)
|
||||
|
||||
self._sub_width = self._scroll_width * 0.95
|
||||
self._sub_height = 520
|
||||
@ -73,7 +75,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||
else:
|
||||
self._done_button = btn = bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
position=(40, height - 67),
|
||||
position=(40, height - 67 + yoffs),
|
||||
size=(120, 60),
|
||||
scale=0.8,
|
||||
autoselect=True,
|
||||
@ -84,7 +86,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||
|
||||
bui.textwidget(
|
||||
parent=self._root_widget,
|
||||
position=(0, height - 60),
|
||||
position=(0, height - 60 + yoffs),
|
||||
size=(width, 30),
|
||||
text=bui.Lstr(resource=f'{self._r}.titleText'),
|
||||
h_align='center',
|
||||
@ -97,7 +99,10 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||
parent=self._root_widget,
|
||||
highlight=False,
|
||||
size=(self._scroll_width, self._scroll_height),
|
||||
position=((self._width - self._scroll_width) * 0.5, 50),
|
||||
position=(
|
||||
(self._width - self._scroll_width) * 0.5,
|
||||
(115 if uiscale is bui.UIScale.SMALL else 50) + yoffs,
|
||||
),
|
||||
)
|
||||
bui.containerwidget(edit=self._scrollwidget, claims_left_right=True)
|
||||
|
||||
@ -367,26 +372,16 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
||||
bui.app.classic.run_media_reload_benchmark()
|
||||
|
||||
def _stress_test_pressed(self) -> None:
|
||||
from bascenev1lib.mainmenu import MainMenuActivity
|
||||
|
||||
if bui.app.classic is None:
|
||||
logging.warning('stress-test requires classic')
|
||||
return
|
||||
|
||||
activity = bs.get_foreground_host_activity()
|
||||
if isinstance(activity, MainMenuActivity):
|
||||
bui.app.classic.run_stress_test(
|
||||
playlist_type=self._stress_test_game_type,
|
||||
playlist_name=cast(
|
||||
str, bui.textwidget(
|
||||
query=self._stress_test_playlist_name_field
|
||||
)
|
||||
),
|
||||
player_count=self._stress_test_player_count,
|
||||
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.')
|
||||
)
|
||||
bui.app.classic.run_stress_test(
|
||||
playlist_type=self._stress_test_game_type,
|
||||
playlist_name=cast(
|
||||
str, bui.textwidget(query=self._stress_test_playlist_name_field)
|
||||
),
|
||||
player_count=self._stress_test_player_count,
|
||||
round_duration=self._stress_test_round_duration,
|
||||
)
|
||||
bui.containerwidget(edit=self._root_widget, transition='out_right')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user