mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-08 00:30:22 +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
|
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):
|
||||||
@ -26,13 +25,16 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
|||||||
uiscale = bui.app.ui_v1.uiscale
|
uiscale = bui.app.ui_v1.uiscale
|
||||||
self._width = width = 650 if uiscale is bui.UIScale.SMALL else 580
|
self._width = width = 650 if uiscale is bui.UIScale.SMALL else 580
|
||||||
self._height = height = (
|
self._height = height = (
|
||||||
330
|
400
|
||||||
if uiscale is bui.UIScale.SMALL
|
if uiscale is bui.UIScale.SMALL
|
||||||
else 420 if uiscale is bui.UIScale.MEDIUM else 520
|
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_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_width = self._scroll_width * 0.95
|
||||||
self._sub_height = 520
|
self._sub_height = 520
|
||||||
@ -73,7 +75,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
|||||||
else:
|
else:
|
||||||
self._done_button = btn = bui.buttonwidget(
|
self._done_button = btn = bui.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(40, height - 67),
|
position=(40, height - 67 + yoffs),
|
||||||
size=(120, 60),
|
size=(120, 60),
|
||||||
scale=0.8,
|
scale=0.8,
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
@ -84,7 +86,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
|||||||
|
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(0, height - 60),
|
position=(0, height - 60 + yoffs),
|
||||||
size=(width, 30),
|
size=(width, 30),
|
||||||
text=bui.Lstr(resource=f'{self._r}.titleText'),
|
text=bui.Lstr(resource=f'{self._r}.titleText'),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -97,7 +99,10 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
|
|||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
highlight=False,
|
highlight=False,
|
||||||
size=(self._scroll_width, self._scroll_height),
|
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)
|
bui.containerwidget(edit=self._scrollwidget, claims_left_right=True)
|
||||||
|
|
||||||
@ -367,26 +372,16 @@ 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
|
||||||
|
|
||||||
activity = bs.get_foreground_host_activity()
|
bui.app.classic.run_stress_test(
|
||||||
if isinstance(activity, MainMenuActivity):
|
playlist_type=self._stress_test_game_type,
|
||||||
bui.app.classic.run_stress_test(
|
playlist_name=cast(
|
||||||
playlist_type=self._stress_test_game_type,
|
str, bui.textwidget(query=self._stress_test_playlist_name_field)
|
||||||
playlist_name=cast(
|
),
|
||||||
str, bui.textwidget(
|
player_count=self._stress_test_player_count,
|
||||||
query=self._stress_test_playlist_name_field
|
round_duration=self._stress_test_round_duration,
|
||||||
)
|
)
|
||||||
),
|
bui.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
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.')
|
|
||||||
)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user