Merge branch 'efroemling:main' into docker-fix

This commit is contained in:
Loup 2024-09-27 18:10:21 +05:30 committed by GitHub
commit b73da4845f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
232 changed files with 1792 additions and 1423 deletions

98
.efrocachemap generated
View File

@ -421,13 +421,13 @@
"build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26", "build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26",
"build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8", "build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8",
"build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55", "build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55",
"build/assets/ba_data/data/langdata.json": "fa2cb506dd6628e30b775ca44604e4f8", "build/assets/ba_data/data/langdata.json": "a3d27b587a1b206a3338ef820a802313",
"build/assets/ba_data/data/languages/arabic.json": "609f5d698a488e40e61787b62ee8ea5e", "build/assets/ba_data/data/languages/arabic.json": "609f5d698a488e40e61787b62ee8ea5e",
"build/assets/ba_data/data/languages/belarussian.json": "3d5523d0004293aa2df02f3f6f3b84f8", "build/assets/ba_data/data/languages/belarussian.json": "3d5523d0004293aa2df02f3f6f3b84f8",
"build/assets/ba_data/data/languages/chinese.json": "d03ed49486d41cfbdf770e5a54f974a1", "build/assets/ba_data/data/languages/chinese.json": "57d199cfd2a5cf493e777dd96cc12f7c",
"build/assets/ba_data/data/languages/chinesetraditional.json": "d85c58cc1e0e4bd0b09b2bc768cb1971", "build/assets/ba_data/data/languages/chinesetraditional.json": "d85c58cc1e0e4bd0b09b2bc768cb1971",
"build/assets/ba_data/data/languages/croatian.json": "b23619cb396ac16640c47458f884b16a", "build/assets/ba_data/data/languages/croatian.json": "b23619cb396ac16640c47458f884b16a",
"build/assets/ba_data/data/languages/czech.json": "61bcfce75c0d53d2f2af709cee42187a", "build/assets/ba_data/data/languages/czech.json": "be5d536a1160607dfa158e59ecc1c324",
"build/assets/ba_data/data/languages/danish.json": "8e57db30c5250df2abff14a822f83ea7", "build/assets/ba_data/data/languages/danish.json": "8e57db30c5250df2abff14a822f83ea7",
"build/assets/ba_data/data/languages/dutch.json": "b0900d572c9141897d53d6574c471343", "build/assets/ba_data/data/languages/dutch.json": "b0900d572c9141897d53d6574c471343",
"build/assets/ba_data/data/languages/english.json": "5a73dea22df1117d58a79459def62ff5", "build/assets/ba_data/data/languages/english.json": "5a73dea22df1117d58a79459def62ff5",
@ -443,7 +443,7 @@
"build/assets/ba_data/data/languages/italian.json": "d9eb41f6eafb19040f8d5c0608790b62", "build/assets/ba_data/data/languages/italian.json": "d9eb41f6eafb19040f8d5c0608790b62",
"build/assets/ba_data/data/languages/korean.json": "4e3524327a0174250aff5e1ef4c0c597", "build/assets/ba_data/data/languages/korean.json": "4e3524327a0174250aff5e1ef4c0c597",
"build/assets/ba_data/data/languages/malay.json": "f6ce0426d03a62612e3e436ed5d1be1f", "build/assets/ba_data/data/languages/malay.json": "f6ce0426d03a62612e3e436ed5d1be1f",
"build/assets/ba_data/data/languages/persian.json": "ededb9c015afb58b1324a096ea740f72", "build/assets/ba_data/data/languages/persian.json": "fc25780341e0dfebc393e4c1c846b7a9",
"build/assets/ba_data/data/languages/polish.json": "89333fb207f9eb2f22fff5a95b022c35", "build/assets/ba_data/data/languages/polish.json": "89333fb207f9eb2f22fff5a95b022c35",
"build/assets/ba_data/data/languages/portuguese.json": "eb2563e245e1ea00b870264dced3ebd7", "build/assets/ba_data/data/languages/portuguese.json": "eb2563e245e1ea00b870264dced3ebd7",
"build/assets/ba_data/data/languages/romanian.json": "55a8744e466801013ea131266a856924", "build/assets/ba_data/data/languages/romanian.json": "55a8744e466801013ea131266a856924",
@ -455,7 +455,7 @@
"build/assets/ba_data/data/languages/tamil.json": "ead39b864228696a9b0d19344bc4b5ec", "build/assets/ba_data/data/languages/tamil.json": "ead39b864228696a9b0d19344bc4b5ec",
"build/assets/ba_data/data/languages/thai.json": "1d665629361f302693dead39de8fa945", "build/assets/ba_data/data/languages/thai.json": "1d665629361f302693dead39de8fa945",
"build/assets/ba_data/data/languages/turkish.json": "6153ca5248b8e4743e9501ac72378493", "build/assets/ba_data/data/languages/turkish.json": "6153ca5248b8e4743e9501ac72378493",
"build/assets/ba_data/data/languages/ukrainian.json": "23a98e5722d3e71e809a8a0063daa603", "build/assets/ba_data/data/languages/ukrainian.json": "3a5b8132690fcd583d280879876c85b7",
"build/assets/ba_data/data/languages/venetian.json": "a1315f5233ebbee1464683ac55d5d9d5", "build/assets/ba_data/data/languages/venetian.json": "a1315f5233ebbee1464683ac55d5d9d5",
"build/assets/ba_data/data/languages/vietnamese.json": "5ae84265600b6cfda45c9bed18724e1d", "build/assets/ba_data/data/languages/vietnamese.json": "5ae84265600b6cfda45c9bed18724e1d",
"build/assets/ba_data/data/maps/big_g.json": "1dd301d490643088a435ce75df971054", "build/assets/ba_data/data/maps/big_g.json": "1dd301d490643088a435ce75df971054",
@ -4096,50 +4096,50 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "fad0592c63dbf5623fd085b1f94dc5b5", "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "855a05f0dde692555dcd240456c63397",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "b18b7d1073b180dd2b0ed563e3befda7", "build/prefab/full/linux_arm64_gui/release/ballisticakit": "46b1d1929707bd20d50509c53c406f80",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "2ea095b28288927982060509174ed625", "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "8f0f4ed6508328a4a75c95450ecae525",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "bdd91ad1d25228813e6123adecc16031", "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "14d5f4e4cdaa859100b6e247f713f23b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "354635e2cdb27b523c229ee3c723e136", "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "586cdec51141ee2c2553450b917ccf13",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "6a3ecdf84a34549f451cfa43e87bae28", "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "cb68c967d6cc12fb98865bd391b630c7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "5e01a1b583a53c3d475013363b6e0372", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "8ba734f236f8b3d76a0f3a634d088ef1",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "179905fc0b716c99c57b56179f84166e", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "59a854138d18b814e0913a4608b7fe87",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "be15731bcd223a8723f146d8e3153b53", "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "cfa3a2f7ef36c88736a88c8229a7389d",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "dfc1d123a5517302f5869b151a436a7f", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "27677f0f0d72c4b487070dada1e494dd",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b1ef6725fdcf9071aba0f0f5e038727d", "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "02124d81c73f4212be27028c97bca2b2",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "24ac52a8b44b2b815cce76a150f38629", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "81297de9661e18bf6c67c20927a6d6b8",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "488119eac17785da1bf534702e8ed51f", "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "99e2c966b4855f712fb383a167ae2bb5",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "cb59173e8b176b98206b7f69b9a08972", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "fc534000c33ad4db9cc0d7756e171947",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "60700ee6b7ed262215fca2c02ec5561b", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "753846937971a4353045178dacc9fd76",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "972c6e59e59ca24c7d1739b1d7530a30", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "6ea4ace6e74840ae2534d7df1ebe4b1c",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "b04c87e6dec8916aaf3666fe0aa4d158", "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "c25040a973dbbbe0c51b51934bd13df9",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "04ddbccf8268c1199d196b3dc4559e1b", "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8db99aef1dd403903f6d433314d1ca66",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "02c9824a5e1951e8298c75196ae154e2", "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "af04c5cbfad31760865ae59079ee32a4",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "da0705f8cc9e9eece02592fd1295ea40", "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "ec2bd6cc16ae27771271eb250634d6b1",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "ad908b297b41c2fdf13582e34c434245",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "fa659b5d6119acba6570c92ce4d35ae2", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "086a2ce72497e44079ad6b747fc5439f",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "73ad3303fe1a82005918fbc5dae3446c", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "ad908b297b41c2fdf13582e34c434245",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "fa659b5d6119acba6570c92ce4d35ae2", "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "086a2ce72497e44079ad6b747fc5439f",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "ab8467107ed371eb542e0317a7e7395d", "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "d562f21a435b7a888028689ffdf06d02",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "4a4c19120f810ff5b4c7afbf11c23cf6", "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "226df279a267c72853b7242fd1507dd1",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "ab8467107ed371eb542e0317a7e7395d", "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "d562f21a435b7a888028689ffdf06d02",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "4a4c19120f810ff5b4c7afbf11c23cf6", "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "226df279a267c72853b7242fd1507dd1",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "f4c36e72fa8d9d06f8a00684a3fc4679", "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "5a17ee891f9113060a2f462cd9d04dc7",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "3168e8377498df85a4adacede63d126a", "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "46f23c6890b06fa29f97604b42113c5e",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "f4c36e72fa8d9d06f8a00684a3fc4679", "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "5a17ee891f9113060a2f462cd9d04dc7",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "3168e8377498df85a4adacede63d126a", "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "46f23c6890b06fa29f97604b42113c5e",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "427a392c291aa9562e93c570c9f1b92c", "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "ecb7fec32ddd75652e657c2076ff2b69",
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "3f50101eed1a5178d5630064dbafb3ee", "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "d7a1d4deb51b0792d083737477e6833b",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "78cf6a2069ab46f5f0be3f5b57a6ee70", "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "4c11b81a574aa9af593f54db4d998e61",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "3f50101eed1a5178d5630064dbafb3ee", "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "d7a1d4deb51b0792d083737477e6833b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "4769b8b8a99ef0e08aa968af3072fa38", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "8eea688090f6d2be7b003c1469afc244",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "f999d258cb8c7645c5b462ff81012289", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "9409dfcaf0598768143e06690d33ce65",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "aee027b5a96a835583d07ea95ac6d608", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "a85fb3ac57086dc5f271b3afea90b489",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "3f7d65bf17deb2714862df46c6772e06", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "30b60a444fba031a67c96ed9193050da",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "d332af0eee1178cc7c00b6e3ed5ca8a2", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "b06998159410ed4b02591ca2998b9c38",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "2c8f29b6b26f657c776fee12f81bd28e", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "51553d3162f0af5acfd5e55880e454c9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "26a02edb690a0f9e5baaf0923cc1e57d", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "215dbbb47e8def7b1f63448275b4d33b",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "62d7688c402895869b794541366a3e20", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "52dd9b73e6d72412ca6b273fb342368e",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad", "src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d", "src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -1,9 +1,17 @@
### 1.7.37 (build 22007, api 9, 2024-09-19) ### 1.7.37 (build 22015, api 9, 2024-09-25)
- Bumping api version to 9. As you'll see below, there's some UI changes that - Bumping api version to 9. As you'll see below, there's some UI changes that
will require a bit of work for any UI mods to adapt to. If your mods don't will require a bit of work for any UI mods to adapt to. If your mods don't
touch UI stuff at all you can simply bump your api version and call it a day. touch UI stuff at all you can simply bump your api version and call it a day.
I'm hopeful that api version won't need to be bumped again for along time (if I'm hopeful that api version won't need to be bumped again for along time (if
ever). ever).
- The newest Pylint update (3.3) added a check for
'too-many-positional-arguments'. This seems like a good idea, so I updated
various functions to conform to it and set some others to ignore it. Basically
if you see a function like `def dothing(a, b, *, c, d)` then everything after
the `*` needs to be passed as a keyword. So you can't do `dothing(val1, val2,
val3, val4)`; you need to do `dothing(val1, val2, c=val3, d=val4)`. Requiring
keywords for complex functions generally leads to more readable code and less
breakage if arguments are added or removed from the function.
- Playlist customization no longer requires pro. - Playlist customization no longer requires pro.
- Soundtrack customization no longer requires pro. - Soundtrack customization no longer requires pro.
- Campaign hard mode no longer requires pro. - Campaign hard mode no longer requires pro.
@ -90,6 +98,14 @@
test UIScales are by using the UI panel in the dev-console or by setting the test UIScales are by using the UI panel in the dev-console or by setting the
`BA_UI_SCALE` env var. If we can get UIScale switches to feel seamless enough `BA_UI_SCALE` env var. If we can get UIScale switches to feel seamless enough
at some point, it may be worth adding to display settings. at some point, it may be worth adding to display settings.
- There is now a `ba*.app.classic.save_ui_state()` method that should be called
right before jumping into a game/replay/etc. This will save a state that will
automatically be restored the next time the main menu activity is entered.
- (build 22010) Added the concept of 'auxiliary' windows and used them to make
various window navigation more intuitive. Example: previously, if you were on
the co-op screen and pressed the trophy toolbar icon to see your league rank
and then pressed back, you would be taken back to the top level main menu. Now
it will take you back to the co-op screen.
### 1.7.36 (build 21944, api 8, 2024-07-26) ### 1.7.36 (build 21944, api 8, 2024-07-26)
- Wired up Tokens, BombSquad's new purchasable currency. The first thing these - Wired up Tokens, BombSquad's new purchasable currency. The first thing these

View File

@ -6,7 +6,7 @@ mypy==1.11.2
pbxproj==4.2.1 pbxproj==4.2.1
pdoc==14.7.0 pdoc==14.7.0
pur==7.3.2 pur==7.3.2
pylint==3.2.7 pylint==3.3.1
pylsp-mypy==0.6.9 pylsp-mypy==0.6.9
pytest==8.3.3 pytest==8.3.3
python-daemon==3.0.1 python-daemon==3.0.1

View File

@ -367,7 +367,6 @@
"ba_data/python/bauiv1lib/__pycache__/__init__.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/__init__.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/benchmarks.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc",
@ -380,7 +379,7 @@
"ba_data/python/bauiv1lib/__pycache__/fileselector.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/fileselector.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/helpui.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/help.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc",
@ -421,7 +420,6 @@
"ba_data/python/bauiv1lib/account/viewer.py", "ba_data/python/bauiv1lib/account/viewer.py",
"ba_data/python/bauiv1lib/achievements.py", "ba_data/python/bauiv1lib/achievements.py",
"ba_data/python/bauiv1lib/appinvite.py", "ba_data/python/bauiv1lib/appinvite.py",
"ba_data/python/bauiv1lib/benchmarks.py",
"ba_data/python/bauiv1lib/characterpicker.py", "ba_data/python/bauiv1lib/characterpicker.py",
"ba_data/python/bauiv1lib/colorpicker.py", "ba_data/python/bauiv1lib/colorpicker.py",
"ba_data/python/bauiv1lib/config.py", "ba_data/python/bauiv1lib/config.py",
@ -456,7 +454,7 @@
"ba_data/python/bauiv1lib/gather/publictab.py", "ba_data/python/bauiv1lib/gather/publictab.py",
"ba_data/python/bauiv1lib/getremote.py", "ba_data/python/bauiv1lib/getremote.py",
"ba_data/python/bauiv1lib/gettokens.py", "ba_data/python/bauiv1lib/gettokens.py",
"ba_data/python/bauiv1lib/helpui.py", "ba_data/python/bauiv1lib/help.py",
"ba_data/python/bauiv1lib/iconpicker.py", "ba_data/python/bauiv1lib/iconpicker.py",
"ba_data/python/bauiv1lib/inbox.py", "ba_data/python/bauiv1lib/inbox.py",
"ba_data/python/bauiv1lib/ingamemenu.py", "ba_data/python/bauiv1lib/ingamemenu.py",
@ -516,6 +514,7 @@
"ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/benchmarks.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc",
@ -533,6 +532,7 @@
"ba_data/python/bauiv1lib/settings/advanced.py", "ba_data/python/bauiv1lib/settings/advanced.py",
"ba_data/python/bauiv1lib/settings/allsettings.py", "ba_data/python/bauiv1lib/settings/allsettings.py",
"ba_data/python/bauiv1lib/settings/audio.py", "ba_data/python/bauiv1lib/settings/audio.py",
"ba_data/python/bauiv1lib/settings/benchmarks.py",
"ba_data/python/bauiv1lib/settings/controls.py", "ba_data/python/bauiv1lib/settings/controls.py",
"ba_data/python/bauiv1lib/settings/devtools.py", "ba_data/python/bauiv1lib/settings/devtools.py",
"ba_data/python/bauiv1lib/settings/gamepad.py", "ba_data/python/bauiv1lib/settings/gamepad.py",

View File

@ -341,7 +341,6 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/account/viewer.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/account/viewer.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/achievements.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/achievements.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/appinvite.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/appinvite.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/benchmarks.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/characterpicker.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/characterpicker.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/colorpicker.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/colorpicker.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/config.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/config.py \
@ -365,7 +364,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/gather/publictab.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/gather/publictab.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/getremote.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/getremote.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/gettokens.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/gettokens.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/helpui.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/help.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/iconpicker.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/iconpicker.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/inbox.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/inbox.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/ingamemenu.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/ingamemenu.py \
@ -406,6 +405,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/advanced.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/advanced.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/allsettings.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/allsettings.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/audio.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/audio.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/benchmarks.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/controls.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/controls.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/devtools.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/devtools.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/gamepad.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/gamepad.py \
@ -619,7 +619,6 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/account/__pycache__/viewer.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/account/__pycache__/viewer.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/benchmarks.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc \
@ -643,7 +642,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/gather/__pycache__/publictab.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/gather/__pycache__/publictab.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/helpui.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/help.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc \
@ -684,6 +683,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/benchmarks.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc \

View File

@ -33,6 +33,7 @@ class DevConsoleTab:
pos: tuple[float, float], pos: tuple[float, float],
size: tuple[float, float], size: tuple[float, float],
call: Callable[[], Any] | None = None, call: Callable[[], Any] | None = None,
*,
h_anchor: Literal['left', 'center', 'right'] = 'center', h_anchor: Literal['left', 'center', 'right'] = 'center',
label_scale: float = 1.0, label_scale: float = 1.0,
corner_radius: float = 8.0, corner_radius: float = 8.0,
@ -57,6 +58,7 @@ class DevConsoleTab:
self, self,
text: str, text: str,
pos: tuple[float, float], pos: tuple[float, float],
*,
h_anchor: Literal['left', 'center', 'right'] = 'center', h_anchor: Literal['left', 'center', 'right'] = 'center',
h_align: Literal['left', 'center', 'right'] = 'center', h_align: Literal['left', 'center', 'right'] = 'center',
v_align: Literal['top', 'center', 'bottom', 'none'] = 'center', v_align: Literal['top', 'center', 'bottom', 'none'] = 'center',

View File

@ -657,6 +657,7 @@ class Achievement:
award: int, award: int,
hard_mode_only: bool = False, hard_mode_only: bool = False,
): ):
# pylint: disable=too-many-positional-arguments
self._name = name self._name = name
self._icon_name = icon_name self._icon_name = icon_name
self._icon_color: Sequence[float] = list(icon_color) + [1] self._icon_color: Sequence[float] = list(icon_color) + [1]
@ -870,6 +871,7 @@ class Achievement:
x: float, x: float,
y: float, y: float,
delay: float, delay: float,
*,
outdelay: float | None = None, outdelay: float | None = None,
color: Sequence[float] | None = None, color: Sequence[float] | None = None,
style: str = 'post_game', style: str = 'post_game',

View File

@ -15,14 +15,16 @@ from babase import (
AppIntentDefault, AppIntentDefault,
invoke_main_menu, invoke_main_menu,
screenmessage, screenmessage,
in_main_menu, # in_main_menu,
) )
import _baclassic import _baclassic
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Callable
from babase import AppIntent from babase import AppIntent
from bauiv1 import UIV1AppSubsystem, MainWindow from bauiv1 import UIV1AppSubsystem, MainWindow, MainWindowState
class ClassicAppMode(AppMode): class ClassicAppMode(AppMode):
@ -49,7 +51,6 @@ class ClassicAppMode(AppMode):
@override @override
def on_activate(self) -> None: def on_activate(self) -> None:
print('CLASSIC ACTIVATING')
# Let the native layer do its thing. # Let the native layer do its thing.
_baclassic.classic_app_mode_activate() _baclassic.classic_app_mode_activate()
@ -110,7 +111,11 @@ class ClassicAppMode(AppMode):
@override @override
def on_deactivate(self) -> None: def on_deactivate(self) -> None:
print('CLASSIC DEACTIVATING')
# Save where we were in the UI so we return there next time.
if app.classic is not None:
app.classic.save_ui_state()
# Let the native layer do its thing. # Let the native layer do its thing.
_baclassic.classic_app_mode_deactivate() _baclassic.classic_app_mode_deactivate()
@ -121,38 +126,6 @@ class ClassicAppMode(AppMode):
if not app.active: if not app.active:
invoke_main_menu() invoke_main_menu()
def _jump_to_main_window(self, window: MainWindow) -> None:
"""Jump to a window with the main menu as its parent."""
from bauiv1lib.mainmenu import MainMenuWindow
from bauiv1lib.ingamemenu import InGameMenuWindow
ui = app.ui_v1
old_window = ui.get_main_window()
if isinstance(old_window, (MainMenuWindow, InGameMenuWindow)):
# If we're currently in the top level menu window, just push
# our mainwindow on to the end.
old_window.main_window_replace(window)
else:
# Blow away the window stack and build a fresh one.
ui.clear_main_window()
back_state = (
MainMenuWindow.do_get_main_window_state()
if in_main_menu()
else InGameMenuWindow.do_get_main_window_state()
)
# set_main_window() needs this to be set.
back_state.is_top_level = True
ui.set_main_window(
window,
from_window=False, # Disable from-check.
back_state=back_state,
suppress_warning=True,
)
def _root_ui_menu_press(self) -> None: def _root_ui_menu_press(self) -> None:
from babase import push_back_press from babase import push_back_press
@ -170,18 +143,11 @@ class ClassicAppMode(AppMode):
import bauiv1 import bauiv1
from bauiv1lib.account.settings import AccountSettingsWindow from bauiv1lib.account.settings import AccountSettingsWindow
ui = app.ui_v1 self._auxiliary_window_nav(
win_type=AccountSettingsWindow,
# If the window is already showing, back out of it. win_create_call=lambda: AccountSettingsWindow(
current_main_window = ui.get_main_window()
if isinstance(current_main_window, AccountSettingsWindow):
current_main_window.main_window_back()
return
self._jump_to_main_window(
AccountSettingsWindow(
origin_widget=bauiv1.get_special_widget('account_button') origin_widget=bauiv1.get_special_widget('account_button')
) ),
) )
def _root_ui_squad_press(self) -> None: def _root_ui_squad_press(self) -> None:
@ -198,52 +164,133 @@ class ClassicAppMode(AppMode):
import bauiv1 import bauiv1
from bauiv1lib.settings.allsettings import AllSettingsWindow from bauiv1lib.settings.allsettings import AllSettingsWindow
self._auxiliary_window_nav(
win_type=AllSettingsWindow,
win_create_call=lambda: AllSettingsWindow(
origin_widget=bauiv1.get_special_widget('settings_button')
),
)
def _auxiliary_window_nav(
self,
win_type: type[MainWindow],
win_create_call: Callable[[], MainWindow],
) -> None:
"""Navigate to or away from a particular type of Auxiliary window."""
# pylint: disable=unidiomatic-typecheck
ui = app.ui_v1 ui = app.ui_v1
# If the window is already showing, back out of it.
current_main_window = ui.get_main_window() current_main_window = ui.get_main_window()
if isinstance(current_main_window, AllSettingsWindow):
# Scan our ancestors for auxiliary states matching our type as
# well as auxiliary states in general.
aux_matching_state: MainWindowState | None = None
aux_state: MainWindowState | None = None
if current_main_window is None:
raise RuntimeError(
'Not currently handling no-top-level-window case.'
)
state = current_main_window.main_window_back_state
while state is not None:
assert state.window_type is not None
if state.is_auxiliary:
if state.window_type is win_type:
aux_matching_state = state
else:
aux_state = state
state = state.parent
# If there's an ancestor auxiliary window-state matching our
# type, back out past it (example: poking settings, navigating
# down a level or two, and then poking settings again should
# back out of settings).
if aux_matching_state is not None:
current_main_window.main_window_back_state = (
aux_matching_state.parent
)
current_main_window.main_window_back() current_main_window.main_window_back()
return return
self._jump_to_main_window( # If there's an ancestory auxiliary state *not* matching our
AllSettingsWindow( # type, crop the state and swap in our new auxiliary UI
origin_widget=bauiv1.get_special_widget('settings_button') # (example: poking settings, then poking account, then poking
# back should end up where things were before the settings
# poke).
if aux_state is not None:
# Blow away the window stack and build a fresh one.
ui.clear_main_window()
ui.set_main_window(
win_create_call(),
from_window=False, # Disable from-check.
back_state=aux_state.parent,
suppress_warning=True,
is_auxiliary=True,
) )
return
# Ok, no auxiliary states found. Now if current window is auxiliary
# and the type matches, simply do a back.
if (
current_main_window.main_window_is_auxiliary
and type(current_main_window) is win_type
):
current_main_window.main_window_back()
return
# If current window is auxiliary but type doesn't match,
# swap it out for our new auxiliary UI.
if current_main_window.main_window_is_auxiliary:
ui.clear_main_window()
ui.set_main_window(
win_create_call(),
from_window=False, # Disable from-check.
back_state=current_main_window.main_window_back_state,
suppress_warning=True,
is_auxiliary=True,
)
return
# Ok, no existing auxiliary stuff was found period. Just
# navigate forward to this UI.
current_main_window.main_window_replace(
win_create_call(), is_auxiliary=True
) )
def _root_ui_achievements_press(self) -> None: def _root_ui_achievements_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.achievements import AchievementsWindow from bauiv1lib.achievements import AchievementsWindow
btn = bauiv1.get_special_widget('achievements_button') self._auxiliary_window_nav(
win_type=AchievementsWindow,
AchievementsWindow(position=btn.get_screen_space_center()) win_create_call=lambda: AchievementsWindow(
origin_widget=bauiv1.get_special_widget('achievements_button')
),
)
def _root_ui_inbox_press(self) -> None: def _root_ui_inbox_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.inbox import InboxWindow from bauiv1lib.inbox import InboxWindow
btn = bauiv1.get_special_widget('inbox_button') self._auxiliary_window_nav(
win_type=InboxWindow,
InboxWindow(position=btn.get_screen_space_center()) win_create_call=lambda: InboxWindow(
origin_widget=bauiv1.get_special_widget('inbox_button')
),
)
def _root_ui_store_press(self) -> None: def _root_ui_store_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.store.browser import StoreBrowserWindow from bauiv1lib.store.browser import StoreBrowserWindow
ui = app.ui_v1 self._auxiliary_window_nav(
win_type=StoreBrowserWindow,
# If the window is already showing, back out of it. win_create_call=lambda: StoreBrowserWindow(
current_main_window = ui.get_main_window()
if isinstance(current_main_window, StoreBrowserWindow):
current_main_window.main_window_back()
return
self._jump_to_main_window(
StoreBrowserWindow(
origin_widget=bauiv1.get_special_widget('store_button') origin_widget=bauiv1.get_special_widget('store_button')
) ),
) )
def _root_ui_tickets_meter_press(self) -> None: def _root_ui_tickets_meter_press(self) -> None:
@ -267,25 +314,17 @@ class ClassicAppMode(AppMode):
from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.account import show_sign_in_prompt
from bauiv1lib.league.rankwindow import LeagueRankWindow from bauiv1lib.league.rankwindow import LeagueRankWindow
ui = app.ui_v1
# If the window is already showing, back out of it.
current_main_window = ui.get_main_window()
if isinstance(current_main_window, LeagueRankWindow):
current_main_window.main_window_back()
return
plus = bauiv1.app.plus plus = bauiv1.app.plus
assert plus is not None assert plus is not None
if plus.get_v1_account_state() != 'signed_in': if plus.get_v1_account_state() != 'signed_in':
show_sign_in_prompt() show_sign_in_prompt()
return return
self._jump_to_main_window( self._auxiliary_window_nav(
LeagueRankWindow( win_type=LeagueRankWindow,
win_create_call=lambda: LeagueRankWindow(
origin_widget=bauiv1.get_special_widget('trophy_meter') origin_widget=bauiv1.get_special_widget('trophy_meter')
) ),
) )
def _root_ui_level_meter_press(self) -> None: def _root_ui_level_meter_press(self) -> None:
@ -300,26 +339,22 @@ class ClassicAppMode(AppMode):
import bauiv1 import bauiv1
from bauiv1lib.inventory import InventoryWindow from bauiv1lib.inventory import InventoryWindow
ui = app.ui_v1 self._auxiliary_window_nav(
win_type=InventoryWindow,
# If the window is already showing, back out of it. win_create_call=lambda: InventoryWindow(
current_main_window = ui.get_main_window()
if isinstance(current_main_window, InventoryWindow):
current_main_window.main_window_back()
return
self._jump_to_main_window(
InventoryWindow(
origin_widget=bauiv1.get_special_widget('inventory_button') origin_widget=bauiv1.get_special_widget('inventory_button')
) ),
) )
def _root_ui_get_tokens_press(self) -> None: def _root_ui_get_tokens_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.gettokens import GetTokensWindow from bauiv1lib.gettokens import GetTokensWindow
GetTokensWindow( self._auxiliary_window_nav(
origin_widget=bauiv1.get_special_widget('get_tokens_button') win_type=GetTokensWindow,
win_create_call=lambda: GetTokensWindow(
origin_widget=bauiv1.get_special_widget('get_tokens_button')
),
) )
def _root_ui_chest_slot_pressed(self, index: int) -> None: def _root_ui_chest_slot_pressed(self, index: int) -> None:

View File

@ -112,6 +112,7 @@ class ClassicAppSubsystem(babase.AppSubsystem):
self.invite_confirm_windows: list[Any] = [] # FIXME: Don't use Any. self.invite_confirm_windows: list[Any] = [] # FIXME: Don't use Any.
self.party_window: weakref.ref[PartyWindow] | None = None self.party_window: weakref.ref[PartyWindow] | None = None
self.main_menu_resume_callbacks: list = [] self.main_menu_resume_callbacks: list = []
self.saved_ui_state: bauiv1.MainWindowState | None = None
# Store. # Store.
self.store_layout: dict[str, list[dict[str, Any]]] | None = None self.store_layout: dict[str, list[dict[str, Any]]] | None = None
@ -327,6 +328,9 @@ class ClassicAppSubsystem(babase.AppSubsystem):
) )
return False return False
# Save where we are in the UI to come back to when done.
babase.app.classic.save_ui_state()
# Ok, we're good to go. # Ok, we're good to go.
self.coop_session_args = { self.coop_session_args = {
'campaign': campaignname, 'campaign': campaignname,
@ -523,26 +527,21 @@ class ClassicAppSubsystem(babase.AppSubsystem):
tip = self.tips.pop() tip = self.tips.pop()
return tip return tip
def run_gpu_benchmark(self) -> None:
"""Kick off a benchmark to test gpu speeds."""
from baclassic._benchmark import run_gpu_benchmark as run
run()
def run_cpu_benchmark(self) -> None: def run_cpu_benchmark(self) -> None:
"""Kick off a benchmark to test cpu speeds.""" """Kick off a benchmark to test cpu speeds."""
from baclassic._benchmark import run_cpu_benchmark as run from baclassic._benchmark import run_cpu_benchmark
run() run_cpu_benchmark()
def run_media_reload_benchmark(self) -> None: def run_media_reload_benchmark(self) -> None:
"""Kick off a benchmark to test media reloading speeds.""" """Kick off a benchmark to test media reloading speeds."""
from baclassic._benchmark import run_media_reload_benchmark as run from baclassic._benchmark import run_media_reload_benchmark
run() run_media_reload_benchmark()
def run_stress_test( def run_stress_test(
self, self,
*,
playlist_type: str = 'Random', playlist_type: str = 'Random',
playlist_name: str = '__default__', playlist_name: str = '__default__',
player_count: int = 8, player_count: int = 8,
@ -550,9 +549,9 @@ class ClassicAppSubsystem(babase.AppSubsystem):
attract_mode: bool = False, attract_mode: bool = False,
) -> None: ) -> None:
"""Run a stress test.""" """Run a stress test."""
from baclassic._benchmark import run_stress_test as run from baclassic._benchmark import run_stress_test
run( run_stress_test(
playlist_type=playlist_type, playlist_type=playlist_type,
playlist_name=playlist_name, playlist_name=playlist_name,
player_count=player_count, player_count=player_count,
@ -694,6 +693,7 @@ class ClassicAppSubsystem(babase.AppSubsystem):
def tournament_entry_window( def tournament_entry_window(
self, self,
tournament_id: str, tournament_id: str,
*,
tournament_activity: bascenev1.Activity | None = None, tournament_activity: bascenev1.Activity | None = None,
position: tuple[float, float] = (0.0, 0.0), position: tuple[float, float] = (0.0, 0.0),
delegate: Any = None, delegate: Any = None,
@ -817,11 +817,20 @@ class ClassicAppSubsystem(babase.AppSubsystem):
InGameMenuWindow(), is_top_level=True, suppress_warning=True InGameMenuWindow(), is_top_level=True, suppress_warning=True
) )
def save_ui_state(self) -> None:
"""Store our current place in the UI."""
ui = babase.app.ui_v1
mainwindow = ui.get_main_window()
if mainwindow is not None:
self.saved_ui_state = ui.save_main_window_state(mainwindow)
else:
self.saved_ui_state = None
def invoke_main_menu_ui(self) -> None: def invoke_main_menu_ui(self) -> None:
"""Bring up main menu ui.""" """Bring up main menu ui."""
print('INVOKING MAIN MENU UI')
# Bring up the last place we were, or start at the main menu otherwise. # Bring up the last place we were, or start at the main menu
# otherwise.
app = bauiv1.app app = bauiv1.app
env = app.env env = app.env
with bascenev1.ContextRef.empty(): with bascenev1.ContextRef.empty():
@ -842,72 +851,16 @@ class ClassicAppSubsystem(babase.AppSubsystem):
app.ui_v1.set_main_window( app.ui_v1.set_main_window(
KioskWindow(), is_top_level=True, suppress_warning=True KioskWindow(), is_top_level=True, suppress_warning=True
) )
# ..or in normal cases go back to the main menu
else: else:
# if main_menu_location == 'Gather': # If there's a saved ui state, restore that.
# # pylint: disable=cyclic-import if self.saved_ui_state is not None:
# from bauiv1lib.gather import GatherWindow app.ui_v1.restore_main_window_state(self.saved_ui_state)
else:
# Otherwise start fresh at the main menu.
from bauiv1lib.mainmenu import MainMenuWindow
# app.ui_v1.set_main_window( app.ui_v1.set_main_window(
# GatherWindow(transition=None), MainMenuWindow(transition=None),
# from_window=False, # Disable check here. is_top_level=True,
# ) suppress_warning=True,
# elif main_menu_location == 'Watch': )
# # pylint: disable=cyclic-import
# from bauiv1lib.watch import WatchWindow
# app.ui_v1.set_main_window(
# WatchWindow(transition=None),
# from_window=False, # Disable check here.
# )
# elif main_menu_location == 'Team Game Select':
# # pylint: disable=cyclic-import
# from bauiv1lib.playlist.browser import (
# PlaylistBrowserWindow,
# )
# app.ui_v1.set_main_window(
# PlaylistBrowserWindow(
# sessiontype=bascenev1.DualTeamSession,
# transition=None,
# ),
# from_window=False, # Disable check here.
# )
# elif main_menu_location == 'Free-for-All Game Select':
# # pylint: disable=cyclic-import
# from bauiv1lib.playlist.browser import (
# PlaylistBrowserWindow,
# )
# app.ui_v1.set_main_window(
# PlaylistBrowserWindow(
# sessiontype=bascenev1.FreeForAllSession,
# transition=None,
# ),
# from_window=False, # Disable check here.
# )
# elif main_menu_location == 'Coop Select':
# # pylint: disable=cyclic-import
# from bauiv1lib.coop.browser import CoopBrowserWindow
# app.ui_v1.set_main_window(
# CoopBrowserWindow(transition=None),
# from_window=False, # Disable check here.
# )
# elif main_menu_location == 'Benchmarks & Stress Tests':
# # pylint: disable=cyclic-import
# from bauiv1lib.debug import DebugWindow
# app.ui_v1.set_main_window(
# DebugWindow(transition=None),
# from_window=False, # Disable check here.
# )
# else:
# pylint: disable=cyclic-import
from bauiv1lib.mainmenu import MainMenuWindow
app.ui_v1.set_main_window(
MainMenuWindow(transition=None),
is_top_level=True,
suppress_warning=True,
)

View File

@ -20,11 +20,14 @@ def run_cpu_benchmark() -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bascenev1lib import tutorial from bascenev1lib import tutorial
# Save our UI state that we'll return to when done.
if babase.app.classic is not None:
babase.app.classic.save_ui_state()
class BenchmarkSession(bascenev1.Session): class BenchmarkSession(bascenev1.Session):
"""Session type for cpu benchmark.""" """Session type for cpu benchmark."""
def __init__(self) -> None: def __init__(self) -> None:
# print('FIXME: BENCHMARK SESSION WOULD CALC DEPS.')
depsets: Sequence[bascenev1.DependencySet] = [] depsets: Sequence[bascenev1.DependencySet] = []
super().__init__(depsets) super().__init__(depsets)
@ -99,7 +102,9 @@ def _start_stress_test(args: _StressTestArgs) -> None:
"""(internal)""" """(internal)"""
from bascenev1 import DualTeamSession, FreeForAllSession from bascenev1 import DualTeamSession, FreeForAllSession
assert babase.app.classic is not None classic = babase.app.classic
assert classic is not None
appconfig = babase.app.config appconfig = babase.app.config
playlist_type = args.playlist_type playlist_type = args.playlist_type
@ -116,6 +121,10 @@ def _start_stress_test(args: _StressTestArgs) -> None:
+ args.playlist_name + args.playlist_name
+ '")...' + '")...'
) )
# Save where we are in the UI so we'll return there when done.
classic.save_ui_state()
if playlist_type == 'Teams': if playlist_type == 'Teams':
appconfig['Team Tournament Playlist Selection'] = args.playlist_name appconfig['Team Tournament Playlist Selection'] = args.playlist_name
appconfig['Team Tournament Playlist Randomize'] = 1 appconfig['Team Tournament Playlist Randomize'] = 1
@ -137,11 +146,11 @@ def _start_stress_test(args: _StressTestArgs) -> None:
), ),
) )
_baclassic.set_stress_testing(True, args.player_count, args.attract_mode) _baclassic.set_stress_testing(True, args.player_count, args.attract_mode)
babase.app.classic.stress_test_update_timer = babase.AppTimer( classic.stress_test_update_timer = babase.AppTimer(
args.round_duration, babase.Call(_reset_stress_test, args) args.round_duration, babase.Call(_reset_stress_test, args)
) )
if args.attract_mode: if args.attract_mode:
babase.app.classic.stress_test_update_timer_2 = babase.AppTimer( classic.stress_test_update_timer_2 = babase.AppTimer(
0.48, babase.Call(_update_attract_mode_test, args), repeat=True 0.48, babase.Call(_update_attract_mode_test, args), repeat=True
) )
@ -170,12 +179,6 @@ def _reset_stress_test(args: _StressTestArgs) -> None:
babase.apptimer(1.0, babase.Call(_start_stress_test, args)) babase.apptimer(1.0, babase.Call(_start_stress_test, args))
def run_gpu_benchmark() -> None:
"""Kick off a benchmark to test gpu speeds."""
# FIXME: Not wired up yet.
babase.screenmessage('Not wired up yet.', color=(1, 0, 0))
def run_media_reload_benchmark() -> None: def run_media_reload_benchmark() -> None:
"""Kick off a benchmark to test media reloading speeds.""" """Kick off a benchmark to test media reloading speeds."""
babase.reload_media() babase.reload_media()
@ -199,6 +202,6 @@ def run_media_reload_benchmark() -> None:
babase.add_clean_frame_callback(babase.Call(doit, start_time)) babase.add_clean_frame_callback(babase.Call(doit, start_time))
# The reload starts (should add a completion callback to the # The reload starts (should add a completion callback to the reload
# reload func to fix this). # func to fix this).
babase.apptimer(0.05, babase.Call(delay_add, babase.apptime())) babase.apptimer(0.05, babase.Call(delay_add, babase.apptime()))

View File

@ -35,6 +35,8 @@ class MasterServerV1CallThread(threading.Thread):
callback: MasterServerCallback | None, callback: MasterServerCallback | None,
response_type: MasterServerResponseType, response_type: MasterServerResponseType,
): ):
# pylint: disable=too-many-positional-arguments
# Set daemon=True so long-running requests don't keep us from # Set daemon=True so long-running requests don't keep us from
# quitting the app. # quitting the app.
super().__init__(daemon=True) super().__init__(daemon=True)
@ -52,8 +54,9 @@ class MasterServerV1CallThread(threading.Thread):
self._activity = weakref.ref(activity) if activity is not None else None self._activity = weakref.ref(activity) if activity is not None else None
def _run_callback(self, arg: None | dict[str, Any]) -> None: def _run_callback(self, arg: None | dict[str, Any]) -> None:
# If we were created in an activity context and that activity has # If we were created in an activity context and that activity
# since died, do nothing. # has since died, do nothing.
# FIXME: Should we just be using a ContextCall instead of doing # FIXME: Should we just be using a ContextCall instead of doing
# this check manually? # this check manually?
if self._activity is not None: if self._activity is not None:

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be # Build number and version of the ballistica binary we expect to be
# using. # using.
TARGET_BALLISTICA_BUILD = 22007 TARGET_BALLISTICA_BUILD = 22015
TARGET_BALLISTICA_VERSION = '1.7.37' TARGET_BALLISTICA_VERSION = '1.7.37'
@ -156,6 +156,7 @@ def get_config() -> EnvConfig:
def configure( def configure(
*,
config_dir: str | None = None, config_dir: str | None = None,
data_dir: str | None = None, data_dir: str | None = None,
user_python_dir: str | None = None, user_python_dir: str | None = None,

View File

@ -221,6 +221,7 @@ class PlusAppSubsystem(AppSubsystem):
name: Any, name: Any,
score: int | None, score: int | None,
callback: Callable, callback: Callable,
*,
order: str = 'increasing', order: str = 'increasing',
tournament_id: str | None = None, tournament_id: str | None = None,
score_type: str = 'points', score_type: str = 'points',

View File

@ -1247,6 +1247,7 @@ class GameActivity(Activity[PlayerT, TeamT]):
def show_zoom_message( def show_zoom_message(
self, self,
message: babase.Lstr, message: babase.Lstr,
*,
color: Sequence[float] = (0.9, 0.4, 0.0), color: Sequence[float] = (0.9, 0.4, 0.0),
scale: float = 0.8, scale: float = 0.8,
duration: float = 2.0, duration: float = 2.0,

View File

@ -112,6 +112,7 @@ def animate_array(
attr: str, attr: str,
size: int, size: int,
keys: dict[float, Sequence[float]], keys: dict[float, Sequence[float]],
*,
loop: bool = False, loop: bool = False,
offset: float = 0, offset: float = 0,
) -> None: ) -> None:

View File

@ -27,6 +27,7 @@ class Level:
gametype: type[bascenev1.GameActivity], gametype: type[bascenev1.GameActivity],
settings: dict, settings: dict,
preview_texture_name: str, preview_texture_name: str,
*,
displayname: str | None = None, displayname: str | None = None,
): ):
self._name = name self._name = name

View File

@ -241,6 +241,7 @@ class HitMessage:
def __init__( def __init__(
self, self,
*,
srcnode: bascenev1.Node | None = None, srcnode: bascenev1.Node | None = None,
pos: Sequence[float] | None = None, pos: Sequence[float] | None = None,
velocity: Sequence[float] | None = None, velocity: Sequence[float] | None = None,

View File

@ -21,6 +21,7 @@ PlaylistType = list[dict[str, Any]]
def filter_playlist( def filter_playlist(
playlist: PlaylistType, playlist: PlaylistType,
sessiontype: type[Session], sessiontype: type[Session],
*,
add_resolved_type: bool = False, add_resolved_type: bool = False,
remove_unowned: bool = True, remove_unowned: bool = True,
mark_unowned: bool = False, mark_unowned: bool = False,

View File

@ -96,6 +96,7 @@ class Session:
def __init__( def __init__(
self, self,
depsets: Sequence[bascenev1.DependencySet], depsets: Sequence[bascenev1.DependencySet],
*,
team_names: Sequence[str] | None = None, team_names: Sequence[str] | None = None,
team_colors: Sequence[Sequence[float]] | None = None, team_colors: Sequence[Sequence[float]] | None = None,
min_players: int = 1, min_players: int = 1,

View File

@ -196,6 +196,7 @@ class PlayerRecord:
scale2: float, scale2: float,
sound2: bascenev1.Sound | None, sound2: bascenev1.Sound | None,
) -> None: ) -> None:
# pylint: disable=too-many-positional-arguments
from bascenev1lib.actor.popuptext import PopupText from bascenev1lib.actor.popuptext import PopupText
# Only award this if they're still alive and we can get # Only award this if they're still alive and we can get
@ -341,6 +342,7 @@ class Stats:
self, self,
player: bascenev1.Player, player: bascenev1.Player,
base_points: int = 1, base_points: int = 1,
*,
target: Sequence[float] | None = None, target: Sequence[float] | None = None,
kill: bool = False, kill: bool = False,
victim_player: bascenev1.Player | None = None, victim_player: bascenev1.Player | None = None,

View File

@ -145,6 +145,7 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
kill_delay: float, kill_delay: float,
shiftdelay: float, shiftdelay: float,
) -> None: ) -> None:
# pylint: disable=too-many-positional-arguments
del kill_delay # Unused arg. del kill_delay # Unused arg.
ZoomText( ZoomText(
str(sessionteam.customdata['score']), str(sessionteam.customdata['score']),

View File

@ -87,6 +87,7 @@ class FreeForAllVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
extrascale: float, extrascale: float,
flash: bool = False, flash: bool = False,
) -> Text: ) -> Text:
# pylint: disable=too-many-positional-arguments
return Text( return Text(
text, text,
position=( position=(

View File

@ -57,6 +57,7 @@ class MultiTeamScoreScreenActivity(bs.ScoreScreenActivity):
def show_player_scores( def show_player_scores(
self, self,
*,
delay: float = 2.5, delay: float = 2.5,
results: bs.GameResults | None = None, results: bs.GameResults | None = None,
scale: float = 1.0, scale: float = 1.0,
@ -134,6 +135,7 @@ class MultiTeamScoreScreenActivity(bs.ScoreScreenActivity):
xoffs: float, xoffs: float,
yoffs: float, yoffs: float,
text: bs.Lstr, text: bs.Lstr,
*,
h_align: Text.HAlign = Text.HAlign.RIGHT, h_align: Text.HAlign = Text.HAlign.RIGHT,
extrascale: float = 1.0, extrascale: float = 1.0,
maxwidth: float | None = 120.0, maxwidth: float | None = 120.0,

View File

@ -333,6 +333,7 @@ class Blast(bs.Actor):
def __init__( def __init__(
self, self,
*,
position: Sequence[float] = (0.0, 1.0, 0.0), position: Sequence[float] = (0.0, 1.0, 0.0),
velocity: Sequence[float] = (0.0, 0.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0),
blast_radius: float = 2.0, blast_radius: float = 2.0,
@ -715,6 +716,7 @@ class Bomb(bs.Actor):
def __init__( def __init__(
self, self,
*,
position: Sequence[float] = (0.0, 1.0, 0.0), position: Sequence[float] = (0.0, 1.0, 0.0),
velocity: Sequence[float] = (0.0, 0.0, 0.0), velocity: Sequence[float] = (0.0, 0.0, 0.0),
bomb_type: str = 'normal', bomb_type: str = 'normal',

View File

@ -24,6 +24,7 @@ class ControlsGuide(bs.Actor):
def __init__( def __init__(
self, self,
*,
position: tuple[float, float] = (390.0, 120.0), position: tuple[float, float] = (390.0, 120.0),
scale: float = 1.0, scale: float = 1.0,
delay: float = 0.0, delay: float = 0.0,

View File

@ -169,6 +169,7 @@ class Flag(bs.Actor):
def __init__( def __init__(
self, self,
*,
position: Sequence[float] = (0.0, 1.0, 0.0), position: Sequence[float] = (0.0, 1.0, 0.0),
color: Sequence[float] = (1.0, 1.0, 1.0), color: Sequence[float] = (1.0, 1.0, 1.0),
materials: Sequence[bs.Material] | None = None, materials: Sequence[bs.Material] | None = None,

View File

@ -37,6 +37,7 @@ class Image(bs.Actor):
def __init__( def __init__(
self, self,
texture: bs.Texture | dict[str, Any], texture: bs.Texture | dict[str, Any],
*,
position: tuple[float, float] = (0, 0), position: tuple[float, float] = (0, 0),
transition: Transition | None = None, transition: Transition | None = None,
transition_delay: float = 0.0, transition_delay: float = 0.0,

View File

@ -46,6 +46,7 @@ class PlayerSpaz(Spaz):
def __init__( def __init__(
self, self,
player: bs.Player, player: bs.Player,
*,
color: Sequence[float] = (1.0, 1.0, 1.0), color: Sequence[float] = (1.0, 1.0, 1.0),
highlight: Sequence[float] = (0.5, 0.5, 0.5), highlight: Sequence[float] = (0.5, 0.5, 0.5),
character: str = 'Spaz', character: str = 'Spaz',
@ -102,6 +103,7 @@ class PlayerSpaz(Spaz):
def connect_controls_to_player( def connect_controls_to_player(
self, self,
*,
enable_jump: bool = True, enable_jump: bool = True,
enable_punch: bool = True, enable_punch: bool = True,
enable_pickup: bool = True, enable_pickup: bool = True,

View File

@ -22,6 +22,7 @@ class PopupText(bs.Actor):
def __init__( def __init__(
self, self,
text: str | bs.Lstr, text: str | bs.Lstr,
*,
position: Sequence[float] = (0.0, 0.0, 0.0), position: Sequence[float] = (0.0, 0.0, 0.0),
color: Sequence[float] = (1.0, 1.0, 1.0, 1.0), color: Sequence[float] = (1.0, 1.0, 1.0, 1.0),
random_offset: float = 0.5, random_offset: float = 0.5,

View File

@ -24,6 +24,7 @@ class _Entry:
flash_length: float, flash_length: float,
): ):
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-positional-arguments
self._scoreboard = weakref.ref(scoreboard) self._scoreboard = weakref.ref(scoreboard)
self._do_cover = do_cover self._do_cover = do_cover
self._scale = scale self._scale = scale
@ -277,6 +278,7 @@ class _Entry:
def set_value( def set_value(
self, self,
score: float, score: float,
*,
max_score: float | None = None, max_score: float | None = None,
countdown: bool = False, countdown: bool = False,
flash: bool = True, flash: bool = True,
@ -399,6 +401,7 @@ class Scoreboard:
team: bs.Team, team: bs.Team,
score: float, score: float,
max_score: float | None = None, max_score: float | None = None,
*,
countdown: bool = False, countdown: bool = False,
flash: bool = True, flash: bool = True,
show_value: bool = True, show_value: bool = True,

View File

@ -50,6 +50,7 @@ class Spawner:
def __init__( def __init__(
self, self,
*,
data: Any = None, data: Any = None,
pt: Sequence[float] = (0, 0, 0), pt: Sequence[float] = (0, 0, 0),
spawn_time: float = 1.0, spawn_time: float = 1.0,

View File

@ -71,6 +71,7 @@ class Spaz(bs.Actor):
def __init__( def __init__(
self, self,
*,
color: Sequence[float] = (1.0, 1.0, 1.0), color: Sequence[float] = (1.0, 1.0, 1.0),
highlight: Sequence[float] = (0.5, 0.5, 0.5), highlight: Sequence[float] = (0.5, 0.5, 0.5),
character: str = 'Spaz', character: str = 'Spaz',

View File

@ -947,9 +947,9 @@ class SpazBotSet:
on_spawn_call: Callable[[SpazBot], Any] | None = None, on_spawn_call: Callable[[SpazBot], Any] | None = None,
) -> None: ) -> None:
"""Spawn a bot from this set.""" """Spawn a bot from this set."""
from bascenev1lib.actor import spawner from bascenev1lib.actor.spawner import Spawner
spawner.Spawner( Spawner(
pt=pos, pt=pos,
spawn_time=spawn_time, spawn_time=spawn_time,
send_spawn_message=False, send_spawn_message=False,

View File

@ -56,6 +56,7 @@ class Text(bs.Actor):
def __init__( def __init__(
self, self,
text: str | bs.Lstr, text: str | bs.Lstr,
*,
position: tuple[float, float] = (0.0, 0.0), position: tuple[float, float] = (0.0, 0.0),
h_align: HAlign = HAlign.LEFT, h_align: HAlign = HAlign.LEFT,
v_align: VAlign = VAlign.NONE, v_align: VAlign = VAlign.NONE,

View File

@ -26,6 +26,7 @@ class ZoomText(bs.Actor):
self, self,
text: str | bs.Lstr, text: str | bs.Lstr,
position: tuple[float, float] = (0.0, 0.0), position: tuple[float, float] = (0.0, 0.0),
*,
shiftposition: tuple[float, float] | None = None, shiftposition: tuple[float, float] | None = None,
shiftdelay: float | None = None, shiftdelay: float | None = None,
lifespan: float | None = None, lifespan: float | None = None,

View File

@ -73,6 +73,7 @@ class Team(bs.Team[Player]):
def __init__( def __init__(
self, self,
*,
base_pos: Sequence[float], base_pos: Sequence[float],
base_region_material: bs.Material, base_region_material: bs.Material,
base_region: bs.Node, base_region: bs.Node,

View File

@ -27,6 +27,7 @@ class Icon(bs.Actor):
player: Player, player: Player,
position: tuple[float, float], position: tuple[float, float],
scale: float, scale: float,
*,
show_lives: bool = True, show_lives: bool = True,
show_death: bool = True, show_death: bool = True,
name_scale: float = 1.0, name_scale: float = 1.0,

View File

@ -805,6 +805,7 @@ class OnslaughtGame(bs.CoopGameActivity[Player, Team]):
max_level: int, max_level: int,
) -> list[list[tuple[int, int]]]: ) -> list[list[tuple[int, int]]]:
"""Calculate a distribution of bad guys given some params.""" """Calculate a distribution of bad guys given some params."""
# pylint: disable=too-many-positional-arguments
max_iterations = 10 + max_dudes * 2 max_iterations = 10 + max_dudes * 2
groups: list[list[tuple[int, int]]] = [] groups: list[list[tuple[int, int]]] = []

View File

@ -57,8 +57,8 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
plus = bs.app.plus plus = bs.app.plus
assert plus is not None assert plus is not None
# Throw up some text that only clients can see so they know that the # Throw up some text that only clients can see so they know that
# host is navigating menus while they're just staring at an # the host is navigating menus while they're just staring at an
# empty-ish screen. # empty-ish screen.
tval = bs.Lstr( tval = bs.Lstr(
resource='hostIsNavigatingMenusText', resource='hostIsNavigatingMenusText',
@ -433,6 +433,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
word: str, word: str,
x: float, x: float,
y: float, y: float,
*,
scale: float = 1.0, scale: float = 1.0,
delay: float = 0.0, delay: float = 0.0,
vr_depth_offset: float = 0.0, vr_depth_offset: float = 0.0,
@ -561,13 +562,13 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
y: float, y: float,
scale: float, scale: float,
delay: float, delay: float,
*,
custom_texture: str | None = None, custom_texture: str | None = None,
jitter_scale: float = 1.0, jitter_scale: float = 1.0,
rotate: float = 0.0, rotate: float = 0.0,
vr_depth_offset: float = 0.0, vr_depth_offset: float = 0.0,
) -> None: ) -> None:
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# Temp easter goodness.
if custom_texture is None: if custom_texture is None:
custom_texture = self._get_custom_logo_tex_name() custom_texture = self._get_custom_logo_tex_name()
self._custom_logo_tex_name = custom_texture self._custom_logo_tex_name = custom_texture
@ -602,9 +603,8 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
self._logo_node = logo.node self._logo_node = logo.node
self._word_actors.append(logo) self._word_actors.append(logo)
# Add a bit of stop-motion-y jitter to the logo # Add a bit of stop-motion-y jitter to the logo (unless we're in
# (unless we're in VR mode in which case its best to # VR mode in which case its best to leave things still).
# leave things still).
assert logo.node assert logo.node
def jitter() -> None: def jitter() -> None:

View File

@ -515,6 +515,7 @@ class TutorialActivity(bs.Activity[Player, Team]):
self, self,
num: int, num: int,
position: Sequence[float], position: Sequence[float],
*,
color: Sequence[float] = (1.0, 1.0, 1.0), color: Sequence[float] = (1.0, 1.0, 1.0),
make_current: bool = False, make_current: bool = False,
relative_to: int | None = None, relative_to: int | None = None,
@ -577,6 +578,7 @@ class TutorialActivity(bs.Activity[Player, Team]):
self, self,
num: int, num: int,
position: Sequence[float], position: Sequence[float],
*,
color: Sequence[float] = (1.0, 1.0, 1.0), color: Sequence[float] = (1.0, 1.0, 1.0),
make_current: bool = False, make_current: bool = False,
relative_to: int | None = None, relative_to: int | None = None,

View File

@ -181,8 +181,10 @@ class UIV1AppSubsystem(babase.AppSubsystem):
f' cannot use auto-back.' f' cannot use auto-back.'
) )
# Valid states should have a value here. # Valid states should have values here.
assert back_state.is_top_level is not None assert back_state.is_top_level is not None
assert back_state.is_auxiliary is not None
assert back_state.window_type is not None
backwin = back_state.create_window(transition='in_left') backwin = back_state.create_window(transition='in_left')
@ -201,9 +203,11 @@ class UIV1AppSubsystem(babase.AppSubsystem):
def set_main_window( def set_main_window(
self, self,
window: bauiv1.MainWindow, window: bauiv1.MainWindow,
*,
from_window: bauiv1.MainWindow | None | bool = True, from_window: bauiv1.MainWindow | None | bool = True,
is_back: bool = False, is_back: bool = False,
is_top_level: bool = False, is_top_level: bool = False,
is_auxiliary: bool = False,
back_state: MainWindowState | None = None, back_state: MainWindowState | None = None,
suppress_warning: bool = False, suppress_warning: bool = False,
) -> None: ) -> None:
@ -213,6 +217,7 @@ class UIV1AppSubsystem(babase.AppSubsystem):
MainWindow methods main_window_replace() and main_window_back() MainWindow methods main_window_replace() and main_window_back()
should be used when possible for navigation. should be used when possible for navigation.
""" """
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
from bauiv1._uitypes import MainWindow from bauiv1._uitypes import MainWindow
@ -253,9 +258,13 @@ class UIV1AppSubsystem(babase.AppSubsystem):
# If they passed a back-state, make sure it is fully filled out. # If they passed a back-state, make sure it is fully filled out.
if back_state is not None: if back_state is not None:
if back_state.is_top_level is None: if (
back_state.is_top_level is None
or back_state.is_auxiliary is None
or back_state.window_type is None
):
raise RuntimeError( raise RuntimeError(
'back_state.is_top_level has not been set.' 'Provided back_state is incomplete.'
' Make sure to only pass fully-filled-out MainWindowStates.' ' Make sure to only pass fully-filled-out MainWindowStates.'
) )
# If a top-level main-window is being set, complain if there already # If a top-level main-window is being set, complain if there already
@ -308,18 +317,24 @@ class UIV1AppSubsystem(babase.AppSubsystem):
logging.exception('Error checking from_window') logging.exception('Error checking from_window')
if is_back: if is_back:
# is_top_level should never be True here (only applies forward). # These values should only be passed for forward navigation.
assert not is_top_level assert not is_top_level
# Always should have back_state in this case. assert not is_auxiliary
# Make sure back state is complete.
assert back_state is not None assert back_state is not None
assert back_state.is_top_level is not None assert back_state.is_top_level is not None
assert back_state.is_auxiliary is not None
assert back_state.window_type is type(window)
window.main_window_back_state = back_state.parent window.main_window_back_state = back_state.parent
window.main_window_is_top_level = back_state.is_top_level window.main_window_is_top_level = back_state.is_top_level
window.main_window_is_auxiliary = back_state.is_auxiliary
else: else:
# Store if the window is top-level so we won't complain later if # Store if the window is top-level so we won't complain later if
# we go back from it and there's nowhere to go to. # we go back from it and there's nowhere to go to.
window.main_window_is_top_level = is_top_level window.main_window_is_top_level = is_top_level
window.main_window_is_auxiliary = is_auxiliary
# When navigating forward, generate a back-window-state from # When navigating forward, generate a back-window-state from
# the outgoing window. # the outgoing window.
if is_top_level: if is_top_level:
@ -385,6 +400,8 @@ class UIV1AppSubsystem(babase.AppSubsystem):
# Store some common window stuff on its state. # Store some common window stuff on its state.
winstate.parent = window.main_window_back_state winstate.parent = window.main_window_back_state
winstate.is_top_level = window.main_window_is_top_level winstate.is_top_level = window.main_window_is_top_level
winstate.is_auxiliary = window.main_window_is_auxiliary
winstate.window_type = type(window)
return winstate return winstate
@ -396,12 +413,15 @@ class UIV1AppSubsystem(babase.AppSubsystem):
# Valid states should have a value here. # Valid states should have a value here.
assert state.is_top_level is not None assert state.is_top_level is not None
assert state.is_auxiliary is not None
assert state.window_type is not None
win = state.create_window(transition=None) win = state.create_window(transition=None)
self.set_main_window( self.set_main_window(
win, win,
from_window=False, # disable check from_window=False, # disable check
is_top_level=state.is_top_level, is_top_level=state.is_top_level,
is_auxiliary=state.is_auxiliary,
back_state=state.parent, back_state=state.parent,
suppress_warning=True, suppress_warning=True,
) )

View File

@ -65,6 +65,13 @@ class MainWindow(Window):
self.main_window_is_top_level: bool = False self.main_window_is_top_level: bool = False
# Windows can be flagged as auxiliary when not related to the
# main UI task at hand. UI code may choose to handle auxiliary
# windows in special ways, such as by implicitly replacing
# existing auxiliary windows with new ones instead of keeping
# old ones as back targets.
self.main_window_is_auxiliary: bool = False
self._main_window_transition = transition self._main_window_transition = transition
self._main_window_origin_widget = origin_widget self._main_window_origin_widget = origin_widget
super().__init__(root_widget, cleanupcheck) super().__init__(root_widget, cleanupcheck)
@ -147,7 +154,10 @@ class MainWindow(Window):
self.main_window_close() self.main_window_close()
def main_window_replace( def main_window_replace(
self, new_window: MainWindow, back_state: MainWindowState | None = None self,
new_window: MainWindow,
back_state: MainWindowState | None = None,
is_auxiliary: bool = False,
) -> None: ) -> None:
"""Replace ourself with a new MainWindow.""" """Replace ourself with a new MainWindow."""
@ -177,6 +187,7 @@ class MainWindow(Window):
new_window, new_window,
from_window=self, from_window=self,
back_state=back_state, back_state=back_state,
is_auxiliary=is_auxiliary,
suppress_warning=True, suppress_warning=True,
) )
@ -203,6 +214,8 @@ class MainWindowState:
# The window that back/cancel navigation should take us to. # The window that back/cancel navigation should take us to.
self.parent: MainWindowState | None = None self.parent: MainWindowState | None = None
self.is_top_level: bool | None = None self.is_top_level: bool | None = None
self.is_auxiliary: bool | None = None
self.window_type: type[MainWindow] | None = None
def create_window( def create_window(
self, self,
@ -314,10 +327,10 @@ def ui_upkeep() -> None:
print( print(
'WARNING:', 'WARNING:',
obj, obj,
'is still alive 5 second after its widget died;' 'is still alive 5 second after its Widget died;'
' you might have a memory leak. Look for circular' ' you might have a memory leak. Look for circular'
' references or outside things referencing your window' ' references or outside things referencing your Window'
' instance. See efro.debug module' ' class instance. See efro.debug module'
' for tools that can help debug this sort of thing.', ' for tools that can help debug this sort of thing.',
) )
else: else:

View File

@ -334,20 +334,6 @@ class AccountSettingsWindow(bui.MainWindow):
) )
linked_accounts_text_space = 60.0 linked_accounts_text_space = 60.0
# Always show achievements except in the game-center case where
# its unified UI covers them.
# show_achievements_button =
# self._v1_signed_in and not game_center_active
# Update: No longer showing this since its visible on main
# toolbar.
show_achievements_button = False
achievements_button_space = 60.0
# show_achievements_text = (
# self._v1_signed_in and not show_achievements_button
# )
# Update: No longer showing this since its visible on main # Update: No longer showing this since its visible on main
# toolbar. # toolbar.
show_achievements_text = False show_achievements_text = False
@ -422,8 +408,6 @@ class AccountSettingsWindow(bui.MainWindow):
self._sub_height += linked_accounts_text_space self._sub_height += linked_accounts_text_space
if show_achievements_text: if show_achievements_text:
self._sub_height += achievements_text_space self._sub_height += achievements_text_space
if show_achievements_button:
self._sub_height += achievements_button_space
if show_leaderboards_button: if show_leaderboards_button:
self._sub_height += leaderboards_button_space self._sub_height += leaderboards_button_space
if show_campaign_progress: if show_campaign_progress:
@ -876,43 +860,7 @@ class AccountSettingsWindow(bui.MainWindow):
else: else:
self._achievements_text = None self._achievements_text = None
self._achievements_button: bui.Widget | None if show_achievements_text:
if show_achievements_button:
button_width = 300
v -= achievements_button_space * 0.85
self._achievements_button = btn = bui.buttonwidget(
parent=self._subcontainer,
position=((self._sub_width - button_width) * 0.5, v),
color=(0.55, 0.5, 0.6),
textcolor=(0.75, 0.7, 0.8),
autoselect=True,
icon=bui.gettexture(
'googlePlayAchievementsIcon'
if gpgs_active
else 'achievementsIcon'
),
icon_color=(
(0.8, 0.95, 0.7) if gpgs_active else (0.85, 0.8, 0.9)
),
on_activate_call=(
self._on_custom_achievements_press
if gpgs_active
else self._on_achievements_press
),
size=(button_width, 50),
label='',
)
if first_selectable is None:
first_selectable = btn
bui.widget(
edit=btn, right_widget=bui.get_special_widget('squad_button')
)
bui.widget(edit=btn, left_widget=bbtn)
v -= achievements_button_space * 0.15
else:
self._achievements_button = None
if show_achievements_text or show_achievements_button:
self._refresh_achievements() self._refresh_achievements()
self._leaderboards_button: bui.Widget | None self._leaderboards_button: bui.Widget | None
@ -1212,15 +1160,6 @@ class AccountSettingsWindow(bui.MainWindow):
else: else:
logging.warning('show_game_service_ui requires plus feature-set.') logging.warning('show_game_service_ui requires plus feature-set.')
def _on_achievements_press(self) -> None:
# pylint: disable=cyclic-import
from bauiv1lib import achievements
assert self._achievements_button is not None
achievements.AchievementsWindow(
position=self._achievements_button.get_screen_space_center()
)
def _on_manage_account_press(self) -> None: def _on_manage_account_press(self) -> None:
self._do_manage_account_press(WebLocation.ACCOUNT_EDITOR) self._do_manage_account_press(WebLocation.ACCOUNT_EDITOR)
@ -1401,10 +1340,7 @@ class AccountSettingsWindow(bui.MainWindow):
def _refresh_achievements(self) -> None: def _refresh_achievements(self) -> None:
assert bui.app.classic is not None assert bui.app.classic is not None
if ( if self._achievements_text is None:
self._achievements_text is None
and self._achievements_button is None
):
return return
complete = sum( complete = sum(
1 if a.complete else 0 for a in bui.app.classic.ach.achievements 1 if a.complete else 0 for a in bui.app.classic.ach.achievements
@ -1417,8 +1353,6 @@ class AccountSettingsWindow(bui.MainWindow):
if self._achievements_text is not None: if self._achievements_text is not None:
bui.textwidget(edit=self._achievements_text, text=txt_final) bui.textwidget(edit=self._achievements_text, text=txt_final)
if self._achievements_button is not None:
bui.buttonwidget(edit=self._achievements_button, label=txt_final)
def _link_accounts_press(self) -> None: def _link_accounts_press(self) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import

View File

@ -23,6 +23,7 @@ class AccountViewerWindow(PopupWindow):
def __init__( def __init__(
self, self,
account_id: str, account_id: str,
*,
profile_id: str | None = None, profile_id: str | None = None,
position: tuple[float, float] = (0.0, 0.0), position: tuple[float, float] = (0.0, 0.0),
scale: float | None = None, scale: float | None = None,

View File

@ -6,55 +6,70 @@ from __future__ import annotations
from typing import override from typing import override
from bauiv1lib.popup import PopupWindow
import bauiv1 as bui import bauiv1 as bui
class AchievementsWindow(PopupWindow): class AchievementsWindow(bui.MainWindow):
"""Popup window to view achievements.""" """Popup window to view achievements."""
def __init__( def __init__(
self, position: tuple[float, float], scale: float | None = None self,
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
): ):
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
if scale is None: self._width = 600 if uiscale is bui.UIScale.SMALL else 450
scale = (
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
)
self._transitioning_out = False
self._width = 450
self._height = ( self._height = (
300 380
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 370 if uiscale is bui.UIScale.MEDIUM else 450 else 370 if uiscale is bui.UIScale.MEDIUM else 450
) )
bg_color = (0.5, 0.4, 0.6) yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
# creates our _root_widget
super().__init__( super().__init__(
position=position, root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
scale=scale, toolbar_visibility=(
bg_color=bg_color, 'menu_minimal'
edge_buffer_scale=4.0, # Try to keep button unobscured. if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
scale=(
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
),
stack_offset=(
(0, 0)
if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
),
),
transition=transition,
origin_widget=origin_widget,
) )
self._cancel_button = bui.buttonwidget( if uiscale is bui.UIScale.SMALL:
parent=self.root_widget, bui.containerwidget(
position=(50, self._height - 30), edit=self._root_widget, on_cancel_call=self.main_window_back
size=(50, 50), )
scale=0.5, self._back_button = None
label='', else:
color=bg_color, self._back_button = bui.buttonwidget(
on_activate_call=self._on_cancel_press, parent=self._root_widget,
autoselect=True, autoselect=True,
icon=bui.gettexture('crossOut'), position=(50, self._height - 38 + yoffs),
iconscale=1.2, size=(60, 60),
) scale=0.6,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
on_activate_call=self.main_window_back,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._back_button
)
achievements = bui.app.classic.ach.achievements achievements = bui.app.classic.ach.achievements
num_complete = len([a for a in achievements if a.complete]) num_complete = len([a for a in achievements if a.complete])
@ -67,8 +82,13 @@ class AchievementsWindow(PopupWindow):
], ],
) )
self._title_text = bui.textwidget( self._title_text = bui.textwidget(
parent=self.root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 20), position=(
self._width * 0.5,
self._height
- (27 if uiscale is bui.UIScale.SMALL else 20)
+ yoffs,
),
size=(0, 0), size=(0, 0),
h_align='center', h_align='center',
v_align='center', v_align='center',
@ -79,16 +99,27 @@ class AchievementsWindow(PopupWindow):
) )
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self.root_widget, parent=self._root_widget,
size=(self._width - 60, self._height - 70), size=(
position=(30, 30), self._width - 60,
self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
),
position=(
30,
(110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
),
capture_arrows=True, capture_arrows=True,
simple_culling_v=10, simple_culling_v=10,
) )
bui.widget(edit=self._scrollwidget, autoselect=True) bui.widget(edit=self._scrollwidget, autoselect=True)
if uiscale is bui.UIScale.SMALL:
bui.widget(
edit=self._scrollwidget,
left_widget=bui.get_special_widget('back_button'),
)
bui.containerwidget( bui.containerwidget(
edit=self.root_widget, cancel_button=self._cancel_button edit=self._root_widget, cancel_button=self._back_button
) )
incr = 36 incr = 36
@ -224,15 +255,12 @@ class AchievementsWindow(PopupWindow):
v_align='center', v_align='center',
) )
def _on_cancel_press(self) -> None:
self._transition_out()
def _transition_out(self) -> None:
if not self._transitioning_out:
self._transitioning_out = True
bui.containerwidget(edit=self.root_widget, transition='out_scale')
@override @override
def on_popup_cancel(self) -> None: def get_main_window_state(self) -> bui.MainWindowState:
bui.getsound('swish').play() # Support recreating our window for back/refresh purposes.
self._transition_out() cls = type(self)
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition, origin_widget=origin_widget
)
)

View File

@ -41,6 +41,7 @@ class CharacterPicker(PopupWindow):
selected_character: str | None = None, selected_character: str | None = None,
): ):
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-positional-arguments
from bascenev1lib.actor import spazappearance from bascenev1lib.actor import spazappearance
assert bui.app.classic is not None assert bui.app.classic is not None
@ -194,8 +195,6 @@ class CharacterPicker(PopupWindow):
def _on_store_press(self) -> None: def _on_store_press(self) -> None:
from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.account import show_sign_in_prompt
# from bauiv1lib.store.browser import StoreBrowserWindow
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
@ -208,15 +207,6 @@ class CharacterPicker(PopupWindow):
self._transition_out() self._transition_out()
# bui.screenmessage('UNDER CONSTRUCTION')
# return
# StoreBrowserWindow(
# modal=True,
# show_tab=StoreBrowserWindow.TabID.CHARACTERS,
# origin_widget=self._get_more_characters_button,
# )
def _select_character(self, character: str) -> None: def _select_character(self, character: str) -> None:
if self._delegate is not None: if self._delegate is not None:
self._delegate.on_character_picker_pick(character) self._delegate.on_character_picker_pick(character)

View File

@ -25,6 +25,7 @@ class ColorPicker(PopupWindow):
self, self,
parent: bui.Widget, parent: bui.Widget,
position: tuple[float, float], position: tuple[float, float],
*,
initial_color: Sequence[float] = (1.0, 1.0, 1.0), initial_color: Sequence[float] = (1.0, 1.0, 1.0),
delegate: Any = None, delegate: Any = None,
scale: float | None = None, scale: float | None = None,
@ -184,6 +185,7 @@ class ColorPickerExact(PopupWindow):
self, self,
parent: bui.Widget, parent: bui.Widget,
position: tuple[float, float], position: tuple[float, float],
*,
initial_color: Sequence[float] = (1.0, 1.0, 1.0), initial_color: Sequence[float] = (1.0, 1.0, 1.0),
delegate: Any = None, delegate: Any = None,
scale: float | None = None, scale: float | None = None,

View File

@ -28,6 +28,7 @@ class ConfigCheckBox:
configkey: str, configkey: str,
position: tuple[float, float], position: tuple[float, float],
size: tuple[float, float], size: tuple[float, float],
*,
displayname: str | bui.Lstr | None = None, displayname: str | bui.Lstr | None = None,
scale: float | None = None, scale: float | None = None,
maxwidth: float | None = None, maxwidth: float | None = None,
@ -85,6 +86,7 @@ class ConfigNumberEdit:
parent: bui.Widget, parent: bui.Widget,
configkey: str, configkey: str,
position: tuple[float, float], position: tuple[float, float],
*,
minval: float = 0.0, minval: float = 0.0,
maxval: float = 100.0, maxval: float = 100.0,
increment: float = 1.0, increment: float = 1.0,

View File

@ -22,6 +22,7 @@ class ConfirmWindow:
action: Callable[[], Any] | None = None, action: Callable[[], Any] | None = None,
width: float = 360.0, width: float = 360.0,
height: float = 100.0, height: float = 100.0,
*,
cancel_button: bool = True, cancel_button: bool = True,
cancel_is_selected: bool = False, cancel_is_selected: bool = False,
color: tuple[float, float, float] = (1, 1, 1), color: tuple[float, float, float] = (1, 1, 1),

View File

@ -47,7 +47,7 @@ class CoopBrowserWindow(bui.MainWindow):
# Quick note to players that tourneys won't work in ballistica # Quick note to players that tourneys won't work in ballistica
# core builds. (need to split the word so it won't get subbed # core builds. (need to split the word so it won't get subbed
# out) # out)
if 'ballistica' + 'kit' == bui.appname(): if 'ballistica' + 'kit' == bui.appname() and bui.do_once():
bui.apptimer( bui.apptimer(
1.0, 1.0,
lambda: bui.screenmessage( lambda: bui.screenmessage(
@ -77,12 +77,12 @@ class CoopBrowserWindow(bui.MainWindow):
self._width = 1520 if uiscale is bui.UIScale.SMALL else 1120 self._width = 1520 if uiscale is bui.UIScale.SMALL else 1120
self._x_inset = x_inset = 200 if uiscale is bui.UIScale.SMALL else 0 self._x_inset = x_inset = 200 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
565 600
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 730 if uiscale is bui.UIScale.MEDIUM else 800 else 730 if uiscale is bui.UIScale.MEDIUM else 800
) )
self._r = 'coopSelectWindow' self._r = 'coopSelectWindow'
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 top_extra = 0 if uiscale is bui.UIScale.SMALL else 0
self._tourney_data_up_to_date = False self._tourney_data_up_to_date = False
@ -109,7 +109,7 @@ class CoopBrowserWindow(bui.MainWindow):
size=(self._width, self._height + top_extra), size=(self._width, self._height + top_extra),
toolbar_visibility='menu_full', toolbar_visibility='menu_full',
stack_offset=( stack_offset=(
(0, -17) (0, -8)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -256,7 +256,7 @@ class CoopBrowserWindow(bui.MainWindow):
self._scroll_width = self._width - (130 + 2 * x_inset) self._scroll_width = self._width - (130 + 2 * x_inset)
self._scroll_height = self._height - ( self._scroll_height = self._height - (
185 if uiscale is bui.UIScale.SMALL else 160 219 if uiscale is bui.UIScale.SMALL else 160
) )
self._subcontainerwidth = 800.0 self._subcontainerwidth = 800.0

View File

@ -26,6 +26,7 @@ class GameButton:
select: bool, select: bool,
row: str, row: str,
): ):
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-locals # pylint: disable=too-many-locals

View File

@ -24,6 +24,7 @@ class TournamentButton:
select: bool, select: bool,
on_pressed: Callable[[TournamentButton], None], on_pressed: Callable[[TournamentButton], None],
) -> None: ) -> None:
# pylint: disable=too-many-positional-arguments
self._r = 'coopSelectWindow' self._r = 'coopSelectWindow'
sclx = 300 sclx = 300
scly = 195.0 scly = 195.0

View File

@ -32,7 +32,7 @@ class CreditsWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 990 if uiscale is bui.UIScale.SMALL else 670 width = 990 if uiscale is bui.UIScale.SMALL else 670
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
height = 398 if uiscale is bui.UIScale.SMALL else 500 height = 450 if uiscale is bui.UIScale.SMALL else 500
self._r = 'creditsWindow' self._r = 'creditsWindow'
super().__init__( super().__init__(
@ -86,7 +86,7 @@ class CreditsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - (65 if uiscale is bui.UIScale.SMALL else 54)), position=(0, height - (93 if uiscale is bui.UIScale.SMALL else 54)),
size=(width, 30), size=(width, 30),
scale=0.8 if uiscale is bui.UIScale.SMALL else 1.0, scale=0.8 if uiscale is bui.UIScale.SMALL else 1.0,
text=bui.Lstr( text=bui.Lstr(
@ -101,8 +101,11 @@ class CreditsWindow(bui.MainWindow):
scroll = bui.scrollwidget( scroll = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(40 + x_inset, 35), position=(40 + x_inset, 62 if uiscale is bui.UIScale.SMALL else 35),
size=(width - (80 + 2 * x_inset), height - 100), size=(
width - (80 + 2 * x_inset),
height - (160 if uiscale is bui.UIScale.SMALL else 100),
),
capture_arrows=True, capture_arrows=True,
) )

View File

@ -23,6 +23,7 @@ class FileSelectorWindow(bui.MainWindow):
self, self,
path: str, path: str,
callback: Callable[[str | None], Any] | None = None, callback: Callable[[str | None], Any] | None = None,
*,
show_base_path: bool = True, show_base_path: bool = True,
valid_file_extensions: Sequence[str] | None = None, valid_file_extensions: Sequence[str] | None = None,
allow_folders: bool = False, allow_folders: bool = False,

View File

@ -44,6 +44,7 @@ class GatherTab:
The tab should create and return a container widget covering the The tab should create and return a container widget covering the
specified region. specified region.
""" """
# pylint: disable=too-many-positional-arguments
raise RuntimeError('Should not get here.') raise RuntimeError('Should not get here.')
def on_deactivate(self) -> None: def on_deactivate(self) -> None:
@ -89,8 +90,9 @@ class GatherWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 1640 if uiscale is bui.UIScale.SMALL else 1040 self._width = 1640 if uiscale is bui.UIScale.SMALL else 1040
x_offs = 200 if uiscale is bui.UIScale.SMALL else 0 x_offs = 200 if uiscale is bui.UIScale.SMALL else 0
y_offs = -65 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
550 650
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 680 if uiscale is bui.UIScale.MEDIUM else 800 else 680 if uiscale is bui.UIScale.MEDIUM else 800
) )
@ -112,7 +114,7 @@ class GatherWindow(bui.MainWindow):
else 0.95 if uiscale is bui.UIScale.MEDIUM else 0.7 else 0.95 if uiscale is bui.UIScale.MEDIUM else 0.7
), ),
stack_offset=( stack_offset=(
(0, -20) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -129,7 +131,7 @@ class GatherWindow(bui.MainWindow):
else: else:
self._back_button = btn = bui.buttonwidget( self._back_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(70 + x_offs, self._height - 74), position=(70 + x_offs, self._height - 74 + y_offs),
size=(140, 60), size=(140, 60),
scale=1.1, scale=1.1,
autoselect=True, autoselect=True,
@ -152,7 +154,7 @@ class GatherWindow(bui.MainWindow):
) )
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 42 + t_offs_y), position=(self._width * 0.5, self._height - 42 + t_offs_y + y_offs),
size=(0, 0), size=(0, 0),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
scale=( scale=(
@ -196,7 +198,10 @@ class GatherWindow(bui.MainWindow):
self._tab_row = TabRow( self._tab_row = TabRow(
self._root_widget, self._root_widget,
tabdefs, tabdefs,
pos=(tab_buffer_h * 0.5, self._height - 130 + tabs_top_extra), pos=(
tab_buffer_h * 0.5,
self._height - 130 + tabs_top_extra + y_offs,
),
size=(self._width - tab_buffer_h, 50), size=(self._width - tab_buffer_h, 50),
on_select_call=bui.WeakCall(self._set_tab), on_select_call=bui.WeakCall(self._set_tab),
) )
@ -226,11 +231,20 @@ class GatherWindow(bui.MainWindow):
) )
self._scroll_width = self._width - scroll_buffer_h self._scroll_width = self._width - scroll_buffer_h
self._scroll_height = self._height - 180.0 + tabs_top_extra self._scroll_height = (
self._height
- (270.0 if uiscale is bui.UIScale.SMALL else 180.0)
+ tabs_top_extra
)
self._scroll_left = (self._width - self._scroll_width) * 0.5 self._scroll_left = (self._width - self._scroll_width) * 0.5
self._scroll_bottom = ( self._scroll_bottom = (
self._height - self._scroll_height - 79 - 48 + tabs_top_extra self._height
- self._scroll_height
- 79
- 48
+ tabs_top_extra
+ y_offs
) )
buffer_h = 10 buffer_h = 10
buffer_v = 4 buffer_v = 4

View File

@ -27,6 +27,7 @@ class AboutGatherTab(GatherTab):
region_bottom: float, region_bottom: float,
) -> bui.Widget: ) -> bui.Widget:
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-positional-arguments
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None

View File

@ -114,6 +114,7 @@ class ManualGatherTab(GatherTab):
region_left: float, region_left: float,
region_bottom: float, region_bottom: float,
) -> bui.Widget: ) -> bui.Widget:
# pylint: disable=too-many-positional-arguments
c_width = region_width c_width = region_width
c_height = region_height - 20 c_height = region_height - 20
@ -870,6 +871,11 @@ class ManualGatherTab(GatherTab):
config['Last Manual Party Connect Address'] = resolved_address config['Last Manual Party Connect Address'] = resolved_address
config['Last Manual Party Connect Port'] = port config['Last Manual Party Connect Port'] = port
config.commit() config.commit()
# Store UI location to return to when done.
if bs.app.classic is not None:
bs.app.classic.save_ui_state()
bs.connect_to_party(resolved_address, port=port) bs.connect_to_party(resolved_address, port=port)
def _run_addr_fetch(self) -> None: def _run_addr_fetch(self) -> None:

View File

@ -53,6 +53,11 @@ class NetScanner:
self._last_selected_host = host self._last_selected_host = host
def _on_activate(self, host: dict[str, Any]) -> None: def _on_activate(self, host: dict[str, Any]) -> None:
# Store UI location to return to when done.
if bs.app.classic is not None:
bs.app.classic.save_ui_state()
bs.connect_to_party(host['address']) bs.connect_to_party(host['address'])
def update(self) -> None: def update(self) -> None:
@ -115,6 +120,7 @@ class NearbyGatherTab(GatherTab):
region_left: float, region_left: float,
region_bottom: float, region_bottom: float,
) -> bui.Widget: ) -> bui.Widget:
# pylint: disable=too-many-positional-arguments
c_width = region_width c_width = region_width
c_height = region_height - 20 c_height = region_height - 20
sub_scroll_height = c_height - 85 sub_scroll_height = c_height - 85

View File

@ -24,7 +24,7 @@ from bacommon.net import (
from bauiv1lib.gather import GatherTab from bauiv1lib.gather import GatherTab
from bauiv1lib.play import PlaylistSelectContext from bauiv1lib.play import PlaylistSelectContext
from bauiv1lib.gettokens import GetTokensWindow, show_get_tokens_prompt from bauiv1lib.gettokens import show_get_tokens_prompt
import bascenev1 as bs import bascenev1 as bs
import bauiv1 as bui import bauiv1 as bui
@ -99,6 +99,7 @@ class PrivateGatherTab(GatherTab):
region_left: float, region_left: float,
region_bottom: float, region_bottom: float,
) -> bui.Widget: ) -> bui.Widget:
# pylint: disable=too-many-positional-arguments
self._c_width = region_width self._c_width = region_width
self._c_height = region_height - 20 self._c_height = region_height - 20
self._container = bui.containerwidget( self._container = bui.containerwidget(
@ -550,13 +551,13 @@ class PrivateGatherTab(GatherTab):
edit=self._join_party_code_text, on_return_press_call=btn.activate edit=self._join_party_code_text, on_return_press_call=btn.activate
) )
def _on_get_tokens_press(self) -> None: # def _on_get_tokens_press(self) -> None:
if self._waiting_for_start_stop_response: # if self._waiting_for_start_stop_response:
return # return
# Bring up get-tickets window and then kill ourself (we're on # # Bring up get-tickets window and then kill ourself (we're on
# the overlay layer so we'd show up above it). # # the overlay layer so we'd show up above it).
GetTokensWindow(origin_widget=self._get_tokens_button) # GetTokensWindow(origin_widget=self._get_tokens_button)
def _build_host_tab(self) -> None: def _build_host_tab(self) -> None:
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
@ -1080,6 +1081,11 @@ class PrivateGatherTab(GatherTab):
return return
self._debug_server_comm('got valid connect response') self._debug_server_comm('got valid connect response')
assert cresult.address4 is not None and cresult.port is not None assert cresult.address4 is not None and cresult.port is not None
# Store UI location to return to when done.
if bs.app.classic is not None:
bs.app.classic.save_ui_state()
bs.connect_to_party(cresult.address4, port=cresult.port) bs.connect_to_party(cresult.address4, port=cresult.port)
except Exception: except Exception:
self._debug_server_comm('got connect response error') self._debug_server_comm('got connect response error')

View File

@ -96,6 +96,7 @@ class UIRow:
) -> None: ) -> None:
"""Update for the given data.""" """Update for the given data."""
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-positional-arguments
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
@ -404,6 +405,7 @@ class PublicGatherTab(GatherTab):
region_left: float, region_left: float,
region_bottom: float, region_bottom: float,
) -> bui.Widget: ) -> bui.Widget:
# pylint: disable=too-many-positional-arguments
c_width = region_width c_width = region_width
c_height = region_height - 20 c_height = region_height - 20
self._container = bui.containerwidget( self._container = bui.containerwidget(
@ -1448,6 +1450,10 @@ class PublicGatherTab(GatherTab):
address = party.address address = party.address
port = party.port port = party.port
# Store UI location to return to when done.
if bs.app.classic is not None:
bs.app.classic.save_ui_state()
# Rate limit this a bit. # Rate limit this a bit.
now = time.time() now = time.time()
last_connect_time = self._last_connect_attempt_time last_connect_time = self._last_connect_attempt_time

View File

@ -8,7 +8,7 @@ import time
from enum import Enum from enum import Enum
from functools import partial from functools import partial
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, assert_never from typing import TYPE_CHECKING, assert_never, override
import bacommon.cloud import bacommon.cloud
import bauiv1 as bui import bauiv1 as bui
@ -54,7 +54,7 @@ class _TxtDef:
rotate: float | None = None rotate: float | None = None
class GetTokensWindow(bui.Window): class GetTokensWindow(bui.MainWindow):
"""Window for purchasing/acquiring classic tickets.""" """Window for purchasing/acquiring classic tickets."""
class State(Enum): class State(Enum):
@ -67,12 +67,10 @@ class GetTokensWindow(bui.Window):
def __init__( def __init__(
self, self,
transition: str = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
restore_previous_call: Callable[[bui.Widget], None] | None = None, # restore_previous_call: Callable[[bui.Widget], None] | None = None,
): ):
# pylint: disable=too-many-locals
bwidthstd = 170 bwidthstd = 170
bwidthwide = 300 bwidthwide = 300
ycolor = (0, 0, 0.3) ycolor = (0, 0, 0.3)
@ -304,7 +302,7 @@ class GetTokensWindow(bui.Window):
] ]
self._transitioning_out = False self._transitioning_out = False
self._restore_previous_call = restore_previous_call # self._restore_previous_call = restore_previous_call
self._textcolor = (0.92, 0.92, 2.0) self._textcolor = (0.92, 0.92, 2.0)
self._query_in_flight = False self._query_in_flight = False
@ -314,14 +312,14 @@ class GetTokensWindow(bui.Window):
) )
# If they provided an origin-widget, scale up from that. # If they provided an origin-widget, scale up from that.
scale_origin: tuple[float, float] | None # scale_origin: tuple[float, float] | None
if origin_widget is not None: # if origin_widget is not None:
self._transition_out = 'out_scale' # self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center() # scale_origin = origin_widget.get_screen_space_center()
transition = 'in_scale' # transition = 'in_scale'
else: # else:
self._transition_out = 'out_right' # self._transition_out = 'out_right'
scale_origin = None # scale_origin = None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 1000.0 if uiscale is bui.UIScale.SMALL else 800.0 self._width = 1000.0 if uiscale is bui.UIScale.SMALL else 800.0
@ -334,8 +332,8 @@ class GetTokensWindow(bui.Window):
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
transition=transition, # transition=transition,
scale_origin_stack_offset=scale_origin, # scale_origin_stack_offset=scale_origin,
color=(0.3, 0.23, 0.36), color=(0.3, 0.23, 0.36),
scale=( scale=(
1.5 1.5
@ -346,13 +344,19 @@ class GetTokensWindow(bui.Window):
(0, -3) if uiscale is bui.UIScale.SMALL else (0, 0) (0, -3) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
# toolbar_visibility='menu_minimal', # toolbar_visibility='menu_minimal',
toolbar_visibility='get_tokens', toolbar_visibility=(
) 'get_tokens'
if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
),
transition=transition,
origin_widget=origin_widget,
) )
if uiscale is bui.UIScale.SMALL: if uiscale is bui.UIScale.SMALL:
bui.containerwidget( bui.containerwidget(
edit=self._root_widget, on_cancel_call=self._back edit=self._root_widget, on_cancel_call=self.main_window_back
) )
self._back_button = bui.get_special_widget('back_button') self._back_button = bui.get_special_widget('back_button')
else: else:
@ -363,23 +367,26 @@ class GetTokensWindow(bui.Window):
self._height - 80 + self._y_offset, self._height - 80 + self._y_offset,
), ),
size=( size=(
(140, 60) # (140, 60)
if self._restore_previous_call is None # if self._restore_previous_call is None
else (60, 60) # else
(60, 60)
), ),
scale=1.0, scale=1.0,
autoselect=True, autoselect=True,
label=( label=(
bui.Lstr(resource='doneText') # bui.Lstr(resource='doneText')
if self._restore_previous_call is None # if self._restore_previous_call is None
else bui.charstr(bui.SpecialChar.BACK) # else
bui.charstr(bui.SpecialChar.BACK)
), ),
button_type=( button_type=(
'regular' # 'regular'
if self._restore_previous_call is None # if self._restore_previous_call is None
else 'backSmall' # else
'backSmall'
), ),
on_activate_call=self._back, on_activate_call=self.main_window_back,
) )
# if uiscale is bui.UIScale.SMALL: # if uiscale is bui.UIScale.SMALL:
# bui.widget( # bui.widget(
@ -446,6 +453,16 @@ class GetTokensWindow(bui.Window):
# self._ticking_sound.stop() # self._ticking_sound.stop()
# self._ticking_sound = None # self._ticking_sound = None
@override
def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes.
cls = type(self)
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition, origin_widget=origin_widget
)
)
def _update(self) -> None: def _update(self) -> None:
# No-op if our underlying widget is dead or on its way out. # No-op if our underlying widget is dead or on its way out.
if not self._root_widget or self._root_widget.transitioning_out: if not self._root_widget or self._root_widget.transitioning_out:
@ -815,17 +832,18 @@ class GetTokensWindow(bui.Window):
# self._ticking_sound = None # self._ticking_sound = None
# bui.getsound('cashRegister2').play() # bui.getsound('cashRegister2').play()
def _back(self) -> None: # def _back(self) -> None:
# No-op if our underlying widget is dead or on its way out. # self.main_
if not self._root_widget or self._root_widget.transitioning_out: # No-op if our underlying widget is dead or on its way out.
return # if not self._root_widget or self._root_widget.transitioning_out:
# return
bui.containerwidget( # bui.containerwidget(
edit=self._root_widget, transition=self._transition_out # edit=self._root_widget, transition=self._transition_out
) # )
if self._restore_previous_call is not None: # if self._restore_previous_call is not None:
self._restore_previous_call(self._root_widget) # self._restore_previous_call(self._root_widget)
def _on_learn_more_press(self, url: str) -> None: def _on_learn_more_press(self, url: str) -> None:
bui.open_url(url) bui.open_url(url)

View File

@ -26,13 +26,14 @@ class HelpWindow(bui.MainWindow):
getres = bui.app.lang.get_resource getres = bui.app.lang.get_resource
# self._main_menu = main_menu
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 1050 if uiscale is bui.UIScale.SMALL else 750 width = 1050 if uiscale is bui.UIScale.SMALL else 750
x_offs = 70 if uiscale is bui.UIScale.SMALL else 0 xoffs = 70 if uiscale is bui.UIScale.SMALL else 0
yoffs = -33 if uiscale is bui.UIScale.SMALL else 0
height = ( height = (
460 500
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 530 if uiscale is bui.UIScale.MEDIUM else 600 else 530 if uiscale is bui.UIScale.MEDIUM else 600
) )
@ -51,7 +52,7 @@ class HelpWindow(bui.MainWindow):
else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -24) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -62,7 +63,10 @@ class HelpWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)), position=(
0,
height - (50 if uiscale is bui.UIScale.SMALL else 45) + yoffs,
),
size=(width, 25), size=(width, 25),
text=bui.Lstr( text=bui.Lstr(
resource=f'{self._r}.titleText', resource=f'{self._r}.titleText',
@ -75,11 +79,14 @@ class HelpWindow(bui.MainWindow):
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(44 + x_offs, 55 if uiscale is bui.UIScale.SMALL else 55), position=(
44 + xoffs,
(92 if uiscale is bui.UIScale.SMALL else 55) + yoffs,
),
simple_culling_v=100.0, simple_culling_v=100.0,
size=( size=(
width - (88 + 2 * x_offs), width - (88 + 2 * xoffs),
height - 120 + (5 if uiscale is bui.UIScale.SMALL else 0), height - (150 if uiscale is bui.UIScale.SMALL else 120),
), ),
capture_arrows=True, capture_arrows=True,
) )
@ -105,7 +112,7 @@ class HelpWindow(bui.MainWindow):
else: else:
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(x_offs + 50, height - 55), position=(xoffs + 50, height - 55),
size=(60, 55), size=(60, 55),
scale=0.8, scale=0.8,
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),

View File

@ -14,6 +14,18 @@ if TYPE_CHECKING:
from typing import Any, Sequence from typing import Any, Sequence
class IconPickerDelegate:
"""Delegate for character-picker."""
def on_icon_picker_pick(self, icon: str) -> None:
"""Called when a character is selected."""
raise NotImplementedError()
def on_icon_picker_get_more_press(self) -> None:
"""Called when the 'get more characters' button is pressed."""
raise NotImplementedError()
class IconPicker(PopupWindow): class IconPicker(PopupWindow):
"""Picker for icons.""" """Picker for icons."""
@ -21,8 +33,9 @@ class IconPicker(PopupWindow):
self, self,
parent: bui.Widget, parent: bui.Widget,
position: tuple[float, float] = (0.0, 0.0), position: tuple[float, float] = (0.0, 0.0),
delegate: Any = None, delegate: IconPickerDelegate | None = None,
scale: float | None = None, scale: float | None = None,
*,
offset: tuple[float, float] = (0.0, 0.0), offset: tuple[float, float] = (0.0, 0.0),
tint_color: Sequence[float] = (1.0, 1.0, 1.0), tint_color: Sequence[float] = (1.0, 1.0, 1.0),
tint2_color: Sequence[float] = (1.0, 1.0, 1.0), tint2_color: Sequence[float] = (1.0, 1.0, 1.0),
@ -160,24 +173,17 @@ class IconPicker(PopupWindow):
def _on_store_press(self) -> None: def _on_store_press(self) -> None:
from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.account import show_sign_in_prompt
# from bauiv1lib.store.browser import StoreBrowserWindow
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
if plus.get_v1_account_state() != 'signed_in': if plus.get_v1_account_state() != 'signed_in':
show_sign_in_prompt() show_sign_in_prompt()
return return
# self._transition_out()
bui.screenmessage('UNDER CONSTRUCTION') if self._delegate is not None:
return self._delegate.on_icon_picker_get_more_press()
# StoreBrowserWindow( self._transition_out()
# modal=True,
# show_tab=StoreBrowserWindow.TabID.ICONS,
# origin_widget=self._get_more_icons_button,
# )
def _select_icon(self, icon: str) -> None: def _select_icon(self, icon: str) -> None:
if self._delegate is not None: if self._delegate is not None:

View File

@ -6,58 +6,79 @@ from __future__ import annotations
from typing import override from typing import override
from bauiv1lib.popup import PopupWindow # from bauiv1lib.popup import PopupWindow
import bauiv1 as bui import bauiv1 as bui
class InboxWindow(PopupWindow): class InboxWindow(bui.MainWindow):
"""Popup window to show account messages.""" """Popup window to show account messages."""
def __init__( def __init__(
self, position: tuple[float, float], scale: float | None = None self,
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
): ):
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
if scale is None: self._width = 600 if uiscale is bui.UIScale.SMALL else 450
scale = (
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
)
self._transitioning_out = False
self._width = 450
self._height = ( self._height = (
300 380
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 370 if uiscale is bui.UIScale.MEDIUM else 450 else 370 if uiscale is bui.UIScale.MEDIUM else 450
) )
bg_color = (0.5, 0.4, 0.6) yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
# creates our _root_widget
super().__init__( super().__init__(
position=position, root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
scale=scale, toolbar_visibility=(
bg_color=bg_color, 'menu_minimal'
edge_buffer_scale=4.0, # Try to keep button unobscured. if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
scale=(
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
),
stack_offset=(
(0, 0)
if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
),
),
transition=transition,
origin_widget=origin_widget,
) )
self._cancel_button = bui.buttonwidget( if uiscale is bui.UIScale.SMALL:
parent=self.root_widget, bui.containerwidget(
position=(50, self._height - 30), edit=self._root_widget, on_cancel_call=self.main_window_back
size=(50, 50), )
scale=0.5, self._back_button = None
label='', else:
color=bg_color, self._back_button = bui.buttonwidget(
on_activate_call=self._on_cancel_press, parent=self._root_widget,
autoselect=True, autoselect=True,
icon=bui.gettexture('crossOut'), position=(50, self._height - 38 + yoffs),
iconscale=1.2, size=(60, 60),
) scale=0.6,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
on_activate_call=self.main_window_back,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._back_button
)
self._title_text = bui.textwidget( self._title_text = bui.textwidget(
parent=self.root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 20), position=(
self._width * 0.5,
self._height
- (27 if uiscale is bui.UIScale.SMALL else 20)
+ yoffs,
),
size=(0, 0), size=(0, 0),
h_align='center', h_align='center',
v_align='center', v_align='center',
@ -68,16 +89,27 @@ class InboxWindow(PopupWindow):
) )
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self.root_widget, parent=self._root_widget,
size=(self._width - 60, self._height - 70), size=(
position=(30, 30), self._width - 60,
self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
),
position=(
30,
(110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
),
capture_arrows=True, capture_arrows=True,
simple_culling_v=10, simple_culling_v=10,
) )
bui.widget(edit=self._scrollwidget, autoselect=True) bui.widget(edit=self._scrollwidget, autoselect=True)
if uiscale is bui.UIScale.SMALL:
bui.widget(
edit=self._scrollwidget,
left_widget=bui.get_special_widget('back_button'),
)
bui.containerwidget( bui.containerwidget(
edit=self.root_widget, cancel_button=self._cancel_button edit=self._root_widget, cancel_button=self._back_button
) )
entries: list[str] = [] entries: list[str] = []
@ -105,15 +137,26 @@ class InboxWindow(PopupWindow):
v_align='center', v_align='center',
) )
def _on_cancel_press(self) -> None:
self._transition_out()
def _transition_out(self) -> None:
if not self._transitioning_out:
self._transitioning_out = True
bui.containerwidget(edit=self.root_widget, transition='out_scale')
@override @override
def on_popup_cancel(self) -> None: def get_main_window_state(self) -> bui.MainWindowState:
bui.getsound('swish').play() # Support recreating our window for back/refresh purposes.
self._transition_out() cls = type(self)
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition, origin_widget=origin_widget
)
)
# def _on_cancel_press(self) -> None:
# self._transition_out()
# def _transition_out(self) -> None:
# if not self._transitioning_out:
# self._transitioning_out = True
# bui.containerwidget(
# edit=self._root_widget, transition='out_scale')
# @override
# def on_popup_cancel(self) -> None:
# bui.getsound('swish').play()
# self._transition_out()

View File

@ -24,11 +24,12 @@ class InventoryWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 1050 if uiscale is bui.UIScale.SMALL else 750 width = 1050 if uiscale is bui.UIScale.SMALL else 750
height = ( height = (
460 500
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 530 if uiscale is bui.UIScale.MEDIUM else 600 else 530 if uiscale is bui.UIScale.MEDIUM else 600
) )
x_offs = 70 if uiscale is bui.UIScale.SMALL else 0 x_offs = 70 if uiscale is bui.UIScale.SMALL else 0
yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
@ -44,7 +45,7 @@ class InventoryWindow(bui.MainWindow):
else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -24) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -55,7 +56,7 @@ class InventoryWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)), position=(0, height - 45 + yoffs),
size=(width, 25), size=(width, 25),
text='INVENTORY', text='INVENTORY',
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -70,7 +71,7 @@ class InventoryWindow(bui.MainWindow):
else: else:
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(x_offs + 50, height - 55), position=(x_offs + 50, height - 55 + yoffs),
size=(60, 55), size=(60, 55),
scale=0.8, scale=0.8,
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),
@ -83,7 +84,7 @@ class InventoryWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - 120), position=(0, height - 120 + yoffs),
size=(width, 25), size=(width, 25),
text='(under construction)', text='(under construction)',
scale=0.7, scale=0.7,
@ -94,7 +95,7 @@ class InventoryWindow(bui.MainWindow):
button_width = 300 button_width = 300
self._player_profiles_button = btn = bui.buttonwidget( self._player_profiles_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=((width - button_width) * 0.5, height - 200), position=((width - button_width) * 0.5, height - 200 + yoffs),
autoselect=True, autoselect=True,
size=(button_width, 60), size=(button_width, 60),
label=bui.Lstr(resource='playerProfilesWindow.titleText'), label=bui.Lstr(resource='playerProfilesWindow.titleText'),

View File

@ -22,6 +22,7 @@ class LeagueRankButton:
position: tuple[float, float], position: tuple[float, float],
size: tuple[float, float], size: tuple[float, float],
scale: float, scale: float,
*,
on_activate_call: Callable[[], Any] | None = None, on_activate_call: Callable[[], Any] | None = None,
transition_delay: float | None = None, transition_delay: float | None = None,
color: tuple[float, float, float] | None = None, color: tuple[float, float, float] | None = None,

View File

@ -186,16 +186,14 @@ class LeagueRankWindow(bui.MainWindow):
self._update(show=info is None) self._update(show=info is None)
def _on_achievements_press(self) -> None: def _on_achievements_press(self) -> None:
from bauiv1lib import achievements from bauiv1lib.achievements import AchievementsWindow
# only allow this for all-time or the current season # only allow this for all-time or the current season
# (we currently don't keep specific achievement data for old seasons) # (we currently don't keep specific achievement data for old seasons)
if self._season == 'a' or self._is_current_season: if self._season == 'a' or self._is_current_season:
prab = self._power_ranking_achievements_button prab = self._power_ranking_achievements_button
assert prab is not None assert prab is not None
achievements.AchievementsWindow( self.main_window_replace(AchievementsWindow(origin_widget=prab))
position=prab.get_screen_space_center()
)
else: else:
bui.screenmessage( bui.screenmessage(
bui.Lstr( bui.Lstr(
@ -1151,10 +1149,10 @@ class LeagueRankWindow(bui.MainWindow):
def _show_account_info( def _show_account_info(
self, account_id: str, textwidget: bui.Widget self, account_id: str, textwidget: bui.Widget
) -> None: ) -> None:
from bauiv1lib.account import viewer from bauiv1lib.account.viewer import AccountViewerWindow
bui.getsound('swish').play() bui.getsound('swish').play()
viewer.AccountViewerWindow( AccountViewerWindow(
account_id=account_id, position=textwidget.get_screen_space_center() account_id=account_id, position=textwidget.get_screen_space_center()
) )

View File

@ -91,7 +91,7 @@ class MainMenuWindow(bui.MainWindow):
import bauiv1lib.account.settings as _unused5 import bauiv1lib.account.settings as _unused5
import bauiv1lib.store.browser as _unused6 import bauiv1lib.store.browser as _unused6
import bauiv1lib.credits as _unused7 import bauiv1lib.credits as _unused7
import bauiv1lib.helpui as _unused8 import bauiv1lib.help as _unused8
import bauiv1lib.settings.allsettings as _unused9 import bauiv1lib.settings.allsettings as _unused9
import bauiv1lib.gather as _unused10 import bauiv1lib.gather as _unused10
import bauiv1lib.watch as _unused11 import bauiv1lib.watch as _unused11
@ -524,7 +524,7 @@ class MainMenuWindow(bui.MainWindow):
def _howtoplay(self) -> None: def _howtoplay(self) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bauiv1lib.helpui import HelpWindow from bauiv1lib.help import HelpWindow
# no-op if we're not currently in control. # no-op if we're not currently in control.
if not self.main_window_has_control(): if not self.main_window_has_control():

View File

@ -33,6 +33,7 @@ class PartyQueueWindow(bui.Window):
account_id: str, account_id: str,
name: str, name: str,
): ):
# pylint: disable=too-many-positional-arguments
self.claimed = False self.claimed = False
self._line_left = parent.get_line_left() self._line_left = parent.get_line_left()
self._line_width = parent.get_line_width() self._line_width = parent.get_line_width()
@ -351,12 +352,12 @@ class PartyQueueWindow(bui.Window):
self, account_id: str | None, origin_widget: bui.Widget self, account_id: str | None, origin_widget: bui.Widget
) -> None: ) -> None:
"""A dude was clicked so we should show his account info.""" """A dude was clicked so we should show his account info."""
from bauiv1lib.account import viewer from bauiv1lib.account.viewer import AccountViewerWindow
if account_id is None: if account_id is None:
bui.getsound('error').play() bui.getsound('error').play()
return return
viewer.AccountViewerWindow( AccountViewerWindow(
account_id=account_id, account_id=account_id,
position=origin_widget.get_screen_space_center(), position=origin_widget.get_screen_space_center(),
) )
@ -551,6 +552,11 @@ class PartyQueueWindow(bui.Window):
self._last_connect_attempt_time is None self._last_connect_attempt_time is None
or now - self._last_connect_attempt_time > 10.0 or now - self._last_connect_attempt_time > 10.0
): ):
# Store UI location to return to when done.
if bs.app.classic is not None:
bs.app.classic.save_ui_state()
bs.connect_to_party( bs.connect_to_party(
address=self._address, address=self._address,
port=self._port, port=self._port,

View File

@ -632,6 +632,7 @@ class PlayWindow(bui.MainWindow):
position: tuple[float, float], position: tuple[float, float],
color: tuple[float, float, float], color: tuple[float, float, float],
) -> None: ) -> None:
# pylint: disable=too-many-positional-arguments
h_extra = -100 h_extra = -100
v_extra = 130 v_extra = 130
eye_color = ( eye_color = (

View File

@ -28,17 +28,18 @@ class PlaylistAddGameWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 750 if uiscale is bui.UIScale.SMALL else 650 self._width = 750 if uiscale is bui.UIScale.SMALL else 650
x_inset = 50 if uiscale is bui.UIScale.SMALL else 0 x_inset = 50 if uiscale is bui.UIScale.SMALL else 0
yoffs = -44 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
346 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 380 if uiscale is bui.UIScale.MEDIUM else 440 else 400 if uiscale is bui.UIScale.MEDIUM else 460
) )
top_extra = 30 if uiscale is bui.UIScale.SMALL else 20
self._scroll_width = 210 self._scroll_width = 210
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height),
scale=( scale=(
1.95 1.95
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
@ -56,7 +57,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(58 + x_inset, self._height - 53), position=(58 + x_inset, self._height - 53 + yoffs),
size=(60, 48), size=(60, 48),
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),
autoselect=True, autoselect=True,
@ -65,7 +66,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
) )
self._select_button = select_button = bui.buttonwidget( self._select_button = select_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - (172 + x_inset), self._height - 50), position=(self._width - (172 + x_inset), self._height - 50 + yoffs),
autoselect=True, autoselect=True,
size=(160, 60), size=(160, 60),
scale=0.75, scale=0.75,
@ -81,7 +82,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 28), position=(self._width * 0.5, self._height - 28 + yoffs),
size=(0, 0), size=(0, 0),
scale=1.0, scale=1.0,
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
@ -90,7 +91,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
maxwidth=250, maxwidth=250,
v_align='center', v_align='center',
) )
v = self._height - 64 v = self._height - 64 + yoffs
self._selected_title_text = bui.textwidget( self._selected_title_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
@ -114,9 +115,11 @@ class PlaylistAddGameWindow(bui.MainWindow):
h_align='left', h_align='left',
) )
scroll_height = self._height - 100 scroll_height = self._height - (
160 if uiscale is bui.UIScale.SMALL else 100
)
v = self._height - 60 v = self._height - 60 + yoffs
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -61,7 +61,7 @@ class PlaylistBrowserWindow(bui.MainWindow):
else 510 if uiscale is bui.UIScale.MEDIUM else 580 else 510 if uiscale is bui.UIScale.MEDIUM else 580
) )
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 top_extra = 30 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
@ -80,7 +80,7 @@ class PlaylistBrowserWindow(bui.MainWindow):
else 1.05 if uiscale is bui.UIScale.MEDIUM else 0.9 else 1.05 if uiscale is bui.UIScale.MEDIUM else 0.9
), ),
stack_offset=( stack_offset=(
(0, -56) if uiscale is bui.UIScale.SMALL else (0, 0) (0, -46) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,

View File

@ -45,20 +45,20 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 970.0 if uiscale is bui.UIScale.SMALL else 650.0 self._width = 970.0 if uiscale is bui.UIScale.SMALL else 650.0
x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0 x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0
yoffs = -51 if uiscale is bui.UIScale.SMALL else 0.0
self._height = ( self._height = (
380.0 440.0
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 420.0 if uiscale is bui.UIScale.MEDIUM else 500.0 else 420.0 if uiscale is bui.UIScale.MEDIUM else 500.0
) )
top_extra = 20.0 if uiscale is bui.UIScale.SMALL else 0.0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height),
scale=( scale=(
1.83 1.8
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
toolbar_visibility=( toolbar_visibility=(
'menu_minimal' 'menu_minimal'
@ -66,7 +66,7 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
else 'menu_full' else 'menu_full'
), ),
stack_offset=( stack_offset=(
(0, -10) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -82,7 +82,7 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(43 + x_inset, self._height - 60), position=(43 + x_inset, self._height - 60 + yoffs),
size=(160, 68), size=(160, 68),
scale=0.77, scale=0.77,
autoselect=True, autoselect=True,
@ -99,7 +99,12 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, self._height - 47), position=(
0,
self._height
- (47 if uiscale is bui.UIScale.SMALL else 47)
+ yoffs,
),
size=(self._width, 25), size=(self._width, 25),
text=bui.Lstr( text=bui.Lstr(
resource=f'{self._r}.titleText', resource=f'{self._r}.titleText',
@ -111,7 +116,7 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
v_align='center', v_align='center',
) )
v = self._height - 59.0 v = self._height - 59.0 + yoffs
h = 41 + x_inset h = 41 + x_inset
b_color = (0.6, 0.53, 0.63) b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
@ -260,8 +265,10 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
) )
) )
v = self._height - 75 v = self._height - 75 + yoffs
self._scroll_height = self._height - 119 self._scroll_height = self._height - (
180 if uiscale is bui.UIScale.SMALL else 119
)
scrollwidget = bui.scrollwidget( scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(140 + x_inset, v - self._scroll_height), position=(140 + x_inset, v - self._scroll_height),

View File

@ -35,22 +35,22 @@ class PlaylistEditWindow(bui.MainWindow):
self._width = 870 if uiscale is bui.UIScale.SMALL else 670 self._width = 870 if uiscale is bui.UIScale.SMALL else 670
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
400 500
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 470 if uiscale is bui.UIScale.MEDIUM else 540 else 470 if uiscale is bui.UIScale.MEDIUM else 540
) )
yoffs = -68 if uiscale is bui.UIScale.SMALL else 0
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height),
scale=( scale=(
1.8 1.76
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -16) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -58,7 +58,7 @@ class PlaylistEditWindow(bui.MainWindow):
) )
cancel_button = bui.buttonwidget( cancel_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(35 + x_inset, self._height - 60), position=(35 + x_inset, self._height - 60 + yoffs),
scale=0.8, scale=0.8,
size=(175, 60), size=(175, 60),
autoselect=True, autoselect=True,
@ -67,7 +67,7 @@ class PlaylistEditWindow(bui.MainWindow):
) )
save_button = btn = bui.buttonwidget( save_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - (195 + x_inset), self._height - 60), position=(self._width - (195 + x_inset), self._height - 60 + yoffs),
scale=0.8, scale=0.8,
size=(190, 60), size=(190, 60),
autoselect=True, autoselect=True,
@ -89,7 +89,7 @@ class PlaylistEditWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(-10, self._height - 50), position=(-10, self._height - 50 + yoffs),
size=(self._width, 25), size=(self._width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -99,7 +99,7 @@ class PlaylistEditWindow(bui.MainWindow):
maxwidth=270, maxwidth=270,
) )
v = self._height - 115.0 v = self._height - 115.0 + yoffs
self._scroll_width = self._width - (205 + 2 * x_inset) self._scroll_width = self._width - (205 + 2 * x_inset)
@ -136,7 +136,7 @@ class PlaylistEditWindow(bui.MainWindow):
self._list_widgets: list[bui.Widget] = [] self._list_widgets: list[bui.Widget] = []
h = 40 + x_inset h = 40 + x_inset
v = self._height - 172.0 v = self._height - 172.0 + yoffs
b_color = (0.6, 0.53, 0.63) b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
@ -222,8 +222,10 @@ class PlaylistEditWindow(bui.MainWindow):
repeat=True, repeat=True,
) )
v = self._height - 100 v = self._height - 100 + yoffs
scroll_height = self._height - 155 scroll_height = self._height - (
250 if uiscale is bui.UIScale.SMALL else 155
)
scrollwidget = bui.scrollwidget( scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(160 + x_inset, v - scroll_height), position=(160 + x_inset, v - scroll_height),

View File

@ -21,6 +21,7 @@ class PlaylistEditController:
self, self,
sessiontype: type[bs.Session], sessiontype: type[bs.Session],
from_window: bui.MainWindow, from_window: bui.MainWindow,
*,
existing_playlist_name: str | None = None, existing_playlist_name: str | None = None,
playlist: list[dict[str, Any]] | None = None, playlist: list[dict[str, Any]] | None = None,
playlist_name: str | None = None, playlist_name: str | None = None,

View File

@ -31,6 +31,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
edit_info: dict[str, Any] | None = None, edit_info: dict[str, Any] | None = None,
): ):
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
from bascenev1 import ( from bascenev1 import (
@ -108,13 +109,14 @@ class PlaylistEditGameWindow(bui.MainWindow):
width = 820 if uiscale is bui.UIScale.SMALL else 620 width = 820 if uiscale is bui.UIScale.SMALL else 620
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
height = ( height = (
365 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 460 if uiscale is bui.UIScale.MEDIUM else 550 else 460 if uiscale is bui.UIScale.MEDIUM else 550
) )
spacing = 52 spacing = 52
y_extra = 15 y_extra = 15
y_extra2 = 21 y_extra2 = 21
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
map_tex_name = get_map_class(self._map).get_preview_texture_name() map_tex_name = get_map_class(self._map).get_preview_texture_name()
if map_tex_name is None: if map_tex_name is None:
@ -131,7 +133,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -17) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -140,7 +142,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(45 + x_inset, height - 82 + y_extra2), position=(45 + x_inset, height - 82 + y_extra2 + yoffs),
size=(60, 48) if is_add else (180, 65), size=(60, 48) if is_add else (180, 65),
label=( label=(
bui.charstr(bui.SpecialChar.BACK) bui.charstr(bui.SpecialChar.BACK)
@ -157,7 +159,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
add_button = bui.buttonwidget( add_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width - (193 + x_inset), height - 82 + y_extra2), position=(width - (193 + x_inset), height - 82 + y_extra2 + yoffs),
size=(200, 65), size=(200, 65),
scale=0.75, scale=0.75,
text_scale=1.3, text_scale=1.3,
@ -173,7 +175,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(-8, height - 70 + y_extra2), position=(-8, height - 70 + y_extra2 + yoffs),
size=(width, 25), size=(width, 25),
text=gametype.get_display_string(), text=gametype.get_display_string(),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -193,8 +195,14 @@ class PlaylistEditGameWindow(bui.MainWindow):
scroll_width = width - (86 + 2 * x_inset) scroll_width = width - (86 + 2 * x_inset)
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(44 + x_inset, 35 + y_extra), position=(
size=(scroll_width, height - 116), 44 + x_inset,
(80 if uiscale is bui.UIScale.SMALL else 35) + y_extra + yoffs,
),
size=(
scroll_width,
height - (166 if uiscale is bui.UIScale.SMALL else 116),
),
highlight=False, highlight=False,
claims_left_right=True, claims_left_right=True,
claims_tab=True, claims_tab=True,
@ -485,11 +493,11 @@ class PlaylistEditGameWindow(bui.MainWindow):
if prev_widgets is not None: if prev_widgets is not None:
# Wire our rightmost to their rightmost. # Wire our rightmost to their rightmost.
bui.widget(edit=prev_widgets[-1], down_widget=cwdg[-1]) bui.widget(edit=prev_widgets[-1], down_widget=cwdg[-1])
bui.widget(cwdg[-1], up_widget=prev_widgets[-1]) bui.widget(edit=cwdg[-1], up_widget=prev_widgets[-1])
# Wire our leftmost to their leftmost. # Wire our leftmost to their leftmost.
bui.widget(edit=prev_widgets[0], down_widget=cwdg[0]) bui.widget(edit=prev_widgets[0], down_widget=cwdg[0])
bui.widget(cwdg[0], up_widget=prev_widgets[0]) bui.widget(edit=cwdg[0], up_widget=prev_widgets[0])
prev_widgets = cwdg prev_widgets = cwdg
except Exception: except Exception:
logging.exception( logging.exception(
@ -617,6 +625,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
setting_type: type, setting_type: type,
setting_name: str, setting_name: str,
) -> None: ) -> None:
# pylint: disable=too-many-positional-arguments
if setting_type == float: if setting_type == float:
val = float(cast(str, bui.textwidget(query=ctrl))) val = float(cast(str, bui.textwidget(query=ctrl)))
else: else:

View File

@ -30,6 +30,7 @@ class PlaylistMapSelectWindow(bui.MainWindow):
select_get_more_maps_button: bool = False, select_get_more_maps_button: bool = False,
): ):
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-positional-arguments
from bascenev1 import get_filtered_map_name from bascenev1 import get_filtered_map_name
@ -52,22 +53,22 @@ class PlaylistMapSelectWindow(bui.MainWindow):
width = 815 if uiscale is bui.UIScale.SMALL else 615 width = 815 if uiscale is bui.UIScale.SMALL else 615
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
height = ( height = (
400 420
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 480 if uiscale is bui.UIScale.MEDIUM else 600 else 480 if uiscale is bui.UIScale.MEDIUM else 600
) )
yoffs = -37 if uiscale is bui.UIScale.SMALL else 0
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(width, height + top_extra), size=(width, height),
scale=( scale=(
1.95 1.95
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -27) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -76,7 +77,7 @@ class PlaylistMapSelectWindow(bui.MainWindow):
self._cancel_button = btn = bui.buttonwidget( self._cancel_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(38 + x_inset, height - 67), position=(38 + x_inset, height - 67 + yoffs),
size=(140, 50), size=(140, 50),
scale=0.9, scale=0.9,
text_scale=1.0, text_scale=1.0,
@ -88,7 +89,7 @@ class PlaylistMapSelectWindow(bui.MainWindow):
bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.containerwidget(edit=self._root_widget, cancel_button=btn)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, height - 46), position=(width * 0.5, height - 46 + yoffs),
size=(0, 0), size=(0, 0),
maxwidth=260, maxwidth=260,
scale=1.1, scale=1.1,
@ -100,9 +101,11 @@ class PlaylistMapSelectWindow(bui.MainWindow):
h_align='center', h_align='center',
v_align='center', v_align='center',
) )
v = height - 70 v = height - 70 + yoffs
self._scroll_width = width - (80 + 2 * x_inset) self._scroll_width = width - (80 + 2 * x_inset)
self._scroll_height = height - 140 self._scroll_height = height - (
170 if uiscale is bui.UIScale.SMALL else 140
)
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -23,6 +23,7 @@ class PlayOptionsWindow(PopupWindow):
def __init__( def __init__(
self, self,
*,
sessiontype: type[bs.Session], sessiontype: type[bs.Session],
playlist: str, playlist: str,
scale_origin: tuple[float, float], scale_origin: tuple[float, float],
@ -528,6 +529,11 @@ class PlayOptionsWindow(PopupWindow):
def _run_selected_playlist(self) -> None: def _run_selected_playlist(self) -> None:
bui.unlock_all_input() bui.unlock_all_input()
# Save our place in the UI that we'll return to when done.
if bs.app.classic is not None:
bs.app.classic.save_ui_state()
try: try:
bs.new_host_session(self._sessiontype) bs.new_host_session(self._sessiontype)
except Exception: except Exception:

View File

@ -23,6 +23,7 @@ class PopupWindow:
position: tuple[float, float], position: tuple[float, float],
size: tuple[float, float], size: tuple[float, float],
scale: float = 1.0, scale: float = 1.0,
*,
offset: tuple[float, float] = (0, 0), offset: tuple[float, float] = (0, 0),
bg_color: tuple[float, float, float] = (0.35, 0.55, 0.15), bg_color: tuple[float, float, float] = (0.35, 0.55, 0.15),
focus_position: tuple[float, float] = (0, 0), focus_position: tuple[float, float] = (0, 0),
@ -116,6 +117,7 @@ class PopupMenuWindow(PopupWindow):
position: tuple[float, float], position: tuple[float, float],
choices: Sequence[str], choices: Sequence[str],
current_choice: str, current_choice: str,
*,
delegate: Any = None, delegate: Any = None,
width: float = 230.0, width: float = 230.0,
maxwidth: float | None = None, maxwidth: float | None = None,
@ -301,6 +303,7 @@ class PopupMenu:
parent: bui.Widget, parent: bui.Widget,
position: tuple[float, float], position: tuple[float, float],
choices: Sequence[str], choices: Sequence[str],
*,
current_choice: str | None = None, current_choice: str | None = None,
on_value_change_call: Callable[[str], Any] | None = None, on_value_change_call: Callable[[str], Any] | None = None,
opening_call: Callable[[], Any] | None = None, opening_call: Callable[[], Any] | None = None,

View File

@ -9,11 +9,14 @@ from typing import cast, override
from bauiv1lib.colorpicker import ColorPicker from bauiv1lib.colorpicker import ColorPicker
from bauiv1lib.characterpicker import CharacterPickerDelegate from bauiv1lib.characterpicker import CharacterPickerDelegate
from bauiv1lib.iconpicker import IconPickerDelegate
import bauiv1 as bui import bauiv1 as bui
import bascenev1 as bs import bascenev1 as bs
class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate): class EditProfileWindow(
bui.MainWindow, CharacterPickerDelegate, IconPickerDelegate
):
"""Window for editing a player profile.""" """Window for editing a player profile."""
def reload_window(self) -> None: def reload_window(self) -> None:
@ -30,10 +33,12 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
back_state=self.main_window_back_state, back_state=self.main_window_back_state,
) )
# def __del__(self) -> None:
# print(f'~EditProfileWindow({id(self)})')
def __init__( def __init__(
self, self,
existing_profile: str | None, existing_profile: str | None,
# in_main_menu: bool,
transition: str | None = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):
@ -41,12 +46,13 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
assert bui.app.classic is not None assert bui.app.classic is not None
# print(f'EditProfileWindow({id(self)})')
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
# self._in_main_menu = in_main_menu
self._existing_profile = existing_profile self._existing_profile = existing_profile
self._r = 'editProfileWindow' self._r = 'editProfileWindow'
self._spazzes: list[str] = [] self._spazzes: list[str] = []
@ -62,10 +68,11 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
self._width = width = 880.0 if uiscale is bui.UIScale.SMALL else 680.0 self._width = width = 880.0 if uiscale is bui.UIScale.SMALL else 680.0
self._x_inset = x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0 self._x_inset = x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0
self._height = height = ( self._height = height = (
450.0 500.0
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 400.0 if uiscale is bui.UIScale.MEDIUM else 450.0 else 400.0 if uiscale is bui.UIScale.MEDIUM else 450.0
) )
yoffs = -42 if uiscale is bui.UIScale.SMALL else 0
spacing = 40 spacing = 40
self._base_scale = ( self._base_scale = (
1.6 1.6
@ -78,13 +85,10 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
size=(width, height + top_extra), size=(width, height + top_extra),
scale=self._base_scale, scale=self._base_scale,
stack_offset=( stack_offset=(
(0, -40) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
toolbar_visibility=( toolbar_visibility=(
# 'menu_minimal' None if uiscale is bui.UIScale.SMALL else 'menu_full'
None
if uiscale is bui.UIScale.SMALL
else 'menu_full'
), ),
), ),
transition=transition, transition=transition,
@ -92,7 +96,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
) )
cancel_button = btn = bui.buttonwidget( cancel_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(52 + x_inset, height - 60), position=(52 + x_inset, height - 60 + yoffs),
size=(155, 60), size=(155, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -102,7 +106,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.containerwidget(edit=self._root_widget, cancel_button=btn)
save_button = btn = bui.buttonwidget( save_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width - (177 + x_inset), height - 60), position=(width - (177 + x_inset), height - 60 + yoffs),
size=(155, 60), size=(155, 60),
autoselect=True, autoselect=True,
scale=0.8, scale=0.8,
@ -113,7 +117,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
bui.containerwidget(edit=self._root_widget, start_button=btn) bui.containerwidget(edit=self._root_widget, start_button=btn)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, height - 38), position=(self._width * 0.5, height - 38 + yoffs),
size=(0, 0), size=(0, 0),
text=( text=(
bui.Lstr(resource=f'{self._r}.titleNewText') bui.Lstr(resource=f'{self._r}.titleNewText')
@ -163,7 +167,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
self._icon_index = icon_index self._icon_index = icon_index
bui.buttonwidget(edit=save_button, on_activate_call=self.save) bui.buttonwidget(edit=save_button, on_activate_call=self.save)
v = height - 115.0 v = height - 115.0 + yoffs
self._name = ( self._name = (
'' if self._existing_profile is None else self._existing_profile '' if self._existing_profile is None else self._existing_profile
) )
@ -522,12 +526,16 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
def get_main_window_state(self) -> bui.MainWindowState: def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes. # Support recreating our window for back/refresh purposes.
cls = type(self) cls = type(self)
# Pull things out of self here; if we do it within the lambda
# we'll keep ourself alive which is bad.
existing_profile = self._existing_profile
return bui.BasicMainWindowState( return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls( create_call=lambda transition, origin_widget: cls(
transition=transition, transition=transition,
origin_widget=origin_widget, origin_widget=origin_widget,
existing_profile=self._existing_profile, existing_profile=existing_profile,
# in_main_menu=self._in_main_menu,
) )
) )
@ -637,18 +645,35 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
for s in self._spazzes for s in self._spazzes
] ]
@override
def on_icon_picker_pick(self, icon: str) -> None: def on_icon_picker_pick(self, icon: str) -> None:
"""An icon has been selected by the picker.""" """An icon has been selected by the picker."""
self._icon = icon self._icon = icon
self._update_icon() self._update_icon()
@override
def on_icon_picker_get_more_press(self) -> None:
"""User wants to get more icons."""
from bauiv1lib.store.browser import StoreBrowserWindow
if not self.main_window_has_control():
return
self.main_window_replace(
StoreBrowserWindow(
minimal_toolbars=True,
show_tab=StoreBrowserWindow.TabID.ICONS,
)
)
@override @override
def on_character_picker_pick(self, character: str) -> None: def on_character_picker_pick(self, character: str) -> None:
"""A character has been selected by the picker.""" """A character has been selected by the picker."""
if not self._root_widget: if not self._root_widget:
return return
# The player could have bought a new one while the picker was up. # The player could have bought a new one while the picker was
# up.
self.refresh_characters() self.refresh_characters()
self._icon_index = ( self._icon_index = (
self._spazzes.index(character) if character in self._spazzes else 0 self._spazzes.index(character) if character in self._spazzes else 0
@ -847,8 +872,8 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
} }
) )
# Also lets be aware we're no longer global if we're taking a # Also lets be aware we're no longer global if we're taking
# new name (will need to re-request it). # a new name (will need to re-request it).
self._global = False self._global = False
plus.add_v1_account_transaction( plus.add_v1_account_transaction(

View File

@ -34,13 +34,14 @@ class ProfileUpgradeWindow(bui.Window):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 750 if uiscale is bui.UIScale.SMALL else 680 self._width = 750 if uiscale is bui.UIScale.SMALL else 680
self._height = 350 self._height = 450 if uiscale is bui.UIScale.SMALL else 350
assert bui.app.classic is not None assert bui.app.classic is not None
self._base_scale = ( self._base_scale = (
1.9 1.9
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.2 else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.2
) )
yoffs = -60.0 if uiscale is bui.UIScale.SMALL else 0
self._upgrade_start_time: float | None = None self._upgrade_start_time: float | None = None
self._name = edit_profile_window.getname() self._name = edit_profile_window.getname()
self._edit_profile_window = weakref.ref(edit_profile_window) self._edit_profile_window = weakref.ref(edit_profile_window)
@ -53,13 +54,13 @@ class ProfileUpgradeWindow(bui.Window):
transition=transition, transition=transition,
scale=self._base_scale, scale=self._base_scale,
stack_offset=( stack_offset=(
(0, -30) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
) )
) )
cancel_button = bui.buttonwidget( cancel_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(52, 60), position=(52, self._height - 290 + yoffs),
size=(155, 60), size=(155, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -68,7 +69,7 @@ class ProfileUpgradeWindow(bui.Window):
) )
self._upgrade_button = bui.buttonwidget( self._upgrade_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - 190, 60), position=(self._width - 190, self._height - 290 + yoffs),
size=(155, 60), size=(155, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -85,7 +86,7 @@ class ProfileUpgradeWindow(bui.Window):
assert bui.app.classic is not None assert bui.app.classic is not None
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 38), position=(self._width * 0.5, self._height - 38 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.upgradeToGlobalProfileText'), text=bui.Lstr(resource=f'{self._r}.upgradeToGlobalProfileText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -98,7 +99,7 @@ class ProfileUpgradeWindow(bui.Window):
assert bui.app.classic is not None assert bui.app.classic is not None
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 100), position=(self._width * 0.5, self._height - 100 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.upgradeProfileInfoText'), text=bui.Lstr(resource=f'{self._r}.upgradeProfileInfoText'),
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
@ -110,7 +111,7 @@ class ProfileUpgradeWindow(bui.Window):
self._status_text = bui.textwidget( self._status_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 160), position=(self._width * 0.5, self._height - 160 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr( text=bui.Lstr(
resource=f'{self._r}.checkingAvailabilityText', resource=f'{self._r}.checkingAvailabilityText',
@ -125,7 +126,7 @@ class ProfileUpgradeWindow(bui.Window):
self._price_text = bui.textwidget( self._price_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 230), position=(self._width * 0.5, self._height - 230 + yoffs),
size=(0, 0), size=(0, 0),
text='', text='',
color=(0.2, 1, 0.2), color=(0.2, 1, 0.2),
@ -135,22 +136,6 @@ class ProfileUpgradeWindow(bui.Window):
v_align='center', v_align='center',
) )
self._tickets_text: bui.Widget | None
# if not bui.app.ui_v1.use_toolbars:
# self._tickets_text = bui.textwidget(
# parent=self._root_widget,
# position=(self._width * 0.9 - 5, self._height - 30),
# size=(0, 0),
# text=bui.charstr(bui.SpecialChar.TICKET) + '123',
# color=(0.2, 1, 0.2),
# maxwidth=100,
# scale=0.5,
# h_align='right',
# v_align='center',
# )
# else:
self._tickets_text = None
bui.app.classic.master_server_v1_get( bui.app.classic.master_server_v1_get(
'bsGlobalProfileCheck', 'bsGlobalProfileCheck',
{'name': self._name, 'b': bui.app.env.engine_build_number}, {'name': self._name, 'b': bui.app.env.engine_build_number},
@ -161,7 +146,7 @@ class ProfileUpgradeWindow(bui.Window):
) )
self._status: str | None = 'waiting' self._status: str | None = 'waiting'
self._update_timer = bui.AppTimer( self._update_timer = bui.AppTimer(
1.0, bui.WeakCall(self._update), repeat=True 1.023, bui.WeakCall(self._update), repeat=True
) )
self._update() self._update()
@ -256,23 +241,11 @@ class ProfileUpgradeWindow(bui.Window):
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
try: # If our originating window dies at any point, cancel.
t_str = str(plus.get_v1_account_ticket_count()) edit_profile_window = self._edit_profile_window()
except Exception: if edit_profile_window is None:
t_str = '?' self._cancel()
if self._tickets_text is not None: return
bui.textwidget(
edit=self._tickets_text,
text=bui.Lstr(
resource='getTicketsWindow.youHaveShortText',
subs=[
(
'${COUNT}',
bui.charstr(bui.SpecialChar.TICKET) + t_str,
)
],
),
)
# Once we've kicked off an upgrade attempt and all transactions go # Once we've kicked off an upgrade attempt and all transactions go
# through, we're done. # through, we're done.

View File

@ -81,7 +81,9 @@ class AdvancedSettingsWindow(bui.MainWindow):
self._show_always_use_internal_keyboard = not app.env.vr self._show_always_use_internal_keyboard = not app.env.vr
self._scroll_width = self._width - (100 + 2 * x_inset) self._scroll_width = self._width - (100 + 2 * x_inset)
self._scroll_height = self._height - 115.0 self._scroll_height = self._height - (
125.0 if uiscale is bui.UIScale.SMALL else 115.0
)
self._sub_width = self._scroll_width * 0.95 self._sub_width = self._scroll_width * 0.95
self._sub_height = 870.0 self._sub_height = 870.0
@ -129,10 +131,10 @@ class AdvancedSettingsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=( position=(
self._width * 0.5, self._width * 0.5,
self._height - (57 if uiscale is bui.UIScale.SMALL else 40), self._height - (61 if uiscale is bui.UIScale.SMALL else 40),
), ),
size=(0, 0), size=(0, 0),
scale=0.65 if uiscale is bui.UIScale.SMALL else 1.0, scale=0.85 if uiscale is bui.UIScale.SMALL else 1.0,
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=app.ui_v1.title_color, color=app.ui_v1.title_color,
h_align='center', h_align='center',
@ -201,7 +203,7 @@ class AdvancedSettingsWindow(bui.MainWindow):
from bauiv1lib import appinvite as _unused5 from bauiv1lib import appinvite as _unused5
from bauiv1lib import account as _unused6 from bauiv1lib import account as _unused6
from bauiv1lib import sendinfo as _unused7 from bauiv1lib import sendinfo as _unused7
from bauiv1lib import benchmarks as _unused8 from bauiv1lib.settings import benchmarks as _unused8
from bauiv1lib.settings import plugins as _unused9 from bauiv1lib.settings import plugins as _unused9
from bauiv1lib.settings import devtools as _unused10 from bauiv1lib.settings import devtools as _unused10
@ -783,7 +785,7 @@ class AdvancedSettingsWindow(bui.MainWindow):
) )
def _on_benchmark_press(self) -> None: def _on_benchmark_press(self) -> None:
from bauiv1lib.benchmarks import BenchmarksAndStressTestsWindow from bauiv1lib.settings.benchmarks import BenchmarksAndStressTestsWindow
# no-op if we're not in control. # no-op if we're not in control.
if not self.main_window_has_control(): if not self.main_window_has_control():

View File

@ -33,9 +33,10 @@ class AllSettingsWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 1000 if uiscale is bui.UIScale.SMALL else 580 width = 1000 if uiscale is bui.UIScale.SMALL else 580
x_inset = 125 if uiscale is bui.UIScale.SMALL else 0 x_inset = 125 if uiscale is bui.UIScale.SMALL else 0
height = 435 height = 500 if uiscale is bui.UIScale.SMALL else 435
self._r = 'settingsWindow' self._r = 'settingsWindow'
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
super().__init__( super().__init__(
@ -68,7 +69,7 @@ class AllSettingsWindow(bui.MainWindow):
self._back_button = btn = bui.buttonwidget( self._back_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
autoselect=True, autoselect=True,
position=(40 + x_inset, height - 55), position=(40 + x_inset, height - 55 + yoffs),
size=(130, 60), size=(130, 60),
scale=0.8, scale=0.8,
text_scale=1.2, text_scale=1.2,
@ -80,7 +81,7 @@ class AllSettingsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - 44), position=(0, height - 44 + yoffs),
size=(width, 25), size=(width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -97,7 +98,7 @@ class AllSettingsWindow(bui.MainWindow):
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),
) )
v = height - 80 v = height - 80 + yoffs
v -= 145 v -= 145
basew = 280 if uiscale is bui.UIScale.SMALL else 230 basew = 280 if uiscale is bui.UIScale.SMALL else 230

View File

@ -25,13 +25,16 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = width = 650 if uiscale is bui.UIScale.SMALL else 580 self._width = width = 650 if uiscale is bui.UIScale.SMALL else 580
self._height = height = ( self._height = height = (
330 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 420 if uiscale is bui.UIScale.MEDIUM else 520 else 420 if uiscale is bui.UIScale.MEDIUM else 520
) )
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
self._scroll_width = self._width - 100 self._scroll_width = self._width - 100
self._scroll_height = self._height - 120 self._scroll_height = self._height - (
180 if uiscale is bui.UIScale.SMALL else 120
)
self._sub_width = self._scroll_width * 0.95 self._sub_width = self._scroll_width * 0.95
self._sub_height = 520 self._sub_height = 520
@ -72,7 +75,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
else: else:
self._done_button = btn = bui.buttonwidget( self._done_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(40, height - 67), position=(40, height - 67 + yoffs),
size=(120, 60), size=(120, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -83,7 +86,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - 60), position=(0, height - 60 + yoffs),
size=(width, 30), size=(width, 30),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
h_align='center', h_align='center',
@ -96,7 +99,10 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
highlight=False, highlight=False,
size=(self._scroll_width, self._scroll_height), size=(self._scroll_width, self._scroll_height),
position=((self._width - self._scroll_width) * 0.5, 50), position=(
(self._width - self._scroll_width) * 0.5,
(115 if uiscale is bui.UIScale.SMALL else 50) + yoffs,
),
) )
bui.containerwidget(edit=self._scrollwidget, claims_left_right=True) bui.containerwidget(edit=self._scrollwidget, claims_left_right=True)
@ -121,16 +127,6 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
) )
v -= 60 v -= 60
bui.buttonwidget(
parent=self._subcontainer,
position=((self._sub_width - button_width) * 0.5, v),
size=(button_width, 60),
autoselect=True,
label=bui.Lstr(resource=f'{self._r}.runGPUBenchmarkText'),
on_activate_call=self._run_gpu_benchmark_pressed,
)
v -= 60
bui.buttonwidget( bui.buttonwidget(
parent=self._subcontainer, parent=self._subcontainer,
position=((self._sub_width - button_width) * 0.5, v), position=((self._sub_width - button_width) * 0.5, v),
@ -316,7 +312,7 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
label=bui.Lstr(resource=f'{self._r}.runStressTestText'), label=bui.Lstr(resource=f'{self._r}.runStressTestText'),
on_activate_call=self._stress_test_pressed, on_activate_call=self._stress_test_pressed,
) )
bui.widget(btn, show_buffer_bottom=50) bui.widget(edit=btn, show_buffer_bottom=50)
@override @override
def get_main_window_state(self) -> bui.MainWindowState: def get_main_window_state(self) -> bui.MainWindowState:
@ -369,12 +365,6 @@ class BenchmarksAndStressTestsWindow(bui.MainWindow):
return return
bui.app.classic.run_cpu_benchmark() bui.app.classic.run_cpu_benchmark()
def _run_gpu_benchmark_pressed(self) -> None:
if bui.app.classic is None:
logging.warning('run-gpu-benchmark requires classic')
return
bui.app.classic.run_gpu_benchmark()
def _run_media_reload_benchmark_pressed(self) -> None: def _run_media_reload_benchmark_pressed(self) -> None:
if bui.app.classic is None: if bui.app.classic is None:
logging.warning('run-media-reload-benchmark requires classic') logging.warning('run-media-reload-benchmark requires classic')

View File

@ -150,7 +150,7 @@ class ControlsSettingsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=( position=(
0, 0,
height + yoffs - (75 if uiscale is bui.UIScale.SMALL else 50), height + yoffs - (53 if uiscale is bui.UIScale.SMALL else 50),
), ),
size=(width, 25), size=(width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
@ -159,7 +159,7 @@ class ControlsSettingsWindow(bui.MainWindow):
v_align='top', v_align='top',
) )
v = height - 75 + yoffs v = height - (85 if uiscale is bui.UIScale.SMALL else 75) + yoffs
v -= spacing v -= spacing
if show_touch: if show_touch:

View File

@ -92,7 +92,7 @@ class DevToolsWindow(bui.MainWindow):
self._height - (64 if uiscale is bui.UIScale.SMALL else 48), self._height - (64 if uiscale is bui.UIScale.SMALL else 48),
), ),
size=(0, 25), size=(0, 25),
scale=(0.6 if uiscale is bui.UIScale.SMALL else 1.0), scale=(0.8 if uiscale is bui.UIScale.SMALL else 1.0),
maxwidth=self._width - 200, maxwidth=self._width - 200,
text=bui.Lstr(resource='settingsWindowAdvanced.devToolsText'), text=bui.Lstr(resource='settingsWindowAdvanced.devToolsText'),
color=app.ui_v1.title_color, color=app.ui_v1.title_color,

View File

@ -25,6 +25,7 @@ class GamepadSettingsWindow(bui.MainWindow):
def __init__( def __init__(
self, self,
inputdevice: bs.InputDevice, inputdevice: bs.InputDevice,
*,
modal: bool = False, modal: bool = False,
transition: str = 'in_right', transition: str = 'in_right',
transition_out: str = 'out_right', transition_out: str = 'out_right',
@ -744,6 +745,7 @@ class GamepadSettingsWindow(bui.MainWindow):
color: tuple[float, float, float], color: tuple[float, float, float],
texture: bui.Texture, texture: bui.Texture,
button: str, button: str,
*,
scale: float = 1.0, scale: float = 1.0,
message: bui.Lstr | None = None, message: bui.Lstr | None = None,
message2: bui.Lstr | None = None, message2: bui.Lstr | None = None,
@ -955,6 +957,7 @@ class AwaitGamepadInputWindow(bui.Window):
message: bui.Lstr | None = None, message: bui.Lstr | None = None,
message2: bui.Lstr | None = None, message2: bui.Lstr | None = None,
): ):
# pylint: disable=too-many-positional-arguments
if message is None: if message is None:
print('AwaitGamepadInputWindow message is None!') print('AwaitGamepadInputWindow message is None!')
# Shouldn't get here. # Shouldn't get here.

View File

@ -473,6 +473,7 @@ class GamepadAdvancedSettingsWindow(bui.Window):
name: bui.Lstr, name: bui.Lstr,
control: str, control: str,
position: tuple[float, float], position: tuple[float, float],
*,
min_val: float = 0.0, min_val: float = 0.0,
max_val: float = 100.0, max_val: float = 100.0,
increment: float = 1.0, increment: float = 1.0,

View File

@ -271,6 +271,7 @@ class ConfigKeyboardWindow(bui.MainWindow):
button: str, button: str,
scale: float = 1.0, scale: float = 1.0,
) -> None: ) -> None:
# pylint: disable=too-many-positional-arguments
base_size = 79 base_size = 79
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -32,7 +32,9 @@ class NetTestingWindow(bui.MainWindow):
): ):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 820 self._width = 820
self._height = 400 if uiscale is bui.UIScale.SMALL else 500 self._height = 500 if uiscale is bui.UIScale.SMALL else 500
yoffs = -50 if uiscale is bui.UIScale.SMALL else 0
self._printed_lines: list[str] = [] self._printed_lines: list[str] = []
assert bui.app.classic is not None assert bui.app.classic is not None
super().__init__( super().__init__(
@ -53,23 +55,33 @@ class NetTestingWindow(bui.MainWindow):
transition=transition, transition=transition,
origin_widget=origin_widget, origin_widget=origin_widget,
) )
self._done_button: bui.Widget | None = bui.buttonwidget( self._done_button: bui.Widget | None
parent=self._root_widget, if uiscale is bui.UIScale.SMALL:
position=(46, self._height - 77), bui.containerwidget(
size=(60, 60), edit=self._root_widget, on_cancel_call=self.main_window_back
scale=0.9, )
label=bui.charstr(bui.SpecialChar.BACK), self._done_button = None
button_type='backSmall', else:
autoselect=True, self._done_button = bui.buttonwidget(
on_activate_call=self.main_window_back, parent=self._root_widget,
) position=(46, self._height - 77 + yoffs),
size=(60, 60),
scale=0.9,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
autoselect=True,
on_activate_call=self.main_window_back,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._done_button
)
# Avoid squads button on small mode. # Avoid squads button on small mode.
xinset = -50 if uiscale is bui.UIScale.SMALL else 0 xinset = -50 if uiscale is bui.UIScale.SMALL else 0
self._copy_button = bui.buttonwidget( self._copy_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - 200 + xinset, self._height - 77), position=(self._width - 200 + xinset, self._height - 77 + yoffs),
size=(100, 60), size=(100, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -79,7 +91,7 @@ class NetTestingWindow(bui.MainWindow):
self._settings_button = bui.buttonwidget( self._settings_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - 100 + xinset, self._height - 77), position=(self._width - 100 + xinset, self._height - 77 + yoffs),
size=(60, 60), size=(60, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -90,7 +102,7 @@ class NetTestingWindow(bui.MainWindow):
twidth = self._width - 540 twidth = self._width - 540
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 55), position=(self._width * 0.5, self._height - 55 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'), text=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'),
color=(0.8, 0.8, 0.8, 1.0), color=(0.8, 0.8, 0.8, 1.0),
@ -101,24 +113,19 @@ class NetTestingWindow(bui.MainWindow):
self._scroll = bui.scrollwidget( self._scroll = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(50, 50), position=(
size=(self._width - 100, self._height - 140), 50,
(140 if uiscale is bui.UIScale.SMALL else 50) + yoffs,
),
size=(
self._width - 100,
self._height - (220 if uiscale is bui.UIScale.SMALL else 140),
),
capture_arrows=True, capture_arrows=True,
autoselect=True, autoselect=True,
) )
self._rows = bui.columnwidget(parent=self._scroll) self._rows = bui.columnwidget(parent=self._scroll)
if uiscale is bui.UIScale.SMALL:
bui.containerwidget(
edit=self._root_widget, on_cancel_call=self.main_window_back
)
self._done_button.delete()
self._done_button = None
else:
bui.containerwidget(
edit=self._root_widget, cancel_button=self._done_button
)
# Now kick off the tests. # Now kick off the tests.
# Pass a weak-ref to this window so we don't keep it alive # Pass a weak-ref to this window so we don't keep it alive
# if we back out before it completes. Also set is as daemon # if we back out before it completes. Also set is as daemon
@ -169,7 +176,7 @@ class NetTestingWindow(bui.MainWindow):
if not self.main_window_has_control(): if not self.main_window_has_control():
return return
self.main_window_replace(NetValTestingWindow()) self.main_window_replace(get_net_val_testing_window())
def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None: def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None:
@ -461,26 +468,48 @@ def _test_nearby_zone_ping(nearest_zone: tuple[str, float] | None) -> None:
raise RuntimeError('Ping too high.') raise RuntimeError('Ping too high.')
class NetValTestingWindow(TestingWindow): def get_net_val_testing_window() -> TestingWindow:
"""Window to test network related settings.""" """Create a window for testing net values."""
entries = [
{'name': 'bufferTime', 'label': 'Buffer Time', 'increment': 1.0},
{
'name': 'delaySampling',
'label': 'Delay Sampling',
'increment': 1.0,
},
{
'name': 'dynamicsSyncTime',
'label': 'Dynamics Sync Time',
'increment': 10,
},
{'name': 'showNetInfo', 'label': 'Show Net Info', 'increment': 1},
]
return TestingWindow(
title=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'),
entries=entries,
)
def __init__(self, transition: str = 'in_right'):
entries = [ # class NetValTestingWindow(TestingWindow):
{'name': 'bufferTime', 'label': 'Buffer Time', 'increment': 1.0}, # """Window to test network related settings."""
{
'name': 'delaySampling', # def __init__(self, transition: str = 'in_right'):
'label': 'Delay Sampling', # entries = [
'increment': 1.0, # {'name': 'bufferTime', 'label': 'Buffer Time', 'increment': 1.0},
}, # {
{ # 'name': 'delaySampling',
'name': 'dynamicsSyncTime', # 'label': 'Delay Sampling',
'label': 'Dynamics Sync Time', # 'increment': 1.0,
'increment': 10, # },
}, # {
{'name': 'showNetInfo', 'label': 'Show Net Info', 'increment': 1}, # 'name': 'dynamicsSyncTime',
] # 'label': 'Dynamics Sync Time',
super().__init__( # 'increment': 10,
title=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'), # },
entries=entries, # {'name': 'showNetInfo', 'label': 'Show Net Info', 'increment': 1},
transition=transition, # ]
) # super().__init__(
# title=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'),
# entries=entries,
# transition=transition,
# )

View File

@ -44,12 +44,13 @@ class PluginWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 870.0 if uiscale is bui.UIScale.SMALL else 670.0 self._width = 870.0 if uiscale is bui.UIScale.SMALL else 670.0
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
yoffs = -55.0 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
370.0 450.0
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 450.0 if uiscale is bui.UIScale.MEDIUM else 520.0 else 450.0 if uiscale is bui.UIScale.MEDIUM else 520.0
) )
top_extra = 10 if uiscale is bui.UIScale.SMALL else 0 top_extra = 0 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height + top_extra),
@ -64,7 +65,7 @@ class PluginWindow(bui.MainWindow):
else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -25) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -72,7 +73,9 @@ class PluginWindow(bui.MainWindow):
) )
self._scroll_width = self._width - (100 + 2 * x_inset) self._scroll_width = self._width - (100 + 2 * x_inset)
self._scroll_height = self._height - 115.0 self._scroll_height = self._height - (
200.0 if uiscale is bui.UIScale.SMALL else 115.0
)
self._sub_width = self._scroll_width * 0.95 self._sub_width = self._scroll_width * 0.95
self._sub_height = 724.0 self._sub_height = 724.0
@ -85,7 +88,7 @@ class PluginWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(53 + x_inset, self._height - 60), position=(53 + x_inset, self._height - 60 + yoffs),
size=(140, 60), size=(140, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -99,7 +102,7 @@ class PluginWindow(bui.MainWindow):
self._title_text = bui.textwidget( self._title_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 41), position=(self._width * 0.5, self._height - 41 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource='pluginsText'), text=bui.Lstr(resource='pluginsText'),
color=app.ui_v1.title_color, color=app.ui_v1.title_color,
@ -120,7 +123,7 @@ class PluginWindow(bui.MainWindow):
self._num_plugins_text = bui.textwidget( self._num_plugins_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(settings_button_x - 130, self._height - 41), position=(settings_button_x - 130, self._height - 41 + yoffs),
size=(0, 0), size=(0, 0),
text='', text='',
h_align='center', h_align='center',
@ -130,7 +133,7 @@ class PluginWindow(bui.MainWindow):
self._category_button = bui.buttonwidget( self._category_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
scale=0.7, scale=0.7,
position=(settings_button_x - 105, self._height - 60), position=(settings_button_x - 105, self._height - 60 + yoffs),
size=(130, 60), size=(130, 60),
label=bui.Lstr(resource='allText'), label=bui.Lstr(resource='allText'),
autoselect=True, autoselect=True,
@ -141,7 +144,7 @@ class PluginWindow(bui.MainWindow):
self._settings_button = bui.buttonwidget( self._settings_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(settings_button_x, self._height - 58), position=(settings_button_x, self._height - 58 + yoffs),
size=(40, 40), size=(40, 40),
label='', label='',
on_activate_call=self._open_settings, on_activate_call=self._open_settings,
@ -149,7 +152,7 @@ class PluginWindow(bui.MainWindow):
bui.imagewidget( bui.imagewidget(
parent=self._root_widget, parent=self._root_widget,
position=(settings_button_x + 3, self._height - 57), position=(settings_button_x + 3, self._height - 57 + yoffs),
draw_controller=self._settings_button, draw_controller=self._settings_button,
size=(35, 35), size=(35, 35),
texture=bui.gettexture('settingsIcon'), texture=bui.gettexture('settingsIcon'),
@ -163,7 +166,10 @@ class PluginWindow(bui.MainWindow):
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(50 + x_inset, 50), position=(
50 + x_inset,
(135 if uiscale is bui.UIScale.SMALL else 50) + yoffs,
),
simple_culling_v=20.0, simple_culling_v=20.0,
highlight=False, highlight=False,
size=(self._scroll_width, self._scroll_height), size=(self._scroll_width, self._scroll_height),

View File

@ -21,17 +21,13 @@ class PluginSettingsWindow(bui.MainWindow):
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 670.0 if uiscale is bui.UIScale.SMALL else 470.0 width = 750.0 if uiscale is bui.UIScale.SMALL else 470.0
height = ( height = 400.0 if uiscale is bui.UIScale.SMALL else 300.0
365.0 yoffs = -20 if uiscale is bui.UIScale.SMALL else 0
if uiscale is bui.UIScale.SMALL
else 300.0 if uiscale is bui.UIScale.MEDIUM else 370.0
)
top_extra = 10 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(width, height + top_extra), size=(width, height),
toolbar_visibility=( toolbar_visibility=(
'menu_minimal' 'menu_minimal'
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
@ -43,7 +39,7 @@ class PluginSettingsWindow(bui.MainWindow):
else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -25) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -51,7 +47,7 @@ class PluginSettingsWindow(bui.MainWindow):
) )
if uiscale is bui.UIScale.SMALL: if uiscale is bui.UIScale.SMALL:
xoffs = 90 xoffs = 135
self._back_button = bui.get_special_widget('back_button') self._back_button = bui.get_special_widget('back_button')
bui.containerwidget( bui.containerwidget(
edit=self._root_widget, on_cancel_call=self.main_window_back edit=self._root_widget, on_cancel_call=self.main_window_back
@ -60,7 +56,7 @@ class PluginSettingsWindow(bui.MainWindow):
xoffs = 0 xoffs = 0
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(53, height - 60), position=(53, height - 60 + yoffs),
size=(60, 60), size=(60, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -76,7 +72,7 @@ class PluginSettingsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=( position=(
width * 0.5, width * 0.5,
height - (45 if uiscale is bui.UIScale.SMALL else 35), height - (55 if uiscale is bui.UIScale.SMALL else 35) + yoffs,
), ),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource='pluginSettingsText'), text=bui.Lstr(resource='pluginSettingsText'),
@ -85,10 +81,10 @@ class PluginSettingsWindow(bui.MainWindow):
v_align='center', v_align='center',
) )
self._y_position = 170 if uiscale is bui.UIScale.MEDIUM else 205 self._y_position = height - 140 + yoffs
self._enable_plugins_button = bui.buttonwidget( self._enable_plugins_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(xoffs + 65, self._y_position), position=(xoffs + 65, self._y_position + yoffs),
size=(350, 60), size=(350, 60),
autoselect=True, autoselect=True,
label=bui.Lstr(resource='pluginsEnableAllText'), label=bui.Lstr(resource='pluginsEnableAllText'),
@ -101,7 +97,7 @@ class PluginSettingsWindow(bui.MainWindow):
self._y_position -= 70 self._y_position -= 70
self._disable_plugins_button = bui.buttonwidget( self._disable_plugins_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(xoffs + 65, self._y_position), position=(xoffs + 65, self._y_position + yoffs),
size=(350, 60), size=(350, 60),
autoselect=True, autoselect=True,
label=bui.Lstr(resource='pluginsDisableAllText'), label=bui.Lstr(resource='pluginsDisableAllText'),
@ -114,7 +110,7 @@ class PluginSettingsWindow(bui.MainWindow):
self._y_position -= 70 self._y_position -= 70
self._enable_new_plugins_check_box = bui.checkboxwidget( self._enable_new_plugins_check_box = bui.checkboxwidget(
parent=self._root_widget, parent=self._root_widget,
position=(xoffs + 65, self._y_position), position=(xoffs + 65, self._y_position + yoffs),
size=(350, 60), size=(350, 60),
value=bui.app.config.get( value=bui.app.config.get(
bui.app.plugins.AUTO_ENABLE_NEW_PLUGINS_CONFIG_KEY, bui.app.plugins.AUTO_ENABLE_NEW_PLUGINS_CONFIG_KEY,

View File

@ -21,7 +21,8 @@ class RemoteAppSettingsWindow(bui.MainWindow):
app = bui.app app = bui.app
uiscale = app.ui_v1.uiscale uiscale = app.ui_v1.uiscale
width = 800 if uiscale is bui.UIScale.SMALL else 700 width = 800 if uiscale is bui.UIScale.SMALL else 700
height = 390 height = 480 if uiscale is bui.UIScale.SMALL else 390
yoffs = -48 if uiscale is bui.UIScale.SMALL else 0
spacing = 40 spacing = 40
assert bui.app.classic is not None assert bui.app.classic is not None
super().__init__( super().__init__(
@ -33,12 +34,12 @@ class RemoteAppSettingsWindow(bui.MainWindow):
else 'menu_full' else 'menu_full'
), ),
scale=( scale=(
1.76 1.75
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(-10, 0) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -52,7 +53,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
else: else:
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(40, height - 67), position=(40, height - 67 + yoffs),
size=(140, 65), size=(140, 65),
scale=0.8, scale=0.8,
label=bui.Lstr(resource='backText'), label=bui.Lstr(resource='backText'),
@ -71,7 +72,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, height - 42), position=(width * 0.5, height - 42 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
maxwidth=370, maxwidth=370,
@ -85,7 +86,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
v -= spacing * 1.2 v -= spacing * 1.2
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(15, v - 26), position=(15, v - 26 + yoffs),
size=(width - 30, 30), size=(width - 30, 30),
maxwidth=width * 0.95, maxwidth=width * 0.95,
color=(0.7, 0.9, 0.7, 1.0), color=(0.7, 0.9, 0.7, 1.0),
@ -106,7 +107,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
# Update: now we just show link to the remote webpage. # Update: now we just show link to the remote webpage.
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, v + 5), position=(width * 0.5, v + 5 + yoffs),
size=(0, 0), size=(0, 0),
color=(0.7, 0.9, 0.7, 1.0), color=(0.7, 0.9, 0.7, 1.0),
scale=1.4, scale=1.4,
@ -120,7 +121,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, v - 35), position=(width * 0.5, v - 35 + yoffs),
size=(0, 0), size=(0, 0),
color=(0.7, 0.9, 0.7, 0.8), color=(0.7, 0.9, 0.7, 0.8),
scale=0.65, scale=0.65,
@ -133,7 +134,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
bui.checkboxwidget( bui.checkboxwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5 - 150, v - 116), position=(width * 0.5 - 150, v - 116 + yoffs),
size=(300, 30), size=(300, 30),
maxwidth=300, maxwidth=300,
scale=0.8, scale=0.8,

View File

@ -5,7 +5,7 @@
from __future__ import annotations from __future__ import annotations
import copy import copy
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, override
import bauiv1 as bui import bauiv1 as bui
@ -25,9 +25,12 @@ class TestingWindow(bui.MainWindow):
): ):
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 700 if uiscale is bui.UIScale.SMALL else 600 self._width = 690 if uiscale is bui.UIScale.SMALL else 600
self._height = 324 if uiscale is bui.UIScale.SMALL else 400 self._height = 400 if uiscale is bui.UIScale.SMALL else 400
self._entries_orig = copy.deepcopy(entries)
self._entries = copy.deepcopy(entries) self._entries = copy.deepcopy(entries)
yoffs = -50 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
@ -37,7 +40,7 @@ class TestingWindow(bui.MainWindow):
else 1.2 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.2 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -20) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
toolbar_visibility=( toolbar_visibility=(
'menu_minimal' 'menu_minimal'
@ -58,7 +61,7 @@ class TestingWindow(bui.MainWindow):
self._back_button = btn = bui.buttonwidget( self._back_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
autoselect=True, autoselect=True,
position=(65, self._height - 59), position=(65, self._height - 59 + yoffs),
size=(130, 60), size=(130, 60),
scale=0.8, scale=0.8,
text_scale=1.2, text_scale=1.2,
@ -74,25 +77,30 @@ class TestingWindow(bui.MainWindow):
) )
bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.containerwidget(edit=self._root_widget, cancel_button=btn)
self.title = title
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=( position=(
self._width * 0.5, self._width * 0.5,
self._height - (42 if uiscale is bui.UIScale.SMALL else 35), self._height
- (42 if uiscale is bui.UIScale.SMALL else 35)
+ yoffs,
), ),
size=(0, 0), size=(0, 0),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
h_align='center', h_align='center',
v_align='center', v_align='center',
maxwidth=245, maxwidth=245,
text=title, text=self.title,
) )
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=( position=(
self._width * 0.5, self._width * 0.5,
self._height - (80 if uiscale is bui.UIScale.SMALL else 80), self._height
- (80 if uiscale is bui.UIScale.SMALL else 80)
+ yoffs,
), ),
size=(0, 0), size=(0, 0),
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
@ -102,12 +110,17 @@ class TestingWindow(bui.MainWindow):
text=bui.Lstr(resource='settingsWindowAdvanced.forTestingText'), text=bui.Lstr(resource='settingsWindowAdvanced.forTestingText'),
) )
self._scroll_width = self._width - 130 self._scroll_width = self._width - 130
self._scroll_height = self._height - 140 self._scroll_height = self._height - (
220 if uiscale is bui.UIScale.SMALL else 140
)
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
size=(self._scroll_width, self._scroll_height), size=(self._scroll_width, self._scroll_height),
highlight=False, highlight=False,
position=((self._width - self._scroll_width) * 0.5, 40), position=(
(self._width - self._scroll_width) * 0.5,
(120 if uiscale is bui.UIScale.SMALL else 40) + yoffs,
),
) )
bui.containerwidget(edit=self._scrollwidget, claims_left_right=True) bui.containerwidget(edit=self._scrollwidget, claims_left_right=True)
@ -226,3 +239,22 @@ class TestingWindow(bui.MainWindow):
edit=entry['widget'], edit=entry['widget'],
text='%.4g' % bui.app.classic.value_test(entry['name']), text='%.4g' % bui.app.classic.value_test(entry['name']),
) )
@override
def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes.
cls = type(self)
# Pull values from self here; if we do it in the lambda we'll keep
# self alive which we don't want.
title = self.title
entries = self._entries_orig
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
title=title,
entries=entries,
transition=transition,
origin_widget=origin_widget,
)
)

View File

@ -25,19 +25,21 @@ class SoundtrackBrowserWindow(bui.MainWindow):
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-locals
self._r = 'editSoundtrackWindow' self._r = 'editSoundtrackWindow'
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 800 if uiscale is bui.UIScale.SMALL else 600 self._width = 800 if uiscale is bui.UIScale.SMALL else 600
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
340 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 370 if uiscale is bui.UIScale.MEDIUM else 440 else 370 if uiscale is bui.UIScale.MEDIUM else 440
) )
spacing = 40.0 spacing = 40.0
v = self._height - 40.0 v = self._height - 40.0 + yoffs
v -= spacing * 1.0 v -= spacing * 1.0
super().__init__( super().__init__(
@ -54,7 +56,7 @@ class SoundtrackBrowserWindow(bui.MainWindow):
else 1.6 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.6 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -18) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -67,7 +69,7 @@ class SoundtrackBrowserWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(45 + x_inset, self._height - 60), position=(45 + x_inset, self._height - 60 + yoffs),
size=(120, 60), size=(120, 60),
scale=0.8, scale=0.8,
label=bui.Lstr(resource='backText'), label=bui.Lstr(resource='backText'),
@ -82,7 +84,12 @@ class SoundtrackBrowserWindow(bui.MainWindow):
) )
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 35), position=(
self._width * 0.5,
self._height
- (46 if uiscale is bui.UIScale.SMALL else 35)
+ yoffs,
),
size=(0, 0), size=(0, 0),
maxwidth=300, maxwidth=300,
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
@ -92,7 +99,7 @@ class SoundtrackBrowserWindow(bui.MainWindow):
) )
h = 43 + x_inset h = 43 + x_inset
v = self._height - 60 v = self._height - 60 + yoffs
b_color = (0.6, 0.53, 0.63) b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
lock_tex = bui.gettexture('lock') lock_tex = bui.gettexture('lock')
@ -222,8 +229,10 @@ class SoundtrackBrowserWindow(bui.MainWindow):
) )
self._update() self._update()
v = self._height - 65 v = self._height - 65 + yoffs
scroll_height = self._height - 105 scroll_height = self._height - (
160 if uiscale is bui.UIScale.SMALL else 105
)
v -= scroll_height v -= scroll_height
self._scrollwidget = scrollwidget = bui.scrollwidget( self._scrollwidget = scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -35,10 +35,12 @@ class SoundtrackEditWindow(bui.MainWindow):
self._width = 900 if uiscale is bui.UIScale.SMALL else 648 self._width = 900 if uiscale is bui.UIScale.SMALL else 648
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
395 450
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 450 if uiscale is bui.UIScale.MEDIUM else 560 else 450 if uiscale is bui.UIScale.MEDIUM else 560
) )
yoffs = -48 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
@ -48,7 +50,7 @@ class SoundtrackEditWindow(bui.MainWindow):
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -37) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -58,7 +60,7 @@ class SoundtrackEditWindow(bui.MainWindow):
) )
cancel_button = bui.buttonwidget( cancel_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(38 + x_inset, self._height - 60), position=(38 + x_inset, self._height - 60 + yoffs),
size=(160, 60), size=(160, 60),
autoselect=True, autoselect=True,
label=bui.Lstr(resource='cancelText'), label=bui.Lstr(resource='cancelText'),
@ -66,7 +68,7 @@ class SoundtrackEditWindow(bui.MainWindow):
) )
save_button = bui.buttonwidget( save_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - (168 + x_inset), self._height - 60), position=(self._width - (168 + x_inset), self._height - 60 + yoffs),
autoselect=True, autoselect=True,
size=(160, 60), size=(160, 60),
label=bui.Lstr(resource='saveText'), label=bui.Lstr(resource='saveText'),
@ -76,7 +78,7 @@ class SoundtrackEditWindow(bui.MainWindow):
bui.widget(edit=cancel_button, right_widget=save_button) bui.widget(edit=cancel_button, right_widget=save_button)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, self._height - 50), position=(0, self._height - 50 + yoffs),
size=(self._width, 25), size=(self._width, 25),
text=bui.Lstr( text=bui.Lstr(
resource=self._r resource=self._r
@ -91,7 +93,7 @@ class SoundtrackEditWindow(bui.MainWindow):
v_align='center', v_align='center',
maxwidth=280, maxwidth=280,
) )
v = self._height - 110 v = self._height - 110 + yoffs
if 'Soundtracks' not in appconfig: if 'Soundtracks' not in appconfig:
appconfig['Soundtracks'] = {} appconfig['Soundtracks'] = {}
@ -165,7 +167,9 @@ class SoundtrackEditWindow(bui.MainWindow):
on_return_press_call=self._do_it_with_sound, on_return_press_call=self._do_it_with_sound,
) )
scroll_height = self._height - 180 scroll_height = self._height - (
230 if uiscale is bui.UIScale.SMALL else 180
)
self._scrollwidget = scrollwidget = bui.scrollwidget( self._scrollwidget = scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
highlight=False, highlight=False,

View File

@ -20,6 +20,7 @@ class SoundtrackEntryTypeSelectWindow(bui.MainWindow):
callback: Callable[[Any], Any], callback: Callable[[Any], Any],
current_entry: Any, current_entry: Any,
selection_target_name: str, selection_target_name: str,
*,
transition: str | None = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):

View File

@ -21,6 +21,7 @@ class MacMusicAppPlaylistSelectWindow(bui.MainWindow):
callback: Callable[[Any], Any], callback: Callable[[Any], Any],
existing_playlist: str | None, existing_playlist: str | None,
existing_entry: Any, existing_entry: Any,
*,
transition: str | None = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):

View File

@ -23,6 +23,7 @@ class StoreButton:
position: Sequence[float], position: Sequence[float],
size: Sequence[float], size: Sequence[float],
scale: float, scale: float,
*,
on_activate_call: Callable[[], Any] | None = None, on_activate_call: Callable[[], Any] | None = None,
transition_delay: float | None = None, transition_delay: float | None = None,
color: Sequence[float] | None = None, color: Sequence[float] | None = None,

View File

@ -19,6 +19,7 @@ def instantiate_store_item_display(
b_pos: tuple[float, float], b_pos: tuple[float, float],
b_width: float, b_width: float,
b_height: float, b_height: float,
*,
boffs_h: float = 0.0, boffs_h: float = 0.0,
boffs_h2: float = 0.0, boffs_h2: float = 0.0,
boffs_v2: float = 0, boffs_v2: float = 0,
@ -26,6 +27,7 @@ def instantiate_store_item_display(
button: bool = True, button: bool = True,
) -> None: ) -> None:
"""(internal)""" """(internal)"""
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-locals # pylint: disable=too-many-locals

Some files were not shown because too many files have changed in this diff Show More