more ba.internal organizing

This commit is contained in:
Eric 2022-09-05 15:58:48 -07:00
parent 94768211ea
commit b5f52d37de
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
73 changed files with 663 additions and 462 deletions

View File

@ -3995,26 +3995,26 @@
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d1/f8/b03601885097936dbf33beb9295b",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/73/f4/4b6a99f4bd16c57c12a6d9642610",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/72/66/e7f664a89f74873c295e4caa5600",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/64/53/7674f5e91e39d2a4f61bf337f75d",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/26/f5174bbbd4c0dd31f9dcd96ff73d",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/11/ba/9e76380beb4ac4b4138e4825a854",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c5/e5/a2f0f97514e9f021ef70bf4e5515",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/07/de/b8108b36ba1d0f56f2f4fca6a6a8",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/fd/cb/f395843e0c1dd2eef3a0f098494a",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8a/e8/9a0f8609f41de40bc3fb992af56c",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/63/66/dcbc9e702844102bd6b34c4c1130",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d7/45/b7f5f7247a0f666af1980f74aedb",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f9/9a/699f6ec2b9a05ab3efcf26ae85e0",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2f/6e/14a6c316296320c2276cadfb8c0c",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a5/61/d664c519465e432b193685adeb0e",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/75/65/c34d887d326a45b25228ef6de05c",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/86/ae/5ebc9448c0250247bbae922c642a",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8c/3d/6f1d91d315c0748b92b3d51cfe93",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/38/77/56e7c9b43ce95a6f43ee15199c55",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/ca/b9/7635862e47d93e895047fa07caf5",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/06/3e/28bf1a2f2c8ff9d60dc9009afd43",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/32/6b/12db67765516b0205816b41db4b8",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/57/1e/0ba38a08a2ba605e4589c6422bc1",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0a/29/2965569534dfb27d9736be40a8ca",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/38/ab/f754bc432bfa15093d2d6c953c12",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/77/22/b49336253e7c20018aabfcbbda41",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/98/0f/6a0c5560b55ca824fd25cf6b356b",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9f/91/15b00e3fce05b0f10ea5af3d5ee2",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/12/d7/c074bdd761d329d75b1042d5167b",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/51/eb/1f61c50a9ebc93e0f856bbe1ef5e",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/62/f3/5d29f0c2f554ae5205d76cdb283e",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d2/90/0375524fe5f78555b9ff12b2601b",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/2b/cc/b45a0dcdda43cf719b6fd644c4c4",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/69/1c/10f4427b746cb6a2545290aa1f99",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/98/6e/65f75aeb62bdd6c897d163299c46",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0f/d0/ff714a43170a2c422d65b0533dca",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/40/d8/af1c5a8f4f2960596475ee11bbdd",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/33/73/7b039824562b5160fa03efdd1cc3",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/e4/dc/9bbf05c098bdc64a9b90f2580cdc",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/da/5e/91e6217194f56e7782bf7654af88",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/14/ee/113076d5d2e088cc90230cf6ab51",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7e/e4/38a2a67908a08aa068c4927d3122",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/75/fd/6250319a816a7b312051bfc2a63f",
@ -4031,14 +4031,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/dd/d1/187a739cbbe0316fd809708fa9ee",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/19/38/7a480d58b0ade7b5705f2f9474ee",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e2/4b/524bed0bfca1b06a324163728fe1",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/17/30/080b63fe14e6f775d439c3256f54",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/02/a0/5498bc8c8c55ab7e7ebdd23402b5",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/7b/56/65a60485ae436ef86f8ccc8db7cf",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/83/93/bbaa2c5c664779c69cbfae1b8163",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f1/1b/9eb27d7361d65dc0afbb26e74870",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/d2/6f/743f2f6e1ac49577900724cefe08",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/be/d2/64fbeeb285197fd410a92a35624e",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/5c/be/30aecc599f3c5977b40bd1155191",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/a6/36/5eacae1d7477be84c255960e1a10",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/9c/0f/9e9a95622f7ca0ec6315346517a5",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ba/f6/ae4469f1b89aed5aca7b05711fb9",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/97/6f/c3ce83c00b3f1e74f26878756d89",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/6f/57/3e0af371b5fefb1a625a37b42f0d",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/ae/ad/375e1add60a59f6ca1a94fcea1ef",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/d4/03/4a9df83e96f11f2315e3ee0af9bd",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/e3/11/d0e5057f133014b787866b6d6f0f",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/7d/3e/229a581cb2454ed856f1d8b564a7",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/98/12/571b2160d69d42580e8f31fa6a8d"
}

View File

@ -1,4 +1,4 @@
### 1.7.7 (build 20770, api 7, 2022-09-05)
### 1.7.7 (build 20772, api 7, 2022-09-05)
- Added `ba.app.meta.load_exported_classes()` for loading classes discovered by the meta subsystem cleanly in a background thread.
- Improved logging of missing playlist game types.
- Some ba.Lstr functionality can now be used in background threads.
@ -18,6 +18,7 @@
- Misc C++ layer tidying/refactoring.
- Split out the `_ba` binary module into `_ba` and `_bainternal`. This will eventually allow running without the closed-source parts (_bainternal) present at all.
- There is now a `_bainternal.py` dummy-module alongside the existing `_ba.py` one. Be sure to exclude it from any script collections used by the game (the same as `_ba.py`).
- Added checks to make sure _ba or _bainternal arent used outside of ba. Any 'internal' functionality needed outside of ba should be exposed through ba.internal. _ba and _bainternal are internal implementation details.
### 1.7.6 (build 20687, api 7, 2022-08-11)
- Cleaned up da MetaSubsystem code.

View File

@ -17,7 +17,8 @@ from _ba import (
newnode, playsound, printnodes, printobjects, pushcall, quit, rowwidget,
safecolor, screenmessage, scrollwidget, set_analytics_screen, charstr,
textwidget, time, timer, open_url, widget, clipboard_is_supported,
clipboard_has_text, clipboard_get_text, clipboard_set_text, getdata)
clipboard_has_text, clipboard_get_text, clipboard_set_text, getdata,
in_logic_thread)
from ba._activity import Activity
from ba._plugin import PotentialPlugin, Plugin, PluginSubsystem
from ba._actor import Actor
@ -99,8 +100,8 @@ __all__ = [
'GameTip', 'garbage_collect', 'getactivity', 'getclass', 'getcollidemodel',
'getcollision', 'getdata', 'getmaps', 'getmodel', 'getnodes', 'getsession',
'getsound', 'gettexture', 'HitMessage', 'hscrollwidget', 'imagewidget',
'ImpactDamageMessage', 'InputDevice', 'InputDeviceNotFoundError',
'InputType', 'IntChoiceSetting', 'IntSetting',
'ImpactDamageMessage', 'in_logic_thread', 'InputDevice',
'InputDeviceNotFoundError', 'InputType', 'IntChoiceSetting', 'IntSetting',
'is_browser_likely_available', 'is_point_in_box', 'Keyboard',
'LanguageSubsystem', 'Level', 'Lobby', 'log', 'Lstr', 'Map', 'Material',
'MetadataSubsystem', 'Model', 'MultiTeamSession', 'MusicPlayer',

View File

@ -32,7 +32,7 @@ def bootstrap() -> None:
# Give a soft warning if we're being used with a different binary
# version than we expect.
expected_build = 20770
expected_build = 20772
running_build: int = env['build_number']
if running_build != expected_build:
print(

View File

@ -8,6 +8,31 @@ defensively) in mods.
"""
from __future__ import annotations
from _ba import (
get_scores_to_beat, show_online_score_ui, set_ui_input_device,
is_party_icon_visible, getinputdevice, add_clean_frame_callback,
unlock_all_input, increment_analytics_count, set_debug_speed_exponent,
get_special_widget, get_qrcode_texture, get_string_height,
get_string_width, show_app_invite, appnameupper, lock_all_input,
open_file_externally, fade_screen, appname, have_incentivized_ad,
has_video_ads, workspaces_in_use, set_party_icon_always_visible,
connect_to_party, get_game_port, end_host_scanning, host_scan_cycle,
charstr, get_public_party_enabled, get_public_party_max_size,
set_public_party_name, set_public_party_max_size, set_authenticate_clients,
set_public_party_enabled, reset_random_player_names, new_host_session,
get_foreground_host_session, get_local_active_input_devices_count,
get_ui_input_device, is_in_replay, set_replay_speed_exponent,
get_replay_speed_exponent, disconnect_from_host, set_party_window_open,
get_connection_to_host_info, get_chat_messages, get_game_roster,
disconnect_client, chatmessage, get_random_names, have_permission,
request_permission, have_touchscreen_input, is_xcode_build,
set_low_level_config_value, get_low_level_config_value,
capture_gamepad_input, release_gamepad_input, has_gamma_control,
get_max_graphics_quality, get_display_resolution, capture_keyboard_input,
release_keyboard_input, value_test, set_touchscreen_editing,
is_running_on_fire_tv, android_get_external_files_dir,
set_telnet_access_enabled, new_replay_session, get_replays_dir)
from ba._map import (get_map_class, register_map, preload_map_preview_media,
get_map_display_string, get_filtered_map_name)
from ba._appconfig import commit_app_config
@ -53,33 +78,156 @@ from ba._internal import (
sign_out_v1, sign_in_v1, mark_config_dirty)
__all__ = [
'get_unowned_maps', 'get_unowned_game_types', 'get_map_class',
'register_map', 'preload_map_preview_media', 'get_map_display_string',
'get_filtered_map_name', 'commit_app_config', 'get_device_value',
'get_input_map_hash', 'get_input_device_config', 'getclass', 'json_prep',
'get_type_name', 'JoinActivity', 'ScoreScreenActivity',
'is_browser_likely_available', 'get_remote_app_name',
'should_submit_debug_info', 'run_gpu_benchmark', 'run_cpu_benchmark',
'run_media_reload_benchmark', 'run_stress_test', 'getcampaign',
'PlayerProfilesChangedMessage', 'DEFAULT_TEAM_COLORS',
'DEFAULT_TEAM_NAMES', 'do_play_music', 'master_server_get',
'master_server_post', 'get_ip_address_type',
'DEFAULT_REQUEST_TIMEOUT_SECONDS', 'get_default_powerup_distribution',
'get_player_profile_colors', 'get_player_profile_icon',
'get_player_colors', 'get_next_tip', 'get_default_free_for_all_playlist',
'get_default_teams_playlist', 'filter_playlist', 'get_available_sale_time',
'get_available_purchase_count', 'get_store_item_name_translated',
'get_store_item_display_size', 'get_store_layout', 'get_store_item',
'get_clean_price', 'get_tournament_prize_strings', 'get_trophy_string',
'get_v2_fleet', 'get_master_server_address', 'is_blessed', 'get_news_show',
'game_service_has_leaderboard', 'report_achievement', 'submit_score',
'tournament_query', 'power_ranking_query', 'restore_purchases', 'purchase',
'get_purchases_state', 'get_purchased', 'get_price', 'in_game_purchase',
'add_transaction', 'reset_achievements', 'get_public_login_id',
'have_outstanding_transactions', 'run_transactions',
'get_v1_account_misc_read_val', 'get_v1_account_misc_read_val_2',
'get_v1_account_misc_val', 'get_v1_account_ticket_count',
'get_v1_account_state_num', 'get_v1_account_state',
'get_v1_account_display_string', 'get_v1_account_type',
'get_v1_account_name', 'sign_out_v1', 'sign_in_v1', 'mark_config_dirty'
'get_scores_to_beat',
'show_online_score_ui',
'set_ui_input_device',
'is_party_icon_visible',
'getinputdevice',
'add_clean_frame_callback',
'unlock_all_input',
'increment_analytics_count',
'set_debug_speed_exponent',
'get_special_widget',
'get_qrcode_texture',
'get_string_height',
'get_string_width',
'show_app_invite',
'appnameupper',
'lock_all_input',
'open_file_externally',
'fade_screen',
'appname',
'have_incentivized_ad',
'has_video_ads',
'workspaces_in_use',
'set_party_icon_always_visible',
'connect_to_party',
'get_game_port',
'end_host_scanning',
'host_scan_cycle',
'charstr',
'get_public_party_enabled',
'get_public_party_max_size',
'set_public_party_name',
'set_public_party_max_size',
'set_authenticate_clients',
'set_public_party_enabled',
'reset_random_player_names',
'new_host_session',
'get_foreground_host_session',
'get_local_active_input_devices_count',
'get_ui_input_device',
'is_in_replay',
'set_replay_speed_exponent',
'get_replay_speed_exponent',
'disconnect_from_host',
'set_party_window_open',
'get_connection_to_host_info',
'get_chat_messages',
'get_game_roster',
'disconnect_client',
'chatmessage',
'get_random_names',
'have_permission',
'request_permission',
'have_touchscreen_input',
'is_xcode_build',
'set_low_level_config_value',
'get_low_level_config_value',
'capture_gamepad_input',
'release_gamepad_input',
'has_gamma_control',
'get_max_graphics_quality',
'get_display_resolution',
'capture_keyboard_input',
'release_keyboard_input',
'value_test',
'set_touchscreen_editing',
'is_running_on_fire_tv',
'android_get_external_files_dir',
'set_telnet_access_enabled',
'new_replay_session',
'get_replays_dir',
# DIVIDER
'get_unowned_maps',
'get_unowned_game_types',
'get_map_class',
'register_map',
'preload_map_preview_media',
'get_map_display_string',
'get_filtered_map_name',
'commit_app_config',
'get_device_value',
'get_input_map_hash',
'get_input_device_config',
'getclass',
'json_prep',
'get_type_name',
'JoinActivity',
'ScoreScreenActivity',
'is_browser_likely_available',
'get_remote_app_name',
'should_submit_debug_info',
'run_gpu_benchmark',
'run_cpu_benchmark',
'run_media_reload_benchmark',
'run_stress_test',
'getcampaign',
'PlayerProfilesChangedMessage',
'DEFAULT_TEAM_COLORS',
'DEFAULT_TEAM_NAMES',
'do_play_music',
'master_server_get',
'master_server_post',
'get_ip_address_type',
'DEFAULT_REQUEST_TIMEOUT_SECONDS',
'get_default_powerup_distribution',
'get_player_profile_colors',
'get_player_profile_icon',
'get_player_colors',
'get_next_tip',
'get_default_free_for_all_playlist',
'get_default_teams_playlist',
'filter_playlist',
'get_available_sale_time',
'get_available_purchase_count',
'get_store_item_name_translated',
'get_store_item_display_size',
'get_store_layout',
'get_store_item',
'get_clean_price',
'get_tournament_prize_strings',
'get_trophy_string',
'get_v2_fleet',
'get_master_server_address',
'is_blessed',
'get_news_show',
'game_service_has_leaderboard',
'report_achievement',
'submit_score',
'tournament_query',
'power_ranking_query',
'restore_purchases',
'purchase',
'get_purchases_state',
'get_purchased',
'get_price',
'in_game_purchase',
'add_transaction',
'reset_achievements',
'get_public_login_id',
'have_outstanding_transactions',
'run_transactions',
'get_v1_account_misc_read_val',
'get_v1_account_misc_read_val_2',
'get_v1_account_misc_val',
'get_v1_account_ticket_count',
'get_v1_account_state_num',
'get_v1_account_state',
'get_v1_account_display_string',
'get_v1_account_type',
'get_v1_account_name',
'sign_out_v1',
'sign_in_v1',
'mark_config_dirty',
]

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
from ba.internal import JoinActivity
@ -32,8 +31,9 @@ class CoopJoinActivity(JoinActivity):
config_str = ('1p' + session.campaign.getlevel(
session.campaign_level_name).get_score_version_string().replace(
' ', '_'))
_ba.get_scores_to_beat(level_name_full, config_str,
ba.WeakCall(self._on_got_scores_to_beat))
ba.internal.get_scores_to_beat(
level_name_full, config_str,
ba.WeakCall(self._on_got_scores_to_beat))
def on_transition_in(self) -> None:
from bastd.actor.controlsguide import ControlsGuide

View File

@ -8,7 +8,6 @@ from __future__ import annotations
import random
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.actor.text import Text
@ -265,12 +264,12 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
self.end({'outcome': 'next_level'})
def _ui_gc(self) -> None:
_ba.show_online_score_ui('leaderboard',
game=self._game_name_str,
game_version=self._game_config_str)
ba.internal.show_online_score_ui('leaderboard',
game=self._game_name_str,
game_version=self._game_config_str)
def _ui_show_achievements(self) -> None:
_ba.show_online_score_ui('achievements')
ba.internal.show_online_score_ui('achievements')
def _ui_worlds_best(self) -> None:
if self._score_link is None:
@ -332,7 +331,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
# to the game (like on mac).
can_select_extra_buttons = ba.app.platform == 'android'
_ba.set_ui_input_device(None) # Menu is up for grabs.
ba.internal.set_ui_input_device(None) # Menu is up for grabs.
if self._show_friend_scores:
ba.buttonwidget(parent=rootc,
@ -484,7 +483,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
timetype=ba.TimeType.REAL)
def _update_corner_button_positions(self) -> None:
offs = -55 if _ba.is_party_icon_visible() else 0
offs = -55 if ba.internal.is_party_icon_visible() else 0
assert self._corner_button_offs is not None
pos_x = self._corner_button_offs[0] + offs
pos_y = self._corner_button_offs[1]
@ -498,9 +497,9 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
# If this activity is a good 'end point', ask server-mode just once if
# it wants to do anything special like switch sessions or kill the app.
if (self._allow_server_transition and _ba.app.server is not None
if (self._allow_server_transition and ba.app.server is not None
and self._server_transitioning is None):
self._server_transitioning = _ba.app.server.handle_transition()
self._server_transitioning = ba.app.server.handle_transition()
assert isinstance(self._server_transitioning, bool)
# If server-mode is handling this, don't do anything ourself.
@ -529,7 +528,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
if ba.app.server is not None:
# Host can't press retry button, so anyone can do it instead.
time_till_assign = max(
0, self._birth_time + self._min_view_time - _ba.time())
0, self._birth_time + self._min_view_time - ba.time())
ba.timer(time_till_assign, ba.WeakCall(self._safe_assign, player))

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Sequence
@ -317,9 +317,8 @@ class ControlsGuide(ba.Actor):
# an input device that is *not* the touchscreen.
# (otherwise it is confusing to see the touchscreen buttons right
# next to our display buttons)
touchscreen: ba.InputDevice | None = _ba.getinputdevice('TouchScreen',
'#1',
doraise=False)
touchscreen: ba.InputDevice | None = ba.internal.getinputdevice(
'TouchScreen', '#1', doraise=False)
if touchscreen is not None:
# We look at the session's players; not the activity's.
@ -385,7 +384,7 @@ class ControlsGuide(ba.Actor):
# If there's no players with input devices yet, try to default to
# showing keyboard controls.
if not input_devices:
kbd = _ba.getinputdevice('Keyboard', '#1', doraise=False)
kbd = ba.internal.getinputdevice('Keyboard', '#1', doraise=False)
if kbd is not None:
input_devices.append(kbd)

View File

@ -11,7 +11,6 @@ from typing import TYPE_CHECKING
import ba
import ba.internal
import _ba
if TYPE_CHECKING:
from typing import Any
@ -253,7 +252,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
self._update()
# Hopefully this won't hitch but lets space these out anyway.
_ba.add_clean_frame_callback(ba.WeakCall(self._start_preloads))
ba.internal.add_clean_frame_callback(ba.WeakCall(self._start_preloads))
random.seed()
@ -937,7 +936,7 @@ class MainMenuSession(ba.Session):
def on_activity_end(self, activity: ba.Activity, results: Any) -> None:
if self._locked:
_ba.unlock_all_input()
ba.internal.unlock_all_input()
# Any ending activity leads us into the main menu one.
self.setactivity(ba.newactivity(MainMenuActivity))

View File

@ -18,8 +18,8 @@ from __future__ import annotations
import math
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.actor import spaz as basespaz
if TYPE_CHECKING:
@ -235,7 +235,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
super().on_begin()
ba.set_analytics_screen('Tutorial Start')
_ba.increment_analytics_count('Tutorial start')
ba.internal.increment_analytics_count('Tutorial start')
if bool(False):
# Buttons on top.
@ -461,7 +461,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
def run(self, a: TutorialActivity) -> None:
print('setting to', self._speed)
_ba.set_debug_speed_exponent(self._speed)
ba.internal.set_debug_speed_exponent(self._speed)
class RemoveGloves:
@ -609,7 +609,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
pass
def run(self, a: TutorialActivity) -> None:
_ba.increment_analytics_count('Tutorial finish')
ba.internal.increment_analytics_count('Tutorial finish')
a.end()
class Move:
@ -2328,7 +2328,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
('${TOTAL}', str(len(self.players)))]) if count > 0 else ''
if (count >= len(self.players) and self.players
and not self._have_skipped):
_ba.increment_analytics_count('Tutorial skip')
ba.internal.increment_analytics_count('Tutorial skip')
ba.set_analytics_screen('Tutorial Skip')
self._have_skipped = True
ba.playsound(ba.getsound('swish'))

View File

@ -8,7 +8,6 @@ from __future__ import annotations
import time
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -379,7 +378,7 @@ class AccountSettingsWindow(ba.Window):
self._account_name_text = None
if self._back_button is None:
bbtn = _ba.get_special_widget('back_button')
bbtn = ba.internal.get_special_widget('back_button')
else:
bbtn = self._back_button
@ -447,7 +446,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
ba.widget(edit=btn, show_buffer_bottom=40, show_buffer_top=100)
self._sign_in_text = None
@ -472,7 +472,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
ba.widget(edit=btn, show_buffer_bottom=40, show_buffer_top=100)
self._sign_in_text = None
@ -517,7 +518,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
ba.widget(edit=btn, show_buffer_bottom=40, show_buffer_top=100)
self._sign_in_text = None
@ -563,7 +565,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
ba.widget(edit=btn, show_buffer_bottom=40, show_buffer_top=100)
self._sign_in_text = None
@ -585,7 +588,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=0)
# the button to go to OS-Specific leaderboards/high-score-lists/etc.
@ -606,14 +610,15 @@ class AccountSettingsWindow(ba.Window):
color=(0.55, 0.5, 0.6),
textcolor=(0.75, 0.7, 0.8),
autoselect=True,
on_activate_call=_ba.show_online_score_ui,
on_activate_call=ba.internal.show_online_score_ui,
size=(button_width, 50),
label=account_type_name)
if first_selectable is None:
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
v -= game_service_button_space * 0.15
else:
@ -655,7 +660,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
v -= achievements_button_space * 0.15
else:
@ -683,7 +689,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
v -= leaderboards_button_space * 0.15
else:
@ -753,7 +760,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn)
self._linked_accounts_text: ba.Widget | None
@ -808,7 +816,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=50)
self._unlink_accounts_button: ba.Widget | None
@ -836,7 +845,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=50)
self._update_unlink_accounts_button()
else:
@ -857,7 +867,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=15)
if show_cancel_v2_sign_in_button:
@ -875,7 +886,8 @@ class AccountSettingsWindow(ba.Window):
first_selectable = btn
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=15)
# Whatever the topmost selectable thing is, we want it to scroll all
@ -898,7 +910,7 @@ class AccountSettingsWindow(ba.Window):
# for google play we use the built-in UI; otherwise pop up our own
if account_type == 'Google Play':
ba.timer(0.15,
ba.Call(_ba.show_online_score_ui, 'achievements'),
ba.Call(ba.internal.show_online_score_ui, 'achievements'),
timetype=ba.TimeType.REAL)
elif account_type != 'unknown':
assert self._achievements_button is not None
@ -910,7 +922,7 @@ class AccountSettingsWindow(ba.Window):
def _on_leaderboards_press(self) -> None:
ba.timer(0.15,
ba.Call(_ba.show_online_score_ui, 'leaderboards'),
ba.Call(ba.internal.show_online_score_ui, 'leaderboards'),
timetype=ba.TimeType.REAL)
def _have_unlinkable_accounts(self) -> bool:

View File

@ -9,7 +9,6 @@ from typing import TYPE_CHECKING
import ba
import ba.internal
import _ba
from efro.error import CommunicationError
import bacommon.cloud
@ -125,7 +124,7 @@ class V2SignInWindow(ba.Window):
position=(self._width * 0.5 - qr_size * 0.5,
self._height * 0.36 + qroffs - qr_size * 0.5),
size=(qr_size, qr_size),
texture=_ba.get_qrcode_texture(address))
texture=ba.internal.get_qrcode_texture(address))
# Start querying for results.
self._proxyid = response.proxyid

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui import popup
@ -199,8 +198,8 @@ class AccountViewerWindow(popup.PopupWindow):
ba.print_exception('Error displaying trophies.')
account_name_spacing = 15
tscale = 0.65
ts_height = _ba.get_string_height(trophystr,
suppress_warning=True)
ts_height = ba.internal.get_string_height(
trophystr, suppress_warning=True)
sub_width = self._width - 80
sub_height = 200 + ts_height * tscale + \
account_name_spacing * len(data['accountDisplayStrings'])
@ -323,8 +322,8 @@ class AccountViewerWindow(popup.PopupWindow):
('${SUFFIX}', '')]).evaluate()
rank_str_width = min(
sub_width * maxwidth_scale,
_ba.get_string_width(rank_str, suppress_warning=True) *
0.55)
ba.internal.get_string_width(
rank_str, suppress_warning=True) * 0.55)
# Only tack our suffix on if its at the end and only for
# non-diamond leagues.
@ -376,8 +375,8 @@ class AccountViewerWindow(popup.PopupWindow):
]).evaluate()
rank_str_width = min(
sub_width * maxwidth_scale,
_ba.get_string_width(rank_str, suppress_warning=True) *
0.3)
ba.internal.get_string_width(
rank_str, suppress_warning=True) * 0.3)
# Only tack our suffix on if its at the end and only for
# non-diamond leagues.

View File

@ -8,7 +8,6 @@ import copy
import time
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -131,7 +130,7 @@ class AppInviteWindow(ba.Window):
if ba.internal.get_v1_account_state() == 'signed_in':
ba.set_analytics_screen('App Invite UI')
_ba.show_app_invite(
ba.internal.show_app_invite(
ba.Lstr(resource='gatherWindow.appInviteTitleText',
subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))
]).evaluate(),
@ -251,7 +250,7 @@ class ShowFriendCodeWindow(ba.Window):
def _google_invites(self) -> None:
ba.set_analytics_screen('App Invite UI')
_ba.show_app_invite(
ba.internal.show_app_invite(
ba.Lstr(resource='gatherWindow.appInviteTitleText',
subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))
]).evaluate(),

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -29,7 +29,7 @@ class ConfigErrorWindow(ba.Window):
h_align='center',
v_align='top',
scale=0.73,
text=(f'Error reading {_ba.appnameupper()} config file'
text=(f'Error reading {ba.internal.appnameupper()} config file'
':\n\n\nCheck the console'
' (press ~ twice) for details.\n\nWould you like to quit and'
' try to fix it by hand\nor overwrite it with defaults?\n\n'
@ -58,10 +58,10 @@ class ConfigErrorWindow(ba.Window):
def _quit(self) -> None:
ba.timer(0.001, self._edit_and_quit, timetype=ba.TimeType.REAL)
_ba.lock_all_input()
ba.internal.lock_all_input()
def _edit_and_quit(self) -> None:
_ba.open_file_externally(self._config_file_path)
ba.internal.open_file_externally(self._config_file_path)
ba.timer(0.1, ba.quit, timetype=ba.TimeType.REAL)
def _defaults(self) -> None:

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -54,7 +54,7 @@ class ConfirmWindow:
size=(width, height),
transition=transition,
toolbar_visibility='menu_minimal_no_back',
parent=_ba.get_special_widget('overlay_stack'),
parent=ba.internal.get_special_widget('overlay_stack'),
scale=(2.1 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=scale_origin)
@ -147,12 +147,13 @@ class QuitWindow:
origin_widget=origin_widget).root_widget)
def _fade_and_quit(self) -> None:
_ba.fade_screen(False,
time=0.2,
endcall=lambda: ba.quit(soft=True, back=self._back))
_ba.lock_all_input()
ba.internal.fade_screen(
False,
time=0.2,
endcall=lambda: ba.quit(soft=True, back=self._back))
ba.internal.lock_all_input()
# Unlock and fade back in shortly.. just in case something goes wrong
# (or on android where quit just backs out of our activity and
# we may come back)
ba.timer(0.3, _ba.unlock_all_input, timetype=ba.TimeType.REAL)
ba.timer(0.3, ba.internal.unlock_all_input, timetype=ba.TimeType.REAL)

View File

@ -7,7 +7,6 @@ from __future__ import annotations
import weakref
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -38,11 +37,14 @@ class ContinuesWindow(ba.Window):
txt = (ba.Lstr(
resource='continuePurchaseText').evaluate().split('${PRICE}'))
t_left = txt[0]
t_left_width = _ba.get_string_width(t_left, suppress_warning=True)
t_left_width = ba.internal.get_string_width(t_left,
suppress_warning=True)
t_price = ba.charstr(ba.SpecialChar.TICKET) + str(self._cost)
t_price_width = _ba.get_string_width(t_price, suppress_warning=True)
t_price_width = ba.internal.get_string_width(t_price,
suppress_warning=True)
t_right = txt[-1]
t_right_width = _ba.get_string_width(t_right, suppress_warning=True)
t_right_width = ba.internal.get_string_width(t_right,
suppress_warning=True)
width_total_half = (t_left_width + t_price_width + t_right_width) * 0.5
ba.textwidget(parent=self._root_widget,

View File

@ -8,7 +8,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui.store.button import StoreButton
@ -27,7 +26,7 @@ class CoopBrowserWindow(ba.Window):
def _update_corner_button_positions(self) -> None:
uiscale = ba.app.ui.uiscale
offs = (-55 if uiscale is ba.UIScale.SMALL
and _ba.is_party_icon_visible() else 0)
and ba.internal.is_party_icon_visible() else 0)
if self._league_rank_button is not None:
self._league_rank_button.set_position(
(self._width - 282 + offs - self._x_inset, self._height - 85 -
@ -55,7 +54,7 @@ class CoopBrowserWindow(ba.Window):
# Quick note to players that tourneys won't work in ballistica
# core builds. (need to split the word so it won't get subbed out)
if 'ballistica' + 'core' == _ba.appname():
if 'ballistica' + 'core' == ba.internal.appname():
ba.timer(1.0,
lambda: ba.screenmessage(
ba.Lstr(resource='noTournamentsInTestBuildText'),
@ -334,7 +333,7 @@ class CoopBrowserWindow(ba.Window):
)
# Decrement time on our tournament buttons.
ads_enabled = _ba.have_incentivized_ad()
ads_enabled = ba.internal.have_incentivized_ad()
for tbtn in self._tournament_buttons:
tbtn.time_remaining = max(0, tbtn.time_remaining - 1)
if tbtn.time_remaining_value_text is not None:
@ -347,7 +346,7 @@ class CoopBrowserWindow(ba.Window):
and self._tourney_data_up_to_date) else '-')
# Also adjust the ad icon visibility.
if tbtn.allow_ads and _ba.has_video_ads():
if tbtn.allow_ads and ba.internal.has_video_ads():
ba.imagewidget(edit=tbtn.entry_fee_ad_image,
opacity=1.0 if ads_enabled else 0.25)
ba.textwidget(edit=tbtn.entry_fee_text_remaining,
@ -637,7 +636,7 @@ class CoopBrowserWindow(ba.Window):
# FIXME shouldn't use hard-coded strings here.
txt = ba.Lstr(resource='tournamentsText',
fallback_resource='tournamentText').evaluate()
t_width = _ba.get_string_width(txt, suppress_warning=True)
t_width = ba.internal.get_string_width(txt, suppress_warning=True)
ba.textwidget(parent=w_parent,
position=(h_base + 27, v + 30),
size=(0, 0),
@ -941,7 +940,7 @@ class CoopBrowserWindow(ba.Window):
show_sign_in_prompt()
return
if _ba.workspaces_in_use():
if ba.internal.workspaces_in_use():
ba.screenmessage(
ba.Lstr(resource='tournamentsDisabledWorkspaceText'),
color=(1, 0, 0))

View File

@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
import copy
import ba
import _ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -519,8 +519,8 @@ class TournamentButton:
# Now, if this fee allows ads and we support video ads, show
# the 'or ad' version.
if allow_ads and _ba.has_video_ads():
ads_enabled = _ba.have_incentivized_ad()
if allow_ads and ba.internal.has_video_ads():
ads_enabled = ba.internal.have_incentivized_ad()
ba.imagewidget(edit=self.entry_fee_ad_image,
opacity=1.0 if ads_enabled else 0.25)
or_text = ba.Lstr(resource='orText',

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Sequence
@ -91,17 +91,19 @@ class CreditsListWindow(ba.Window):
capture_arrows=True)
if ba.app.ui.use_toolbars:
ba.widget(edit=scroll,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=scroll,
right_widget=ba.internal.get_special_widget('party_button'))
if uiscale is ba.UIScale.SMALL:
ba.widget(edit=scroll,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=scroll,
left_widget=ba.internal.get_special_widget('back_button'))
def _format_names(names2: Sequence[str], inset: float) -> str:
sval = ''
# measure a series since there's overlaps and stuff..
space_width = _ba.get_string_width(' ' * 10,
suppress_warning=True) / 10.0
space_width = ba.internal.get_string_width(
' ' * 10, suppress_warning=True) / 10.0
spacing = 330.0
col1 = inset
col2 = col1 + spacing
@ -124,7 +126,8 @@ class CreditsListWindow(ba.Window):
spacingstr = ' ' * int((target - line_width) / space_width)
nline += spacingstr
nline += name
line_width = _ba.get_string_width(nline, suppress_warning=True)
line_width = ba.internal.get_string_width(
nline, suppress_warning=True)
if nline != '':
sval += nline + '\n'
return sval

View File

@ -7,6 +7,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -54,9 +55,8 @@ def ask_for_rating() -> ba.Widget | None:
v_align='center')
def do_rating() -> None:
import _ba
if platform == 'android':
appname = _ba.appname()
appname = ba.internal.appname()
if subplatform == 'google':
url = f'market://details?id=net.froemling.{appname}'
else:

View File

@ -9,8 +9,8 @@ import threading
import time
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable, Sequence
@ -242,7 +242,7 @@ class FileSelectorWindow(ba.Window):
max_str_width = 300.0
str_width = min(
max_str_width,
_ba.get_string_width(folder_name, suppress_warning=True))
ba.internal.get_string_width(folder_name, suppress_warning=True))
ba.textwidget(edit=self._path_text,
text=folder_name,
maxwidth=max_str_width)

View File

@ -8,7 +8,6 @@ import weakref
from enum import Enum
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui.tabs import TabRow
@ -89,7 +88,7 @@ class GatherWindow(ba.Window):
self._transition_out = 'out_right'
scale_origin = None
ba.app.ui.set_main_menu_location('Gather')
_ba.set_party_icon_always_visible(True)
ba.internal.set_party_icon_always_visible(True)
uiscale = ba.app.ui.uiscale
self._width = 1240 if uiscale is ba.UIScale.SMALL else 1040
x_offs = 100 if uiscale is ba.UIScale.SMALL else 0
@ -188,11 +187,13 @@ class GatherWindow(ba.Window):
self._tabs[tab_id] = tabtype(self)
if ba.app.ui.use_toolbars:
ba.widget(edit=self._tab_row.tabs[tabdefs[-1][0]].button,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=self._tab_row.tabs[tabdefs[-1][0]].button,
right_widget=ba.internal.get_special_widget('party_button'))
if uiscale is ba.UIScale.SMALL:
ba.widget(edit=self._tab_row.tabs[tabdefs[0][0]].button,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=self._tab_row.tabs[tabdefs[0][0]].button,
left_widget=ba.internal.get_special_widget('back_button'))
self._scroll_width = self._width - scroll_buffer_h
self._scroll_height = self._height - 180.0 + tabs_top_extra
@ -216,7 +217,7 @@ class GatherWindow(ba.Window):
self._restore_state()
def __del__(self) -> None:
_ba.set_party_icon_always_visible(False)
ba.internal.set_party_icon_always_visible(False)
def playlist_select(self, origin_widget: ba.Widget) -> None:
"""Called by the private-hosting tab to select a playlist."""

View File

@ -11,8 +11,8 @@ from enum import Enum
from dataclasses import dataclass
from bastd.ui.gather import GatherTab
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -341,8 +341,9 @@ class ManualGatherTab(GatherTab):
label=ba.Lstr(resource='gatherWindow.manualConnectText'),
autoselect=True)
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
ba.widget(edit=btn1,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=btn1,
left_widget=ba.internal.get_special_widget('back_button'))
btnv -= b_height + b_space_extra
ba.buttonwidget(parent=self._container,
size=(b_width, b_height),
@ -686,7 +687,7 @@ class ManualGatherTab(GatherTab):
config = ba.app.config
config['Last Manual Party Connect Address'] = resolved_address
config.commit()
_ba.connect_to_party(resolved_address, port=port)
ba.internal.connect_to_party(resolved_address, port=port)
def _run_addr_fetch(self) -> None:
try:
@ -894,9 +895,12 @@ class ManualGatherTab(GatherTab):
if t_accessible_extra:
ba.textwidget(
edit=t_accessible_extra,
text=ba.Lstr(resource='gatherWindow.'
'manualRouterForwardingText',
subs=[('${PORT}',
str(_ba.get_game_port()))]),
text=ba.Lstr(
resource='gatherWindow.'
'manualRouterForwardingText',
subs=[
('${PORT}', str(ba.internal.get_game_port())),
],
),
color=color_bad,
)

View File

@ -8,7 +8,7 @@ import weakref
from typing import TYPE_CHECKING
import ba
import _ba
import ba.internal
from bastd.ui.gather import GatherTab
if TYPE_CHECKING:
@ -42,13 +42,13 @@ class NetScanner:
ba.timer(0.25, ba.WeakCall(self.update), timetype=ba.TimeType.REAL)
def __del__(self) -> None:
_ba.end_host_scanning()
ba.internal.end_host_scanning()
def _on_select(self, host: dict[str, Any]) -> None:
self._last_selected_host = host
def _on_activate(self, host: dict[str, Any]) -> None:
_ba.connect_to_party(host['address'])
ba.internal.connect_to_party(host['address'])
def update(self) -> None:
"""(internal)"""
@ -65,7 +65,7 @@ class NetScanner:
# Grab this now this since adding widgets will change it.
last_selected_host = self._last_selected_host
hosts = _ba.host_scan_cycle()
hosts = ba.internal.host_scan_cycle()
for i, host in enumerate(hosts):
txt3 = ba.textwidget(parent=self._columnwidget,
size=(self._width / t_scale, 30),

View File

@ -11,12 +11,11 @@ from enum import Enum
from dataclasses import dataclass
from typing import TYPE_CHECKING, cast
import ba
import ba.internal
import _ba
from efro.dataclassio import dataclass_from_dict, dataclass_to_dict
from bacommon.net import (PrivateHostingState, PrivateHostingConfig,
PrivatePartyConnectResult)
import ba
import ba.internal
from bastd.ui.gather import GatherTab
from bastd.ui import getcurrency
@ -705,7 +704,7 @@ class PrivateGatherTab(GatherTab):
btnlabel = ba.Lstr(
resource='gatherWindow.hostingUnavailableText')
elif self._hostingstate.party_code is None:
ticon = _ba.charstr(ba.SpecialChar.TICKET)
ticon = ba.internal.charstr(ba.SpecialChar.TICKET)
nowtickets = self._hostingstate.tickets_to_host_now
if nowtickets > 0:
btnlabel = ba.Lstr(
@ -863,7 +862,7 @@ class PrivateGatherTab(GatherTab):
return
self._debug_server_comm('got valid connect response')
assert cresult.addr is not None and cresult.port is not None
_ba.connect_to_party(cresult.addr, port=cresult.port)
ba.internal.connect_to_party(cresult.addr, port=cresult.port)
except Exception:
self._debug_server_comm('got connect response error')
ba.playsound(ba.getsound('error'))

View File

@ -12,7 +12,6 @@ from enum import Enum
from dataclasses import dataclass
from typing import TYPE_CHECKING, cast
import _ba
import ba
import ba.internal
from bastd.ui.gather import GatherTab
@ -583,7 +582,7 @@ class PublicGatherTab(GatherTab):
c_height = region_height - 20
v = c_height - 35
v -= 25
is_public_enabled = _ba.get_public_party_enabled()
is_public_enabled = ba.internal.get_public_party_enabled()
v -= 30
ba.textwidget(
@ -644,7 +643,7 @@ class PublicGatherTab(GatherTab):
scale=1.2,
color=(1, 1, 1),
position=(240, v - 9),
text=str(_ba.get_public_party_max_size()))
text=str(ba.internal.get_public_party_max_size()))
btn1 = self._host_max_party_size_minus_button = (ba.buttonwidget(
parent=self._container,
size=(40, 40),
@ -712,7 +711,7 @@ class PublicGatherTab(GatherTab):
# If public sharing is already on,
# launch a status-check immediately.
if _ba.get_public_party_enabled():
if ba.internal.get_public_party_enabled():
self._do_status_check()
def _on_public_party_query_result(self,
@ -807,7 +806,7 @@ class PublicGatherTab(GatherTab):
text = self._host_name_text
if text:
name = cast(str, ba.textwidget(query=self._host_name_text))
_ba.set_public_party_name(name)
ba.internal.set_public_party_name(name)
# Update status text.
status_text = self._join_status_text
@ -1130,15 +1129,18 @@ class PublicGatherTab(GatherTab):
edit=text,
text=ba.Lstr(
value='${A}\n${B}${C}',
subs=[('${A}',
ba.Lstr(resource='gatherWindow.'
'partyStatusNotJoinableText')),
('${B}',
ba.Lstr(resource='gatherWindow.'
'manualRouterForwardingText',
subs=[('${PORT}',
str(_ba.get_game_port()))])),
('${C}', ex_line)]),
subs=[
('${A}',
ba.Lstr(resource='gatherWindow.'
'partyStatusNotJoinableText')),
('${B}',
ba.Lstr(resource='gatherWindow.'
'manualRouterForwardingText',
subs=[
('${PORT}',
str(ba.internal.get_game_port()))
])), ('${C}', ex_line)
]),
color=(1, 0, 0))
else:
ba.textwidget(edit=text,
@ -1168,16 +1170,16 @@ class PublicGatherTab(GatherTab):
color=(1, 0, 0))
ba.playsound(ba.getsound('error'))
return
_ba.set_public_party_name(name)
ba.internal.set_public_party_name(name)
cfg = ba.app.config
cfg['Public Party Name'] = name
cfg.commit()
ba.playsound(ba.getsound('shieldUp'))
_ba.set_public_party_enabled(True)
ba.internal.set_public_party_enabled(True)
# In GUI builds we want to authenticate clients only when hosting
# public parties.
_ba.set_authenticate_clients(True)
ba.internal.set_authenticate_clients(True)
self._do_status_check()
ba.buttonwidget(
@ -1188,11 +1190,11 @@ class PublicGatherTab(GatherTab):
on_activate_call=self._on_stop_advertising_press)
def _on_stop_advertising_press(self) -> None:
_ba.set_public_party_enabled(False)
ba.internal.set_public_party_enabled(False)
# In GUI builds we want to authenticate clients only when hosting
# public parties.
_ba.set_authenticate_clients(False)
ba.internal.set_authenticate_clients(False)
ba.playsound(ba.getsound('shieldDown'))
text = self._host_status_text
if text:
@ -1224,7 +1226,7 @@ class PublicGatherTab(GatherTab):
now = time.time()
last_connect_time = self._last_connect_attempt_time
if last_connect_time is None or now - last_connect_time > 2.0:
_ba.connect_to_party(address, port=port)
ba.internal.connect_to_party(address, port=port)
self._last_connect_attempt_time = now
def set_public_party_selection(self, sel: Selection) -> None:
@ -1235,12 +1237,12 @@ class PublicGatherTab(GatherTab):
self._have_user_selected_row = True
def _on_max_public_party_size_minus_press(self) -> None:
val = max(1, _ba.get_public_party_max_size() - 1)
_ba.set_public_party_max_size(val)
val = max(1, ba.internal.get_public_party_max_size() - 1)
ba.internal.set_public_party_max_size(val)
ba.textwidget(edit=self._host_max_party_size_value, text=str(val))
def _on_max_public_party_size_plus_press(self) -> None:
val = _ba.get_public_party_max_size()
val = ba.internal.get_public_party_max_size()
val += 1
_ba.set_public_party_max_size(val)
ba.internal.set_public_party_max_size(val)
ba.textwidget(edit=self._host_max_party_size_value, text=str(val))

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -249,7 +248,7 @@ class GetCurrencyWindow(ba.Window):
tex_name='ticketRolls',
tex_scale=1.2) # 19.99-ish
self._enable_ad_button = _ba.has_video_ads()
self._enable_ad_button = ba.internal.has_video_ads()
h = self._width * 0.5 + 110.0
v = self._height - b_size[1] - 115.0
@ -444,7 +443,7 @@ class GetCurrencyWindow(ba.Window):
next_reward_ad_time = datetime.datetime.utcfromtimestamp(
next_reward_ad_time)
now = datetime.datetime.utcnow()
if (_ba.have_incentivized_ad() and
if (ba.internal.have_incentivized_ad() and
(next_reward_ad_time is None or next_reward_ad_time <= now)):
self._ad_button_greyed = False
ba.buttonwidget(edit=self._ad_button, color=(0.65, 0.5, 0.7))
@ -570,7 +569,7 @@ class GetCurrencyWindow(ba.Window):
resource='getTicketsWindow.unavailableTemporarilyText'),
color=(1, 0, 0))
elif self._enable_ad_button:
_ba.app.ads.show_ad('tickets')
ba.app.ads.show_ad('tickets')
else:
ba.internal.purchase(item)

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -76,8 +76,9 @@ class HelpWindow(ba.Window):
capture_arrows=True)
if ba.app.ui.use_toolbars:
ba.widget(edit=self._scrollwidget,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=self._scrollwidget,
right_widget=ba.internal.get_special_widget('party_button'))
ba.containerwidget(edit=self._root_widget,
selected_child=self._scrollwidget)
@ -86,8 +87,9 @@ class HelpWindow(ba.Window):
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._close)
ba.widget(edit=self._scrollwidget,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=self._scrollwidget,
left_widget=ba.internal.get_special_widget('back_button'))
else:
btn = ba.buttonwidget(
parent=self._root_widget,
@ -150,7 +152,8 @@ class HelpWindow(ba.Window):
maxwidth=txt_maxwidth)
txt_width = min(
txt_maxwidth,
_ba.get_string_width(txt, suppress_warning=True) * txt_scale)
ba.internal.get_string_width(txt, suppress_warning=True) *
txt_scale)
icon_size = 70
hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
@ -350,7 +353,8 @@ class HelpWindow(ba.Window):
maxwidth=txt_maxwidth)
txt_width = min(
txt_maxwidth,
_ba.get_string_width(txt, suppress_warning=True) * txt_scale)
ba.internal.get_string_width(txt, suppress_warning=True) *
txt_scale)
icon_size = 70
hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
@ -496,7 +500,8 @@ class HelpWindow(ba.Window):
maxwidth=txt_maxwidth)
txt_width = min(
txt_maxwidth,
_ba.get_string_width(txt, suppress_warning=True) * txt_scale)
ba.internal.get_string_width(txt, suppress_warning=True) *
txt_scale)
icon_size = 70
hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
ba.imagewidget(parent=self._subcontainer,

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -38,7 +37,7 @@ class KioskWindow(ba.Window):
self._show_multiplayer = False
# Let's reset all random player names every time we hit the main menu.
_ba.reset_random_player_names()
ba.internal.reset_random_player_names()
# Reset achievements too (at least locally).
ba.app.config['Achievements'] = {}
@ -391,11 +390,12 @@ class KioskWindow(ba.Window):
'type': 'bs_elimination.EliminationGame'
}]
appconfig['Free-for-All Playlist Selection'] = 'Just Epic Elim'
_ba.fade_screen(False,
endcall=ba.Call(
ba.pushcall,
ba.Call(_ba.new_host_session,
ba.FreeForAllSession)))
ba.internal.fade_screen(False,
endcall=ba.Call(
ba.pushcall,
ba.Call(
ba.internal.new_host_session,
ba.FreeForAllSession)))
else:
if mode == 'ctf':
appconfig['Team Tournament Playlists']['Just CTF'] = [{
@ -424,11 +424,12 @@ class KioskWindow(ba.Window):
}]
appconfig['Team Tournament Playlist Selection'] = (
'Just Hockey')
_ba.fade_screen(False,
endcall=ba.Call(
ba.pushcall,
ba.Call(_ba.new_host_session,
ba.DualTeamSession)))
ba.internal.fade_screen(False,
endcall=ba.Call(
ba.pushcall,
ba.Call(
ba.internal.new_host_session,
ba.DualTeamSession)))
ba.containerwidget(edit=self._root_widget, transition='out_left')
return

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -112,7 +111,7 @@ class LeagueRankButton:
self._update_for_league_rank_data(data)
def _on_activate(self) -> None:
_ba.increment_analytics_count('League rank button press')
ba.internal.increment_analytics_count('League rank button press')
self._on_activate_call()
def __del__(self) -> None:

View File

@ -7,7 +7,6 @@ from __future__ import annotations
import copy
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui import popup as popup_ui
@ -748,7 +747,7 @@ class LeagueRankWindow(ba.Window):
ba.textwidget(edit=self._league_text, text=lname, color=lcolor)
l_text_width = min(
self._league_text_maxwidth,
_ba.get_string_width(lname, suppress_warning=True) *
ba.internal.get_string_width(lname, suppress_warning=True) *
self._league_text_scale)
ba.textwidget(
edit=self._league_number_text,

View File

@ -9,7 +9,6 @@ from typing import TYPE_CHECKING
import ba
import ba.internal
import _ba
if TYPE_CHECKING:
from typing import Any, Callable
@ -22,8 +21,8 @@ class MainMenuWindow(ba.Window):
# pylint: disable=cyclic-import
import threading
from bastd.mainmenu import MainMenuSession
self._in_game = not isinstance(_ba.get_foreground_host_session(),
MainMenuSession)
self._in_game = not isinstance(
ba.internal.get_foreground_host_session(), MainMenuSession)
# Preload some modules we use in a background thread so we won't
# have a visual hitch when the user taps them.
@ -102,7 +101,7 @@ class MainMenuWindow(ba.Window):
try:
app = ba.app
force_test = False
_ba.get_local_active_input_devices_count()
ba.internal.get_local_active_input_devices_count()
if (((app.on_tv or app.platform == 'mac')
and ba.app.config.get('launchCount', 0) <= 1)
or force_test):
@ -188,7 +187,7 @@ class MainMenuWindow(ba.Window):
(not self._in_game or not app.toolbar_test)
and not (self._is_demo or self._is_arcade or self._is_iircade))
self._input_device = input_device = _ba.get_ui_input_device()
self._input_device = input_device = ba.internal.get_ui_input_device()
self._input_player = input_device.player if input_device else None
self._connected_to_remote_player = (
input_device.is_connected_to_remote_player()
@ -235,7 +234,7 @@ class MainMenuWindow(ba.Window):
self._p_index += 1
# If we're in a replay, we have a 'Leave Replay' button.
if _ba.is_in_replay():
if ba.internal.is_in_replay():
ba.buttonwidget(parent=self._root_widget,
position=(h - self._button_width * 0.5 * scale,
v),
@ -244,7 +243,7 @@ class MainMenuWindow(ba.Window):
autoselect=self._use_autoselect,
label=ba.Lstr(resource='replayEndText'),
on_activate_call=self._confirm_end_replay)
elif _ba.get_foreground_host_session() is not None:
elif ba.internal.get_foreground_host_session() is not None:
ba.buttonwidget(
parent=self._root_widget,
position=(h - self._button_width * 0.5 * scale, v),
@ -344,7 +343,7 @@ class MainMenuWindow(ba.Window):
# Add speed-up/slow-down buttons for replays.
# (ideally this should be part of a fading-out playback bar like most
# media players but this works for now).
if _ba.is_in_replay():
if ba.internal.is_in_replay():
b_size = 50.0
b_buffer = 10.0
t_scale = 0.75
@ -685,7 +684,7 @@ class MainMenuWindow(ba.Window):
# pylint: disable=too-many-locals
# pylint: disable=too-many-statements
custom_menu_entries: list[dict[str, Any]] = []
session = _ba.get_foreground_host_session()
session = ba.internal.get_foreground_host_session()
if session is not None:
try:
custom_menu_entries = session.get_custom_menu_entries()
@ -822,8 +821,9 @@ class MainMenuWindow(ba.Window):
if ba.do_once():
print('_change_replay_speed called without widget')
return
_ba.set_replay_speed_exponent(_ba.get_replay_speed_exponent() + offs)
actual_speed = pow(2.0, _ba.get_replay_speed_exponent())
ba.internal.set_replay_speed_exponent(
ba.internal.get_replay_speed_exponent() + offs)
actual_speed = pow(2.0, ba.internal.get_replay_speed_exponent())
ba.textwidget(edit=self._replay_speed_text,
text=ba.Lstr(resource='watchWindow.playbackSpeedText',
subs=[('${SPEED}', str(actual_speed))]))
@ -895,7 +895,7 @@ class MainMenuWindow(ba.Window):
cancel_is_selected=True)
def _leave_party(self) -> None:
_ba.disconnect_from_host()
ba.internal.disconnect_from_host()
def _end_game(self) -> None:
if not self._root_widget:
@ -945,7 +945,7 @@ class MainMenuWindow(ba.Window):
def _do_game_service_press(self) -> None:
self._save_state()
_ba.show_online_score_ui()
ba.internal.show_online_score_ui()
def _save_state(self) -> None:

View File

@ -6,10 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING, cast
import _ba
import ba
from ba import charstr
from ba import SpecialChar as SpCh
import ba.internal
if TYPE_CHECKING:
pass
@ -25,7 +23,7 @@ class OnScreenKeyboardWindow(ba.Window):
uiscale = ba.app.ui.uiscale
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
parent=_ba.get_special_widget('overlay_stack'),
parent=ba.internal.get_special_widget('overlay_stack'),
size=(self._width, self._height + top_extra),
transition='in_scale',
scale_origin_stack_offset=self._target_text.
@ -129,7 +127,7 @@ class OnScreenKeyboardWindow(ba.Window):
autoselect=True,
textcolor=key_textcolor,
color=key_color_dark,
label=charstr(SpCh.SHIFT),
label=ba.charstr(ba.SpecialChar.SHIFT),
enable_sound=False,
extra_touch_border_scale=0.3,
button_type='square',
@ -165,7 +163,7 @@ class OnScreenKeyboardWindow(ba.Window):
repeat=True,
textcolor=key_textcolor,
color=key_color_dark,
label=charstr(SpCh.DELETE),
label=ba.charstr(ba.SpecialChar.DELETE),
button_type='square',
on_activate_call=self._del)
v -= (key_height + 9)
@ -193,7 +191,7 @@ class OnScreenKeyboardWindow(ba.Window):
enable_sound=False,
textcolor=key_textcolor,
color=key_color_dark,
label=charstr(SpCh.LOGO_FLAT),
label=ba.charstr(ba.SpecialChar.LOGO_FLAT),
extra_touch_border_scale=0.3,
button_type='square',
)
@ -255,14 +253,14 @@ class OnScreenKeyboardWindow(ba.Window):
ba.buttonwidget(edit=self._shift_button,
color=self._key_color_lit
if self._mode == 'caps' else self._key_color_dark,
label=charstr(SpCh.SHIFT),
label=ba.charstr(ba.SpecialChar.SHIFT),
on_activate_call=self._shift)
ba.buttonwidget(edit=self._num_mode_button,
label='123#&*',
on_activate_call=self._num_mode)
ba.buttonwidget(edit=self._emoji_button,
color=self._key_color_dark,
label=charstr(SpCh.LOGO_FLAT),
label=ba.charstr(ba.SpecialChar.LOGO_FLAT),
on_activate_call=self._next_mode)
else:
if self._mode == 'num':
@ -278,7 +276,7 @@ class OnScreenKeyboardWindow(ba.Window):
on_activate_call=self._abc_mode)
ba.buttonwidget(edit=self._emoji_button,
color=self._key_color_dark,
label=charstr(SpCh.LOGO_FLAT),
label=ba.charstr(ba.SpecialChar.LOGO_FLAT),
on_activate_call=self._next_mode)
for i, btn in enumerate(self._char_keys):

View File

@ -7,8 +7,8 @@ from __future__ import annotations
import math
from typing import TYPE_CHECKING, cast
import _ba
import ba
import ba.internal
from bastd.ui import popup
if TYPE_CHECKING:
@ -19,10 +19,10 @@ class PartyWindow(ba.Window):
"""Party list/chat window."""
def __del__(self) -> None:
_ba.set_party_window_open(False)
ba.internal.set_party_window_open(False)
def __init__(self, origin: Sequence[float] = (0, 0)):
_ba.set_party_window_open(True)
ba.internal.set_party_window_open(True)
self._r = 'partyWindow'
self._popup_type: str | None = None
self._popup_party_member_client_id: int | None = None
@ -35,7 +35,7 @@ class PartyWindow(ba.Window):
size=(self._width, self._height),
transition='in_scale',
color=(0.40, 0.55, 0.20),
parent=_ba.get_special_widget('overlay_stack'),
parent=ba.internal.get_special_widget('overlay_stack'),
on_outside_click_call=self.close_with_sound,
scale_origin_stack_offset=origin,
scale=(2.0 if uiscale is ba.UIScale.SMALL else
@ -68,7 +68,7 @@ class PartyWindow(ba.Window):
color=(0.55, 0.73, 0.25),
iconscale=1.2)
info = _ba.get_connection_to_host_info()
info = ba.internal.get_connection_to_host_info()
if info.get('name', '') != '':
title = ba.Lstr(value=info['name'])
else:
@ -116,7 +116,7 @@ class PartyWindow(ba.Window):
# add all existing messages if chat is not muted
if not ba.app.config.resolve('Chat Muted'):
msgs = _ba.get_chat_messages()
msgs = ba.internal.get_chat_messages()
for msg in msgs:
self._add_msg(msg)
@ -215,7 +215,7 @@ class PartyWindow(ba.Window):
ba.textwidget(edit=self._muted_text, color=(1, 1, 1, 0.0))
# update roster section
roster = _ba.get_game_roster()
roster = ba.internal.get_game_roster()
if roster != self._roster:
self._roster = roster
@ -318,7 +318,7 @@ class PartyWindow(ba.Window):
if is_host:
twd = min(
c_width * 0.85,
_ba.get_string_width(
ba.internal.get_string_width(
p_str, suppress_warning=True) *
t_scale)
self._name_widgets.append(
@ -357,7 +357,7 @@ class PartyWindow(ba.Window):
assert self._popup_party_member_client_id is not None
# Ban for 5 minutes.
result = _ba.disconnect_client(
result = ba.internal.disconnect_client(
self._popup_party_member_client_id, ban_time=5 * 60)
if not result:
ba.playsound(ba.getsound('error'))
@ -379,12 +379,12 @@ class PartyWindow(ba.Window):
def _on_party_member_press(self, client_id: int, is_host: bool,
widget: ba.Widget) -> None:
# if we're the host, pop up 'kick' options for all non-host members
if _ba.get_foreground_host_session() is not None:
if ba.internal.get_foreground_host_session() is not None:
kick_str = ba.Lstr(resource='kickText')
else:
# kick-votes appeared in build 14248
if (_ba.get_connection_to_host_info().get('build_number', 0) <
14248):
if (ba.internal.get_connection_to_host_info().get(
'build_number', 0) < 14248):
return
kick_str = ba.Lstr(resource='kickVoteText')
uiscale = ba.app.ui.uiscale
@ -401,7 +401,8 @@ class PartyWindow(ba.Window):
self._popup_party_member_is_host = is_host
def _send_chat_message(self) -> None:
_ba.chatmessage(cast(str, ba.textwidget(query=self._text_field)))
ba.internal.chatmessage(
cast(str, ba.textwidget(query=self._text_field)))
ba.textwidget(edit=self._text_field, text='')
def close(self) -> None:

View File

@ -8,7 +8,6 @@ import random
import time
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -450,9 +449,9 @@ class PartyQueueWindow(ba.Window):
now = time.time()
if (self._last_connect_attempt_time is None
or now - self._last_connect_attempt_time > 10.0):
_ba.connect_to_party(address=self._address,
port=self._port,
print_progress=False)
ba.internal.connect_to_party(address=self._address,
port=self._port,
print_progress=False)
self._last_connect_attempt_time = now
def on_boost_press(self) -> None:

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -130,13 +129,15 @@ class PlayWindow(ba.Window):
on_activate_call=self._coop)
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
ba.widget(edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(edit=btn,
up_widget=_ba.get_special_widget('account_button'))
ba.widget(
edit=btn,
down_widget=_ba.get_special_widget('settings_button'))
left_widget=ba.internal.get_special_widget('back_button'))
ba.widget(
edit=btn,
up_widget=ba.internal.get_special_widget('account_button'))
ba.widget(edit=btn,
down_widget=ba.internal.get_special_widget(
'settings_button'))
self._draw_dude(0,
btn,
@ -217,9 +218,11 @@ class PlayWindow(ba.Window):
on_activate_call=self._team_tourney)
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
up_widget=_ba.get_special_widget('tickets_plus_button'),
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=btn,
up_widget=ba.internal.get_special_widget(
'tickets_plus_button'),
right_widget=ba.internal.get_special_widget('party_button'))
xxx = -14
self._draw_dude(2,

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -58,8 +57,9 @@ class PlaylistAddGameWindow(ba.Window):
on_activate_call=self._add)
if ba.app.ui.use_toolbars:
ba.widget(edit=select_button,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=select_button,
right_widget=ba.internal.get_special_widget('party_button'))
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, self._height - 28),
@ -134,7 +134,7 @@ class PlaylistAddGameWindow(ba.Window):
# We asked for a bg thread completion cb so we can do some
# filtering here in the bg thread where its not gonna cause hitches.
assert not _ba.in_logic_thread()
assert not ba.in_logic_thread()
sessiontype = self._editcontroller.get_session_type()
unowned = get_unowned_game_types()
self._game_types = [
@ -210,8 +210,8 @@ class PlaylistAddGameWindow(ba.Window):
self._refresh(select_get_more_games_button=True)
def _add(self) -> None:
_ba.lock_all_input() # Make sure no more commands happen.
ba.timer(0.1, _ba.unlock_all_input, timetype=ba.TimeType.REAL)
ba.internal.lock_all_input() # Make sure no more commands happen.
ba.timer(0.1, ba.internal.unlock_all_input, timetype=ba.TimeType.REAL)
assert self._selected_game_type is not None
self._editcontroller.add_game_type_selected(self._selected_game_type)

View File

@ -8,7 +8,6 @@ import copy
import math
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -369,14 +368,14 @@ class PlaylistBrowserWindow(ba.Window):
if (x == 0 and ba.app.ui.use_toolbars
and uiscale is ba.UIScale.SMALL):
ba.widget(
edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(edit=btn,
left_widget=ba.internal.get_special_widget(
'back_button'))
if (x == columns - 1 and ba.app.ui.use_toolbars
and uiscale is ba.UIScale.SMALL):
ba.widget(
edit=btn,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(edit=btn,
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.buttonwidget(
edit=btn,
on_activate_call=ba.Call(self._on_playlist_press, btn,

View File

@ -8,7 +8,6 @@ import copy
import time
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -226,7 +225,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
ba.widget(edit=btn, right_widget=scrollwidget)
ba.widget(edit=scrollwidget,
left_widget=new_button,
right_widget=_ba.get_special_widget('party_button')
right_widget=ba.internal.get_special_widget('party_button')
if ba.app.ui.use_toolbars else None)
# make sure config exists
@ -280,23 +279,23 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
def _run_selected_playlist(self) -> None:
# pylint: disable=cyclic-import
_ba.unlock_all_input()
ba.internal.unlock_all_input()
try:
_ba.new_host_session(self._sessiontype)
ba.internal.new_host_session(self._sessiontype)
except Exception:
from bastd import mainmenu
ba.print_exception(f'Error running session {self._sessiontype}.')
# Drop back into a main menu session.
_ba.new_host_session(mainmenu.MainMenuSession)
ba.internal.new_host_session(mainmenu.MainMenuSession)
def _choose_playlist(self) -> None:
if self._selected_playlist_name is None:
return
self._save_playlist_selection()
ba.containerwidget(edit=self._root_widget, transition='out_left')
_ba.fade_screen(False, endcall=self._run_selected_playlist)
_ba.lock_all_input()
ba.internal.fade_screen(False, endcall=self._run_selected_playlist)
ba.internal.lock_all_input()
def _refresh(self, select_playlist: str | None = None) -> None:
from efro.util import asserttype

View File

@ -8,7 +8,6 @@ from typing import TYPE_CHECKING, cast
import ba
import ba.internal
import _ba
if TYPE_CHECKING:
from bastd.ui.playlist.editcontroller import PlaylistEditController
@ -59,8 +58,9 @@ class PlaylistEditWindow(ba.Window):
text_scale=1.2)
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=btn,
right_widget=ba.internal.get_special_widget('party_button'))
ba.widget(edit=cancel_button,
left_widget=cancel_button,

View File

@ -8,8 +8,8 @@ import copy
import random
from typing import TYPE_CHECKING, cast
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -134,7 +134,7 @@ class PlaylistEditGameWindow(ba.Window):
resource='doneText'))
if ba.app.ui.use_toolbars:
pbtn = _ba.get_special_widget('party_button')
pbtn = ba.internal.get_special_widget('party_button')
ba.widget(edit=add_button, right_widget=pbtn, up_widget=pbtn)
ba.textwidget(parent=self._root_widget,

View File

@ -7,7 +7,6 @@ from __future__ import annotations
import math
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -166,9 +165,9 @@ class PlaylistMapSelectWindow(ba.Window):
if y == 0:
ba.widget(edit=btn, up_widget=self._cancel_button)
if x == columns - 1 and ba.app.ui.use_toolbars:
ba.widget(
edit=btn,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(edit=btn,
right_widget=ba.internal.get_special_widget(
'party_button'))
ba.widget(edit=btn, show_buffer_top=60, show_buffer_bottom=60)
if self._maps[index][0] == self._previous_map:
@ -237,8 +236,8 @@ class PlaylistMapSelectWindow(ba.Window):
edit_info=self._edit_info).get_root_widget())
def _select_with_delay(self, map_name: str) -> None:
_ba.lock_all_input()
ba.timer(0.1, _ba.unlock_all_input, timetype=ba.TimeType.REAL)
ba.internal.lock_all_input()
ba.timer(0.1, ba.internal.unlock_all_input, timetype=ba.TimeType.REAL)
ba.timer(0.1,
ba.WeakCall(self._select, map_name),
timetype=ba.TimeType.REAL)

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui import popup
@ -419,8 +418,8 @@ class PlayOptionsWindow(popup.PopupWindow):
if self._delegate is not None:
self._delegate.on_play_options_window_run_game()
else:
_ba.fade_screen(False, endcall=self._run_selected_playlist)
_ba.lock_all_input()
ba.internal.fade_screen(False, endcall=self._run_selected_playlist)
ba.internal.lock_all_input()
self._transition_out(transition='out_left')
if self._delegate is not None:
self._delegate.on_play_options_window_run_game()
@ -428,12 +427,12 @@ class PlayOptionsWindow(popup.PopupWindow):
cfg.commit()
def _run_selected_playlist(self) -> None:
_ba.unlock_all_input()
ba.internal.unlock_all_input()
try:
_ba.new_host_session(self._sessiontype)
ba.internal.new_host_session(self._sessiontype)
except Exception:
from bastd import mainmenu
ba.print_exception('exception running session', self._sessiontype)
# Drop back into a main menu session.
_ba.new_host_session(mainmenu.MainMenuSession)
ba.internal.new_host_session(mainmenu.MainMenuSession)

View File

@ -7,8 +7,8 @@ from __future__ import annotations
import weakref
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Sequence, Callable
@ -81,7 +81,7 @@ class PopupWindow:
scale=scale,
toolbar_visibility=toolbar_visibility,
size=size,
parent=_ba.get_special_widget('overlay_stack'),
parent=ba.internal.get_special_widget('overlay_stack'),
stack_offset=(x_fin - x_offs, y_fin - y_offs),
scale_origin_stack_offset=(position[0], position[1]),
on_outside_click_call=self.on_popup_cancel,
@ -159,15 +159,15 @@ class PopupMenuWindow(PopupWindow):
self._width,
min(
maxwidth,
_ba.get_string_width(choice_display_name,
suppress_warning=True)) + 75)
ba.internal.get_string_width(
choice_display_name, suppress_warning=True)) + 75)
else:
self._width = max(
self._width,
min(
maxwidth,
_ba.get_string_width(choice_display_name,
suppress_warning=True)) + 60)
ba.internal.get_string_width(
choice_display_name, suppress_warning=True)) + 60)
# init parent class - this will rescale and reposition things as
# needed and create our root widget

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -332,7 +331,7 @@ class ProfileBrowserWindow(ba.Window):
# If there's a team-chooser in existence, tell it the profile-list
# has probably changed.
session = _ba.get_foreground_host_session()
session = ba.internal.get_foreground_host_session()
if session is not None:
session.handlemessage(PlayerProfilesChangedMessage())

View File

@ -7,7 +7,6 @@ from __future__ import annotations
import random
from typing import TYPE_CHECKING, cast
import _ba
import ba
import ba.internal
@ -145,7 +144,7 @@ class EditProfileWindow(ba.Window):
# Assign a random name if they had none.
if self._name == '':
names = _ba.get_random_names()
names = ba.internal.get_random_names()
self._name = names[random.randrange(len(names))]
self._clipped_name_text = ba.textwidget(parent=self._root_widget,
@ -189,7 +188,8 @@ class EditProfileWindow(ba.Window):
resource='editProfileWindow.accountProfileText').evaluate()
b_width = min(
270.0,
_ba.get_string_width(txtl, suppress_warning=True) * 0.6)
ba.internal.get_string_width(txtl, suppress_warning=True) *
0.6)
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, v - 39),
size=(0, 0),
@ -259,7 +259,8 @@ class EditProfileWindow(ba.Window):
resource='editProfileWindow.globalProfileText').evaluate()
b_width = min(
240.0,
_ba.get_string_width(txtl, suppress_warning=True) * 0.6)
ba.internal.get_string_width(txtl, suppress_warning=True) *
0.6)
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, v - 39),
size=(0, 0),
@ -300,7 +301,8 @@ class EditProfileWindow(ba.Window):
resource='editProfileWindow.localProfileText').evaluate()
b_width = min(
270.0,
_ba.get_string_width(txtl, suppress_warning=True) * 0.6)
ba.internal.get_string_width(txtl, suppress_warning=True) *
0.6)
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, v - 43),
size=(0, 0),

View File

@ -4,7 +4,6 @@
from __future__ import annotations
import _ba
import ba
import ba.internal
@ -19,7 +18,7 @@ class ReportPlayerWindow(ba.Window):
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
overlay_stack = _ba.get_special_widget('overlay_stack')
overlay_stack = ba.internal.get_special_widget('overlay_stack')
uiscale = ba.app.ui.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
@ -71,7 +70,7 @@ class ReportPlayerWindow(ba.Window):
})
body = ba.Lstr(resource='reportPlayerExplanationText').evaluate()
ba.open_url('mailto:support@froemling.net'
f'?subject={_ba.appnameupper()} Player Report: ' +
f'?subject={ba.internal.appnameupper()} Player Report: ' +
self._account_id + '&body=' + parse.quote(body))
self.close()
@ -84,7 +83,7 @@ class ReportPlayerWindow(ba.Window):
})
body = ba.Lstr(resource='reportPlayerExplanationText').evaluate()
ba.open_url('mailto:support@froemling.net'
f'?subject={_ba.appnameupper()} Player Report: ' +
f'?subject={ba.internal.appnameupper()} Player Report: ' +
self._account_id + '&body=' + parse.quote(body))
self.close()

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -23,8 +22,9 @@ class ServerDialogWindow(ba.Window):
subs=data.get('subs', [])).evaluate()
txt = txt.strip()
txt_scale = 1.5
txt_height = (_ba.get_string_height(txt, suppress_warning=True) *
txt_scale)
txt_height = (
ba.internal.get_string_height(txt, suppress_warning=True) *
txt_scale)
self._width = 500
self._height = 160 + min(200, txt_height)
uiscale = ba.app.ui.uiscale

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui import popup as popup_ui
@ -201,10 +200,10 @@ class AdvancedSettingsWindow(ba.Window):
# menu based on the language so still need this. ...however we could
# make this more limited to it only rebuilds that one menu instead
# of everything.
if self._menu_open or (self._prev_lang == _ba.app.config.get(
if self._menu_open or (self._prev_lang == ba.app.config.get(
'Lang', None) and self._prev_lang_list == available_languages):
return
self._prev_lang = _ba.app.config.get('Lang', None)
self._prev_lang = ba.app.config.get('Lang', None)
self._prev_lang_list = available_languages
# Clear out our sub-container.
@ -252,8 +251,8 @@ class AdvancedSettingsWindow(ba.Window):
h_align='right',
v_align='center')
languages = _ba.app.lang.available_languages
cur_lang = _ba.app.config.get('Lang', None)
languages = ba.app.lang.available_languages
cur_lang = ba.app.config.get('Lang', None)
if cur_lang is None:
cur_lang = 'Auto'
@ -513,11 +512,12 @@ class AdvancedSettingsWindow(ba.Window):
ba.widget(edit=child, show_buffer_bottom=30, show_buffer_top=20)
if ba.app.ui.use_toolbars:
pbtn = _ba.get_special_widget('party_button')
pbtn = ba.internal.get_special_widget('party_button')
ba.widget(edit=self._scrollwidget, right_widget=pbtn)
if self._back_button is None:
ba.widget(edit=self._scrollwidget,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=self._scrollwidget,
left_widget=ba.internal.get_special_widget('back_button'))
self._restore_state()

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -118,7 +118,7 @@ class AllSettingsWindow(ba.Window):
label='',
on_activate_call=self._do_controllers)
if ba.app.ui.use_toolbars and self._back_button is None:
bbtn = _ba.get_special_widget('back_button')
bbtn = ba.internal.get_special_widget('back_button')
ba.widget(edit=ctb, left_widget=bbtn)
_b_title(x_offs2, v, ctb,
ba.Lstr(resource=self._r + '.controllersText'))
@ -138,7 +138,7 @@ class AllSettingsWindow(ba.Window):
label='',
on_activate_call=self._do_graphics)
if ba.app.ui.use_toolbars:
pbtn = _ba.get_special_widget('party_button')
pbtn = ba.internal.get_special_widget('party_button')
ba.widget(edit=gfxb, up_widget=pbtn, right_widget=pbtn)
_b_title(x_offs3, v, gfxb, ba.Lstr(resource=self._r + '.graphicsText'))
imgw = imgh = 110

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -105,8 +105,9 @@ class AudioSettingsWindow(ba.Window):
maxval=1.0,
increment=0.1)
if ba.app.ui.use_toolbars:
ba.widget(edit=svne.plusbutton,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=svne.plusbutton,
right_widget=ba.internal.get_special_widget('party_button'))
v -= spacing
self._music_volume_numedit = ConfigNumberEdit(
parent=self._root_widget,
@ -208,12 +209,13 @@ class AudioSettingsWindow(ba.Window):
# We require disk access for soundtracks;
# if we don't have it, request it.
if not _ba.have_permission(ba.Permission.STORAGE):
if not ba.internal.have_permission(ba.Permission.STORAGE):
ba.playsound(ba.getsound('ding'))
ba.screenmessage(ba.Lstr(resource='storagePermissionAccessText'),
color=(0.5, 1, 0.5))
ba.timer(1.0,
ba.Call(_ba.request_permission, ba.Permission.STORAGE),
ba.Call(ba.internal.request_permission,
ba.Permission.STORAGE),
timetype=ba.TimeType.REAL)
return

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -41,7 +41,7 @@ class ControlsSettingsWindow(ba.Window):
self._r = 'configControllersWindow'
app = ba.app
# is_fire_tv = _ba.is_running_on_fire_tv()
# is_fire_tv = ba.internal.is_running_on_fire_tv()
spacing = 50.0
button_width = 350.0
@ -63,7 +63,7 @@ class ControlsSettingsWindow(ba.Window):
height += spacing
show_touch = False
if _ba.have_touchscreen_input():
if ba.internal.have_touchscreen_input():
show_touch = True
height += spacing
@ -73,7 +73,8 @@ class ControlsSettingsWindow(ba.Window):
height += space_height
show_keyboard = False
if _ba.getinputdevice('Keyboard', '#1', doraise=False) is not None:
if ba.internal.getinputdevice('Keyboard', '#1',
doraise=False) is not None:
show_keyboard = True
height += spacing
show_keyboard_p2 = False if app.vr_mode else show_keyboard
@ -101,7 +102,7 @@ class ControlsSettingsWindow(ba.Window):
# (we can run into problems where devices register as one of each
# type otherwise)..
show_mac_controller_subsystem = False
if platform == 'mac' and _ba.is_xcode_build():
if platform == 'mac' and ba.internal.is_xcode_build():
show_mac_controller_subsystem = True
if show_mac_controller_subsystem:
@ -163,7 +164,8 @@ class ControlsSettingsWindow(ba.Window):
on_activate_call=self._do_touchscreen)
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
if not self._have_selected_child:
ba.containerwidget(edit=self._root_widget,
selected_child=self._touch_button)
@ -182,7 +184,8 @@ class ControlsSettingsWindow(ba.Window):
on_activate_call=self._do_gamepads)
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
if not self._have_selected_child:
ba.containerwidget(edit=self._root_widget,
selected_child=self._gamepads_button)
@ -206,7 +209,8 @@ class ControlsSettingsWindow(ba.Window):
on_activate_call=self._config_keyboard)
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
if not self._have_selected_child:
ba.containerwidget(edit=self._root_widget,
selected_child=self._keyboard_button)
@ -235,7 +239,8 @@ class ControlsSettingsWindow(ba.Window):
on_activate_call=self._do_mobile_devices)
if ba.app.ui.use_toolbars:
ba.widget(edit=btn,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
if not self._have_selected_child:
ba.containerwidget(edit=self._root_widget,
selected_child=self._idevices_button)
@ -251,13 +256,15 @@ class ControlsSettingsWindow(ba.Window):
ba.Lstr(resource='settingsWindowAdvanced.mustRestartText'),
color=(1, 1, 0))
ba.playsound(ba.getsound('gunCocking'))
_ba.set_low_level_config_value('enablexinput', not value)
ba.internal.set_low_level_config_value('enablexinput',
not value)
ba.checkboxwidget(
parent=self._root_widget,
position=(100, v + 3),
size=(120, 30),
value=(not _ba.get_low_level_config_value('enablexinput', 1)),
value=(not ba.internal.get_low_level_config_value(
'enablexinput', 1)),
maxwidth=200,
on_value_change_call=do_toggle,
text=ba.Lstr(resource='disableXInputText'),
@ -323,8 +330,8 @@ class ControlsSettingsWindow(ba.Window):
self._save_state()
ba.containerwidget(edit=self._root_widget, transition='out_left')
ba.app.ui.set_main_menu_window(
ConfigKeyboardWindow(_ba.getinputdevice('Keyboard',
'#1')).get_root_widget())
ConfigKeyboardWindow(ba.internal.getinputdevice(
'Keyboard', '#1')).get_root_widget())
def _config_keyboard2(self) -> None:
# pylint: disable=cyclic-import
@ -332,8 +339,8 @@ class ControlsSettingsWindow(ba.Window):
self._save_state()
ba.containerwidget(edit=self._root_widget, transition='out_left')
ba.app.ui.set_main_menu_window(
ConfigKeyboardWindow(_ba.getinputdevice('Keyboard',
'#2')).get_root_widget())
ConfigKeyboardWindow(ba.internal.getinputdevice(
'Keyboard', '#2')).get_root_widget())
def _do_mobile_devices(self) -> None:
# pylint: disable=cyclic-import

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -801,7 +801,7 @@ class AwaitGamepadInputWindow(ba.Window):
ba.Call(self._decrement),
repeat=True,
timetype=ba.TimeType.REAL)
_ba.capture_gamepad_input(ba.WeakCall(self._event_callback))
ba.internal.capture_gamepad_input(ba.WeakCall(self._event_callback))
def __del__(self) -> None:
pass
@ -811,7 +811,7 @@ class AwaitGamepadInputWindow(ba.Window):
# This strong-refs us; killing it allow us to die now.
self._decrement_timer = None
_ba.release_gamepad_input()
ba.internal.release_gamepad_input()
if self._root_widget:
ba.containerwidget(edit=self._root_widget, transition='out_scale')

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any
@ -21,7 +21,7 @@ def gamepad_configure_callback(event: dict[str, Any]) -> None:
# Ignore all but button-presses.
if event['type'] not in ['BUTTONDOWN', 'HATMOTION']:
return
_ba.release_gamepad_input()
ba.internal.release_gamepad_input()
try:
ba.app.ui.clear_main_menu_window(transition='out_left')
except Exception:
@ -140,11 +140,11 @@ class GamepadSelectWindow(ba.Window):
h_align='center',
v_align='top')
_ba.capture_gamepad_input(gamepad_configure_callback)
ba.internal.capture_gamepad_input(gamepad_configure_callback)
def _back(self) -> None:
from bastd.ui.settings import controls
_ba.release_gamepad_input()
ba.internal.release_gamepad_input()
ba.containerwidget(edit=self._root_widget, transition='out_right')
ba.app.ui.set_main_menu_window(
controls.ControlsSettingsWindow(

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -52,7 +52,7 @@ class GraphicsSettingsWindow(ba.Window):
show_gamma = False
gamma_spacing = spacing * 1.3
if _ba.has_gamma_control():
if ba.internal.has_gamma_control():
show_gamma = True
height += gamma_spacing
@ -137,7 +137,8 @@ class GraphicsSettingsWindow(ba.Window):
textscale=0.85)
if ba.app.ui.use_toolbars:
ba.widget(edit=gmc.plusbutton,
right_widget=_ba.get_special_widget('party_button'))
right_widget=ba.internal.get_special_widget(
'party_button'))
if not self._have_selected_child:
ba.containerwidget(edit=self._root_widget,
selected_child=gmc.minusbutton)
@ -166,7 +167,7 @@ class GraphicsSettingsWindow(ba.Window):
scale=popup_menu_scale,
choices=['Auto', 'Higher', 'High', 'Medium', 'Low'],
choices_disabled=['Higher', 'High']
if _ba.get_max_graphics_quality() == 'Medium' else [],
if ba.internal.get_max_graphics_quality() == 'Medium' else [],
choices_display=[
ba.Lstr(resource='autoText'),
ba.Lstr(resource=self._r + '.higherText'),
@ -202,8 +203,9 @@ class GraphicsSettingsWindow(ba.Window):
current_choice=ba.app.config.resolve('Texture Quality'),
on_value_change_call=self._set_textures)
if ba.app.ui.use_toolbars:
ba.widget(edit=textures_popup.get_button(),
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=textures_popup.get_button(),
right_widget=ba.internal.get_special_widget('party_button'))
v -= 80
h_offs = 0
@ -238,7 +240,7 @@ class GraphicsSettingsWindow(ba.Window):
current_choice=current_res_cardboard,
on_value_change_call=self._set_gvr_render_target_scale)
else:
native_res = _ba.get_display_resolution()
native_res = ba.internal.get_display_resolution()
assert native_res is not None
choices = ['Auto', 'Native']
choices_display = [
@ -265,7 +267,7 @@ class GraphicsSettingsWindow(ba.Window):
else:
# if we're on a system that doesn't allow setting resolution,
# set pixel-scale instead
current_res = _ba.get_display_resolution()
current_res = ba.internal.get_display_resolution()
if current_res is None:
current_res2 = (str(min(100, max(10, int(round(
ba.app.config.resolve('Screen Pixel Scale')

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any
@ -281,10 +281,10 @@ class AwaitKeyboardInputWindow(ba.Window):
text=str(self._counter))
self._decrement_timer: ba.Timer | None = ba.Timer(
1.0, self._decrement, repeat=True, timetype=ba.TimeType.REAL)
_ba.capture_keyboard_input(ba.WeakCall(self._button_callback))
ba.internal.capture_keyboard_input(ba.WeakCall(self._button_callback))
def __del__(self) -> None:
_ba.release_keyboard_input()
ba.internal.release_keyboard_input()
def _die(self) -> None:
# This strong-refs us; killing it allows us to die now.

View File

@ -11,7 +11,6 @@ from threading import Thread
from typing import TYPE_CHECKING
from efro.error import CleanError
import _ba
import ba
import ba.internal
from bastd.ui.settings.testing import TestingWindow
@ -165,7 +164,7 @@ def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None:
try:
_print(f'Running network diagnostics...\n'
f'ua: {_ba.app.user_agent_string}\n'
f'ua: {ba.app.user_agent_string}\n'
f'time: {utc_now()}.')
if bool(False):
@ -344,7 +343,7 @@ def _test_fetch(baseaddr: str) -> None:
import urllib.request
response = urllib.request.urlopen(
urllib.request.Request(f'{baseaddr}/ping', None,
{'User-Agent': _ba.app.user_agent_string}),
{'User-Agent': ba.app.user_agent_string}),
context=ba.app.net.sslcontext,
timeout=MAX_TEST_SECONDS,
)

View File

@ -7,8 +7,8 @@ from __future__ import annotations
import copy
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -96,7 +96,7 @@ class TestingWindow(ba.Window):
# we can reset if we want..
if entry_name not in ba.app.value_test_defaults:
ba.app.value_test_defaults[entry_name] = (
_ba.value_test(entry_name))
ba.internal.value_test(entry_name))
ba.textwidget(parent=self._subcontainer,
position=(h, v),
@ -125,7 +125,7 @@ class TestingWindow(ba.Window):
v_align='center',
maxwidth=60,
text='%.4g' %
_ba.value_test(entry_name))
ba.internal.value_test(entry_name))
btn = ba.buttonwidget(parent=self._subcontainer,
position=(h + 140, v - 19),
size=(40, 40),
@ -156,25 +156,26 @@ class TestingWindow(ba.Window):
def _on_reset_press(self) -> None:
for entry in self._entries:
_ba.value_test(entry['name'],
absolute=ba.app.value_test_defaults[entry['name']])
ba.internal.value_test(
entry['name'],
absolute=ba.app.value_test_defaults[entry['name']])
# pylint: disable=consider-using-f-string
ba.textwidget(edit=entry['widget'],
text='%.4g' % _ba.value_test(entry['name']))
text='%.4g' % ba.internal.value_test(entry['name']))
def _on_minus_press(self, entry_name: str) -> None:
entry = self._get_entry(entry_name)
_ba.value_test(entry['name'], change=-entry['increment'])
ba.internal.value_test(entry['name'], change=-entry['increment'])
# pylint: disable=consider-using-f-string
ba.textwidget(edit=entry['widget'],
text='%.4g' % _ba.value_test(entry['name']))
text='%.4g' % ba.internal.value_test(entry['name']))
def _on_plus_press(self, entry_name: str) -> None:
entry = self._get_entry(entry_name)
_ba.value_test(entry['name'], change=entry['increment'])
ba.internal.value_test(entry['name'], change=entry['increment'])
# pylint: disable=consider-using-f-string
ba.textwidget(edit=entry['widget'],
text='%.4g' % _ba.value_test(entry['name']))
text='%.4g' % ba.internal.value_test(entry['name']))
def _do_back(self) -> None:
# pylint: disable=cyclic-import

View File

@ -3,8 +3,8 @@
"""UI settings functionality related to touchscreens."""
from __future__ import annotations
import _ba
import ba
import ba.internal
class TouchscreenSettingsWindow(ba.Window):
@ -16,7 +16,7 @@ class TouchscreenSettingsWindow(ba.Window):
# FIXME: Could switch to a UI destroy callback now that those are a
# thing that exists.
_ba.set_touchscreen_editing(False)
ba.internal.set_touchscreen_editing(False)
def __init__(self) -> None:
@ -25,7 +25,7 @@ class TouchscreenSettingsWindow(ba.Window):
self._spacing = 40
self._r = 'configTouchscreenWindow'
_ba.set_touchscreen_editing(True)
ba.internal.set_touchscreen_editing(True)
uiscale = ba.app.ui.uiscale
super().__init__(root_widget=ba.containerwidget(
@ -233,4 +233,4 @@ class TouchscreenSettingsWindow(ba.Window):
ba.app.ui.set_main_menu_window(
controls.ControlsSettingsWindow(
transition='in_left').get_root_widget())
_ba.set_touchscreen_editing(False)
ba.internal.set_touchscreen_editing(False)

View File

@ -6,8 +6,8 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
pass
@ -19,7 +19,7 @@ class XBox360ControllerSettingsWindow(ba.Window):
def __init__(self) -> None:
self._r = 'xbox360ControllersWindow'
width = 700
height = 300 if _ba.is_running_on_fire_tv() else 485
height = 300 if ba.internal.is_running_on_fire_tv() else 485
spacing = 40
uiscale = ba.app.ui.uiscale
super().__init__(root_widget=ba.containerwidget(
@ -58,7 +58,7 @@ class XBox360ControllerSettingsWindow(ba.Window):
v = height - 70
v -= spacing
if _ba.is_running_on_fire_tv():
if ba.internal.is_running_on_fire_tv():
ba.textwidget(parent=self._root_widget,
position=(width * 0.5, height * 0.47),
size=(0, 0),

View File

@ -7,8 +7,8 @@ from __future__ import annotations
import copy
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any
@ -105,8 +105,9 @@ class SoundtrackBrowserWindow(ba.Window):
texture=lock_tex))
if self._back_button is None:
ba.widget(edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=btn,
left_widget=ba.internal.get_special_widget('back_button'))
v -= 60.0 * scl
self._edit_button = btn = ba.buttonwidget(
@ -127,8 +128,9 @@ class SoundtrackBrowserWindow(ba.Window):
position=(h - 10, v + 55.0 * scl - 28),
texture=lock_tex))
if self._back_button is None:
ba.widget(edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=btn,
left_widget=ba.internal.get_special_widget('back_button'))
v -= 60.0 * scl
self._duplicate_button = btn = ba.buttonwidget(
@ -149,8 +151,9 @@ class SoundtrackBrowserWindow(ba.Window):
position=(h - 10, v + 55.0 * scl - 28),
texture=lock_tex))
if self._back_button is None:
ba.widget(edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=btn,
left_widget=ba.internal.get_special_widget('back_button'))
v -= 60.0 * scl
self._delete_button = btn = ba.buttonwidget(
@ -171,8 +174,9 @@ class SoundtrackBrowserWindow(ba.Window):
position=(h - 10, v + 55.0 * scl - 28),
texture=lock_tex))
if self._back_button is None:
ba.widget(edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=btn,
left_widget=ba.internal.get_special_widget('back_button'))
# Keep our lock images up to date/etc.
self._update_timer = ba.Timer(1.0,
@ -191,7 +195,7 @@ class SoundtrackBrowserWindow(ba.Window):
size=(self._width - (205 + 2 * x_inset), scroll_height))
ba.widget(edit=self._scrollwidget,
left_widget=self._new_button,
right_widget=_ba.get_special_widget('party_button')
right_widget=ba.internal.get_special_widget('party_button')
if ba.app.ui.use_toolbars else self._scrollwidget)
self._col = ba.columnwidget(parent=scrollwidget, border=2, margin=0)

View File

@ -6,8 +6,8 @@ from __future__ import annotations
import copy
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any, Callable
@ -160,7 +160,7 @@ class SoundtrackEntryTypeSelectWindow(ba.Window):
from ba.osmusic import OSMusicPlayer
from bastd.ui.fileselector import FileSelectorWindow
ba.containerwidget(edit=self._root_widget, transition='out_left')
base_path = _ba.android_get_external_files_dir()
base_path = ba.internal.android_get_external_files_dir()
ba.app.ui.set_main_menu_window(
FileSelectorWindow(
base_path,
@ -173,7 +173,7 @@ class SoundtrackEntryTypeSelectWindow(ba.Window):
def _on_music_folder_press(self) -> None:
from bastd.ui.fileselector import FileSelectorWindow
ba.containerwidget(edit=self._root_widget, transition='out_left')
base_path = _ba.android_get_external_files_dir()
base_path = ba.internal.android_get_external_files_dir()
ba.app.ui.set_main_menu_window(
FileSelectorWindow(base_path,
callback=self._music_folder_selector_cb,

View File

@ -7,7 +7,6 @@ from __future__ import annotations
import copy
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -65,8 +64,8 @@ class SpecialOfferWindow(ba.Window):
return
# This can pop up suddenly, so lets block input for 1 second.
_ba.lock_all_input()
ba.timer(1.0, _ba.unlock_all_input, timetype=ba.TimeType.REAL)
ba.internal.lock_all_input()
ba.timer(1.0, ba.internal.unlock_all_input, timetype=ba.TimeType.REAL)
ba.playsound(ba.getsound('ding'))
ba.timer(0.3,
lambda: ba.playsound(ba.getsound('ooh')),
@ -342,7 +341,7 @@ class SpecialOfferWindow(ba.Window):
# We go away if we see that our target item is owned.
if self._offer_item == 'pro':
if _ba.app.accounts_v1.have_pro():
if ba.app.accounts_v1.have_pro():
can_die = True
else:
if ba.internal.get_purchased(self._offer_item):

View File

@ -10,7 +10,6 @@ import weakref
from enum import Enum
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -272,9 +271,10 @@ class StoreBrowserWindow(ba.Window):
def _update_get_tickets_button_pos(self) -> None:
uiscale = ba.app.ui.uiscale
pos = (self._width - 252 - (self._x_inset +
(47 if uiscale is ba.UIScale.SMALL
and _ba.is_party_icon_visible() else 0)),
pos = (self._width - 252 -
(self._x_inset +
(47 if uiscale is ba.UIScale.SMALL
and ba.internal.is_party_icon_visible() else 0)),
self._height - 70)
if self._get_tickets_button:
ba.buttonwidget(edit=self._get_tickets_button, position=pos)
@ -560,7 +560,7 @@ class StoreBrowserWindow(ba.Window):
for b_type, b_info in self.button_infos.items():
if b_type in ['upgrades.pro', 'pro']:
purchased = _ba.app.accounts_v1.have_pro()
purchased = ba.app.accounts_v1.have_pro()
else:
purchased = ba.internal.get_purchased(b_type)

View File

@ -5,7 +5,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
@ -146,7 +145,7 @@ class StoreButton:
self._update()
def _on_activate(self) -> None:
_ba.increment_analytics_count('Store button press')
ba.internal.increment_analytics_count('Store button press')
self._on_activate_call()
def set_position(self, position: Sequence[float]) -> None:

View File

@ -4,8 +4,8 @@
from __future__ import annotations
import _ba
import ba
import ba.internal
class TelnetAccessRequestWindow(ba.Window):
@ -45,9 +45,9 @@ class TelnetAccessRequestWindow(ba.Window):
def _cancel(self) -> None:
ba.containerwidget(edit=self._root_widget, transition='out_right')
_ba.set_telnet_access_enabled(False)
ba.internal.set_telnet_access_enabled(False)
def _ok(self) -> None:
ba.containerwidget(edit=self._root_widget, transition='out_left')
_ba.set_telnet_access_enabled(True)
ba.internal.set_telnet_access_enabled(True)
ba.screenmessage(ba.Lstr(resource='telnetAccessGrantedText'))

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
import ba
import ba.internal
from bastd.ui import popup
@ -89,7 +88,7 @@ class TournamentEntryWindow(popup.PopupWindow):
self._launched = False
# Show the ad button only if we support ads *and* it has a level 1 fee.
self._do_ad_btn = (_ba.has_video_ads() and self._allow_ads)
self._do_ad_btn = (ba.internal.has_video_ads() and self._allow_ads)
x_offs = 0 if self._do_ad_btn else 85
@ -404,7 +403,7 @@ class TournamentEntryWindow(popup.PopupWindow):
if self._purchase_price == 0 else self._ticket_img_pos)
if self._do_ad_btn:
enabled = _ba.have_incentivized_ad()
enabled = ba.internal.have_incentivized_ad()
have_ad_tries_remaining = (
self._tournament_info['adTriesRemaining'] is not None
and self._tournament_info['adTriesRemaining'] > 0)
@ -561,9 +560,9 @@ class TournamentEntryWindow(popup.PopupWindow):
cur_time = ba.time(ba.TimeType.REAL)
if cur_time - self._last_ad_press_time > 5.0:
self._last_ad_press_time = cur_time
_ba.app.ads.show_ad_2('tournament_entry',
on_completion_call=ba.WeakCall(
self._on_ad_complete))
ba.app.ads.show_ad_2('tournament_entry',
on_completion_call=ba.WeakCall(
self._on_ad_complete))
def _on_ad_complete(self, actually_showed: bool) -> None:

View File

@ -4,8 +4,8 @@
from __future__ import annotations
import _ba
import ba
import ba.internal
class ShowURLWindow(ba.Window):
@ -41,7 +41,7 @@ class ShowURLWindow(ba.Window):
position=(self._width * 0.5 - qr_size * 0.5,
self._height * 0.5 - qr_size * 0.5),
size=(qr_size, qr_size),
texture=_ba.get_qrcode_texture(address))
texture=ba.internal.get_qrcode_texture(address))
ba.containerwidget(edit=self._root_widget,
cancel_button=self._cancel_button)
else:

View File

@ -8,8 +8,8 @@ import os
from enum import Enum
from typing import TYPE_CHECKING, cast
import _ba
import ba
import ba.internal
if TYPE_CHECKING:
from typing import Any
@ -114,10 +114,11 @@ class WatchWindow(ba.Window):
if ba.app.ui.use_toolbars:
first_tab = self._tab_row.tabs[tabdefs[0][0]]
last_tab = self._tab_row.tabs[tabdefs[-1][0]]
ba.widget(edit=last_tab.button,
right_widget=_ba.get_special_widget('party_button'))
ba.widget(
edit=last_tab.button,
right_widget=ba.internal.get_special_widget('party_button'))
if uiscale is ba.UIScale.SMALL:
bbtn = _ba.get_special_widget('back_button')
bbtn = ba.internal.get_special_widget('back_button')
ba.widget(edit=first_tab.button,
up_widget=bbtn,
left_widget=bbtn)
@ -224,8 +225,9 @@ class WatchWindow(ba.Window):
autoselect=True)
ba.widget(edit=btn1, up_widget=self._tab_row.tabs[tab_id].button)
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
ba.widget(edit=btn1,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(
edit=btn1,
left_widget=ba.internal.get_special_widget('back_button'))
btnv -= b_height + b_space_extra
ba.buttonwidget(parent=cnt,
size=(b_width, b_height),
@ -282,25 +284,25 @@ class WatchWindow(ba.Window):
if self._my_replay_selected is None:
self._no_replay_selected_error()
return
_ba.increment_analytics_count('Replay watch')
ba.internal.increment_analytics_count('Replay watch')
def do_it() -> None:
try:
# Reset to normal speed.
_ba.set_replay_speed_exponent(0)
_ba.fade_screen(True)
ba.internal.set_replay_speed_exponent(0)
ba.internal.fade_screen(True)
assert self._my_replay_selected is not None
_ba.new_replay_session(_ba.get_replays_dir() + '/' +
self._my_replay_selected)
ba.internal.new_replay_session(ba.internal.get_replays_dir() +
'/' + self._my_replay_selected)
except Exception:
ba.print_exception('Error running replay session.')
# Drop back into a fresh main menu session
# in case we half-launched or something.
from bastd import mainmenu
_ba.new_host_session(mainmenu.MainMenuSession)
ba.internal.new_host_session(mainmenu.MainMenuSession)
_ba.fade_screen(False, endcall=ba.Call(ba.pushcall, do_it))
ba.internal.fade_screen(False, endcall=ba.Call(ba.pushcall, do_it))
ba.containerwidget(edit=self._root_widget, transition='out_left')
def _on_my_replay_rename_press(self) -> None:
@ -371,9 +373,9 @@ class WatchWindow(ba.Window):
# (or what it looks like to the user).
if (replay != new_name
and self._get_replay_display_name(replay) != new_name_raw):
old_name_full = (_ba.get_replays_dir() + '/' +
old_name_full = (ba.internal.get_replays_dir() + '/' +
replay).encode('utf-8')
new_name_full = (_ba.get_replays_dir() + '/' +
new_name_full = (ba.internal.get_replays_dir() + '/' +
new_name).encode('utf-8')
# False alarm; ba.textwidget can return non-None val.
# pylint: disable=unsupported-membership-test
@ -389,7 +391,7 @@ class WatchWindow(ba.Window):
'.replayRenameErrorInvalidName'),
color=(1, 0, 0))
else:
_ba.increment_analytics_count('Replay rename')
ba.internal.increment_analytics_count('Replay rename')
os.rename(old_name_full, new_name_full)
self._refresh_my_replays()
ba.playsound(ba.getsound('gunCocking'))
@ -426,8 +428,9 @@ class WatchWindow(ba.Window):
def _delete_replay(self, replay: str) -> None:
try:
_ba.increment_analytics_count('Replay delete')
os.remove((_ba.get_replays_dir() + '/' + replay).encode('utf-8'))
ba.internal.increment_analytics_count('Replay delete')
os.remove(
(ba.internal.get_replays_dir() + '/' + replay).encode('utf-8'))
self._refresh_my_replays()
ba.playsound(ba.getsound('shieldDown'))
if replay == self._my_replay_selected:
@ -449,7 +452,7 @@ class WatchWindow(ba.Window):
child.delete()
t_scale = 1.6
try:
names = os.listdir(_ba.get_replays_dir())
names = os.listdir(ba.internal.get_replays_dir())
# Ignore random other files in there.
names = [n for n in names if n.endswith('.brp')]

View File

@ -22,7 +22,7 @@
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20770;
const int kAppBuildNumber = 20772;
const char* kAppVersion = "1.7.7";
// Our standalone globals.

View File

@ -599,7 +599,9 @@ static void HandleArgs(int argc, char** argv) {
if (explicit_bool(true)) {
invalid_ptr = nullptr;
}
*invalid_ptr = 1;
if (explicit_bool(true)) {
*invalid_ptr = 1;
}
} else if (!strcmp(argv[i], "-cfgdir")) {
if (i + 1 < argc) {
g_app_globals->user_config_dir = argv[i + 1];

View File

@ -349,6 +349,7 @@ class Updater:
f'Priv or pub legal not found in {fname}.')
def _check_python_file(self, fname: str) -> None:
# pylint: disable=too-many-branches
from efrotools import get_public_license, PYVER
with open(fname, encoding='utf-8') as infile:
contents = infile.read()
@ -375,6 +376,22 @@ class Updater:
if lines[copyrightline].startswith('# Synced from '):
copyrightline += 3
for i, line in enumerate(lines):
# stuff under the ba module.
if '/ba/' in fname:
# Don't allow importing ba at the top level from within ba.
if line == 'import ba':
raise CleanError(
f'{fname}:{i+1}: no top level ba imports allowed'
f' under ba module.')
if '/bastd/' in fname:
# Don't allow importing _ba or _bainternal anywhere here.
# (any internal needs should be in ba.internal)
if 'import _ba' in line:
raise CleanError(
f'{fname}:{i+1}: _ba or _bainternal imports not'
f' allowed under bastd.')
# In all cases, look for our one-line legal notice.
# In the public case, look for the rest of our public license too.
if self._license_line_checks: