From c595e9114e48c1ea108ce6c0b7da15298b7f5f7b Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 6 Jun 2023 15:18:15 -0700 Subject: [PATCH] more untangling; make spinoff-test-ui_v1 should now succeed --- .efrocachemap | 40 ++++++------- CHANGELOG.md | 2 +- Makefile | 14 ++++- .../ba_data/python/baclassic/_subsystem.py | 56 +++++++++++++++++- src/assets/ba_data/python/baenv.py | 2 +- src/assets/ba_data/python/bauiv1/_hooks.py | 59 +++++++++---------- .../ba_data/python/bauiv1/ui/__init__.py | 12 ++-- src/ballistica/shared/ballistica.cc | 2 +- src/ballistica/ui_v1/widget/button_widget.h | 1 - 9 files changed, 125 insertions(+), 63 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 4a964809..81af334a 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,26 +4072,26 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/9f/3b/58131e0fa8d16b6216f613862b7e", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/f1/ee/e12f976468ec74d73ac0fdb1ead3", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/df/24a1cdc6e948ba59c7f3049008d6", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7d/e1/b2f0ce9c6c627f74529192b3b109", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/5d/19/a9111fa261821316bdb1a63686d2", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/9c/b2/007fa32c1d9910a2b6d71b7e4de1", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d9/06/051a35ea54a1ca1d6f1256da1c23", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/87/10/a3af2cedad809ac1a2788196f222", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/5d/aa/8e093984b04ca9b281c16a318d1a", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/6a/76/3075a31de439beccbd10c2c3f146", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8c/2f/b9f4b8d1e93509d62d2f6247fc2f", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c8/07/53759e168da972045b7339cd3622", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b8/26/224a69bb8ae1acdf1c8539a97c6a", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e3/eb/804fdb11f4665f22bab47b4bf33b", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3a/cc/0bf846a40574ee41c07139013988", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/66/75/b292d4fe3780f0686805b0759a14", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/53/3f/80615207af3b67420a6c9b56c8f4", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/6a/0b/45fad49022fa353d12180f253069", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/9f/ae/bf244f48bc347cbd7ca7b45d503a", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/92/18/d9e884f448a6cf658aa8dcc94060", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/56/f8/3e391602ed52353add34fc979a13", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e0/a2/8b03150db9b96de68cd8dad51d54", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/4e/89/a9439db62906c218d00222ddc3ce", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/13/1e/9ed7ea1818f2f10d684e61a61f07", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/af/a4/d15d2722343a0552d2fe4eb1a65b", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/91/0a/eb63c3c20bb89f7a9715d0932105", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/53/15/c59b2881be1efcf4ca0b8cf80379", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c5/3d/66047bf399d4924f89cbffc94297", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3a/8d/2e0c7b1bc6b4030bb6866a52ec7a", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/99/68/bef0609a635fbbde5f2270fb3647", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/27/6d/decc07ca775736a5042f4469a07d", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3d/23/f3e9176c9559b9bb8bff378fdc44", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1e/09/8ce0c6a3e9364a7c0e2bf727d500", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e9/7f/b98f40165a76f7244501be62fa8f", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/94/8d/5b728d11719f067428697f01ad53", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/67/66/7ebcbd6caa80ffea36893294534f", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/05/48/cfa2856a73536ae4fb9c4f5b89f5", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/c4/be/7cd8fad79bfab24e8cb553d176dd", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/9e/51/c43e21ae635a3f757f25ab1708fb", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/61/a8/534b315691f982d4f21f5fb7d31e", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/ed/f8d8ce08728b131bc7aa4eef68c5", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/71/91/9f054aa21607dbf2beeb951ce2b5", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f1/de/dfb9e770ea8e22e51d44fdf420f0", diff --git a/CHANGELOG.md b/CHANGELOG.md index ff8e0dc4..81c475cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21052, api 8, 2023-06-06) +### 1.7.20 (build 21053, api 8, 2023-06-06) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be diff --git a/Makefile b/Makefile index dc907c35..7428a117 100644 --- a/Makefile +++ b/Makefile @@ -604,6 +604,15 @@ spinoff-test-base: spinoff-test-plus: tools/pcommand spinoff_test plus $(SPINOFF_TEST_EXTRA_ARGS) +spinoff-test-template_fs: + tools/pcommand spinoff_test template_fs $(SPINOFF_TEST_EXTRA_ARGS) + +spinoff-test-ui_v1: + tools/pcommand spinoff_test ui_v1 $(SPINOFF_TEST_EXTRA_ARGS) + +spinoff-test-scene_v1: + tools/pcommand spinoff_test scene_v1 $(SPINOFF_TEST_EXTRA_ARGS) + spinoff-test-clean: rm -rf build/spinofftest @@ -630,8 +639,9 @@ spinoff-upgrade: @tools/pcommand echo GRN Spinoff upgrade successful! # Tell make which of these targets don't represent files. -.PHONY: spinoff-test-core spinoff-test-base spinoff-test-plus \ - spinoff-test-clean spinoff-update spinoff-upgrade +.PHONY: spinoff-test-core spinoff-test-base spinoff-test-plus \ + spinoff-test-template_fs spinoff-test-clean spinoff-update \ + spinoff-upgrade ################################################################################ diff --git a/src/assets/ba_data/python/baclassic/_subsystem.py b/src/assets/ba_data/python/baclassic/_subsystem.py index 4dedf473..db933884 100644 --- a/src/assets/ba_data/python/baclassic/_subsystem.py +++ b/src/assets/ba_data/python/baclassic/_subsystem.py @@ -4,6 +4,7 @@ from __future__ import annotations import random +import weakref import logging from typing import TYPE_CHECKING @@ -28,7 +29,7 @@ from baclassic import _input from baclassic import _profile if TYPE_CHECKING: - from typing import Callable, Any + from typing import Callable, Any, Sequence import babase import baclassic @@ -680,3 +681,56 @@ class ClassicSubsystem(AppSubsystem): delay, Call(ServerDialogWindow, sddata), ) + + def ticket_icon_press(self) -> None: + """(internal)""" + from bastd.ui.resourcetypeinfo import ResourceTypeInfoWindow + + ResourceTypeInfoWindow( + origin_widget=_bauiv1.get_special_widget('tickets_info_button') + ) + + def party_icon_activate(self, origin: Sequence[float]) -> None: + """(internal)""" + from bastd.ui.party import PartyWindow + from babase import app + + assert not app.headless_mode + + _bauiv1.getsound('swish').play() + + # If it exists, dismiss it; otherwise make a new one. + if ( + self.ui.party_window is not None + and self.ui.party_window() is not None + ): + self.ui.party_window().close() + else: + self.ui.party_window = weakref.ref(PartyWindow(origin=origin)) + + def device_menu_press(self, device_id: int | None) -> None: + """(internal)""" + from bastd.ui.mainmenu import MainMenuWindow + from bauiv1 import set_ui_input_device + + assert _babase.app is not None + in_main_menu = self.ui.has_main_menu_window() + if not in_main_menu: + set_ui_input_device(device_id) + + if not _babase.app.headless_mode: + _bauiv1.getsound('swish').play() + + self.ui.set_main_menu_window(MainMenuWindow().get_root_widget()) + + def show_url_window(self, address: str) -> None: + """(internal)""" + from bastd.ui.url import ShowURLWindow + + ShowURLWindow(address) + + def quit_window(self) -> None: + """(internal)""" + from bastd.ui.confirm import QuitWindow + + QuitWindow() diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index d0c6b23b..7d028c0c 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21052 +TARGET_BALLISTICA_BUILD = 21053 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/assets/ba_data/python/bauiv1/_hooks.py b/src/assets/ba_data/python/bauiv1/_hooks.py index 85912b20..3e2dd533 100644 --- a/src/assets/ba_data/python/bauiv1/_hooks.py +++ b/src/assets/ba_data/python/bauiv1/_hooks.py @@ -5,7 +5,7 @@ # pylint: disable=missing-function-docstring from __future__ import annotations -import weakref +import logging from typing import TYPE_CHECKING import _bauiv1 @@ -15,12 +15,13 @@ if TYPE_CHECKING: def ticket_icon_press() -> None: - # FIXME: move this into our package. - from bastd.ui.resourcetypeinfo import ResourceTypeInfoWindow + from babase import app - ResourceTypeInfoWindow( - origin_widget=_bauiv1.get_special_widget('tickets_info_button') - ) + if app.classic is None: + logging.exception('Classic not present.') + return + + app.classic.ticket_icon_press() def trophy_icon_press() -> None: @@ -48,46 +49,40 @@ def friends_button_press() -> None: def party_icon_activate(origin: Sequence[float]) -> None: - from bastd.ui.party import PartyWindow from babase import app - assert not app.headless_mode + if app.classic is None: + logging.exception('Classic not present.') + return - assert app.classic is not None - ui = app.classic.ui - - _bauiv1.getsound('swish').play() - - # If it exists, dismiss it; otherwise make a new one. - if ui.party_window is not None and ui.party_window() is not None: - ui.party_window().close() - else: - ui.party_window = weakref.ref(PartyWindow(origin=origin)) + app.classic.party_icon_activate(origin) def quit_window() -> None: - from bastd.ui.confirm import QuitWindow + from babase import app - QuitWindow() + if app.classic is None: + logging.exception('Classic not present.') + return + + app.classic.quit_window() def device_menu_press(device_id: int | None) -> None: - from bastd.ui.mainmenu import MainMenuWindow from babase import app - from bauiv1 import set_ui_input_device - assert app.classic is not None - in_main_menu = app.classic.ui.has_main_menu_window() - if not in_main_menu: - set_ui_input_device(device_id) + if app.classic is None: + logging.exception('Classic not present.') + return - if not app.headless_mode: - _bauiv1.getsound('swish').play() - - app.classic.ui.set_main_menu_window(MainMenuWindow().get_root_widget()) + app.classic.device_menu_press(device_id) def show_url_window(address: str) -> None: - from bastd.ui.url import ShowURLWindow + from babase import app - ShowURLWindow(address) + if app.classic is None: + logging.exception('Classic not present.') + return + + app.classic.show_url_window(address) diff --git a/src/assets/ba_data/python/bauiv1/ui/__init__.py b/src/assets/ba_data/python/bauiv1/ui/__init__.py index eb49b8b2..b2b154c4 100644 --- a/src/assets/ba_data/python/bauiv1/ui/__init__.py +++ b/src/assets/ba_data/python/bauiv1/ui/__init__.py @@ -7,13 +7,13 @@ from __future__ import annotations import os import weakref from dataclasses import dataclass -from typing import TYPE_CHECKING, cast, Type +from typing import TYPE_CHECKING import _babase import _bauiv1 if TYPE_CHECKING: - from typing import Any + from typing import Any, Type import babase import bauiv1 @@ -112,9 +112,13 @@ class UIEntry: # TEMP HARD CODED - WILL REPLACE THIS WITH BA_META LOOKUPS. if self._name == 'mainmenu': - from bastd.ui import mainmenu + # Shut pylint up. + if bool(False): + return UILocation + raise RuntimeError('FIXME UNIMPLEMENTED') + # from bastd.ui import mainmenu + # return cast(Type[UILocation], mainmenu.MainMenuWindow) - return cast(Type[UILocation], mainmenu.MainMenuWindow) raise ValueError('unknown ui class ' + str(self._name)) diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 769bbc4f..32ba87e0 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21052; +const int kEngineBuildNumber = 21053; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/src/ballistica/ui_v1/widget/button_widget.h b/src/ballistica/ui_v1/widget/button_widget.h index fd176bff..116a6bcd 100644 --- a/src/ballistica/ui_v1/widget/button_widget.h +++ b/src/ballistica/ui_v1/widget/button_widget.h @@ -5,7 +5,6 @@ #include -#include "ballistica/scene_v1/scene_v1.h" #include "ballistica/ui_v1/widget/text_widget.h" namespace ballistica::ui_v1 {