mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-03-23 02:35:49 +08:00
Added ba.app.ui subsystem to contain ui globals/functionality
This commit is contained in:
parent
9b94e8e40b
commit
3891394831
@ -4135,16 +4135,16 @@
|
|||||||
"assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f",
|
"assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f",
|
||||||
"assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338",
|
"assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338",
|
||||||
"assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933",
|
"assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933",
|
||||||
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4d/52/c1c1011ac6286950129ecfe641c2",
|
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6b/65/84b0f5e6f03ae3e281b3e7c84c33",
|
||||||
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4f/46/90e28db5c4a563bda000e2df2807",
|
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/4c/48a8d74829812edbe484a3a00647",
|
||||||
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/dd/b5/c197989dd4e61498dda75f51759c",
|
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d1/e4/0a2390a2af7b50738e276214f7aa",
|
||||||
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b8/24/1da2eb6ecdbac963dc31fc258a1d",
|
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5e/33/7ce61884d65810d479d8a8f18845",
|
||||||
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f7/63/a9c21960f84b2d7f40418e66d4c8",
|
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e5/de/aa7c8e010f8cba5559d7c2df953b",
|
||||||
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a2/8e/e489beaf13382d65c6c4a39e77e3",
|
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ed/a1/75bbe8e63775056fb82fe4a3c5b9",
|
||||||
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/80/c4/4b4f75b4ae6d887f19ef2ec0f4b5",
|
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/65/64/f754cc64bdb97aae0ecfde4b14a9",
|
||||||
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/22/ba/e61af862b2d2c138a848583f74a6",
|
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b6/ff/57211cac20b87dc6aec10fbb5e6d",
|
||||||
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d5/1a/7061d9ff66993841317369cce4dd",
|
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/e0/9c/e781f97fe6b81e373e7524784d3b",
|
||||||
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/a4/9f/5f3308d5dda1d6f8fb3b51389e05",
|
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/01/dd/4747a402c2f635a31a70a305c48e",
|
||||||
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/bc/0f/7fd42fceaa297e0e67ed18566d3e",
|
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/80/26/de8bc04e6d4097583ea98df9eb35",
|
||||||
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/9b/c7/9756a8f6ef5237f1418cabfb6154"
|
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/6f/b3/72fc80d493249f1a0085f29f5db4"
|
||||||
}
|
}
|
||||||
4
.idea/dictionaries/ericf.xml
generated
4
.idea/dictionaries/ericf.xml
generated
@ -316,6 +316,7 @@
|
|||||||
<w>classnames</w>
|
<w>classnames</w>
|
||||||
<w>cleancheck</w>
|
<w>cleancheck</w>
|
||||||
<w>cleanlist</w>
|
<w>cleanlist</w>
|
||||||
|
<w>cleanupchecks</w>
|
||||||
<w>clientid</w>
|
<w>clientid</w>
|
||||||
<w>clientlist</w>
|
<w>clientlist</w>
|
||||||
<w>clionbin</w>
|
<w>clionbin</w>
|
||||||
@ -715,6 +716,8 @@
|
|||||||
<w>fprint</w>
|
<w>fprint</w>
|
||||||
<w>fproject</w>
|
<w>fproject</w>
|
||||||
<w>fpsc</w>
|
<w>fpsc</w>
|
||||||
|
<w>frameinfo</w>
|
||||||
|
<w>frameline</w>
|
||||||
<w>framerate</w>
|
<w>framerate</w>
|
||||||
<w>freefly</w>
|
<w>freefly</w>
|
||||||
<w>freeforallendscreen</w>
|
<w>freeforallendscreen</w>
|
||||||
@ -2110,6 +2113,7 @@
|
|||||||
<w>updatethencheck</w>
|
<w>updatethencheck</w>
|
||||||
<w>updatethencheckfast</w>
|
<w>updatethencheckfast</w>
|
||||||
<w>updatethencheckfull</w>
|
<w>updatethencheckfull</w>
|
||||||
|
<w>upkeeptimer</w>
|
||||||
<w>uploadargs</w>
|
<w>uploadargs</w>
|
||||||
<w>uploadcmd</w>
|
<w>uploadcmd</w>
|
||||||
<w>uptime</w>
|
<w>uptime</w>
|
||||||
|
|||||||
@ -53,6 +53,7 @@
|
|||||||
"ba_data/python/ba/__pycache__/_teamgame.cpython-37.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_teamgame.cpython-37.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_tips.cpython-37.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_tips.cpython-37.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/_tournament.cpython-37.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/_tournament.cpython-37.opt-1.pyc",
|
||||||
|
"ba_data/python/ba/__pycache__/_ui.cpython-37.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/deprecated.cpython-37.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/deprecated.cpython-37.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/internal.cpython-37.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/internal.cpython-37.opt-1.pyc",
|
||||||
"ba_data/python/ba/__pycache__/macmusicapp.cpython-37.opt-1.pyc",
|
"ba_data/python/ba/__pycache__/macmusicapp.cpython-37.opt-1.pyc",
|
||||||
@ -110,6 +111,7 @@
|
|||||||
"ba_data/python/ba/_teamgame.py",
|
"ba_data/python/ba/_teamgame.py",
|
||||||
"ba_data/python/ba/_tips.py",
|
"ba_data/python/ba/_tips.py",
|
||||||
"ba_data/python/ba/_tournament.py",
|
"ba_data/python/ba/_tournament.py",
|
||||||
|
"ba_data/python/ba/_ui.py",
|
||||||
"ba_data/python/ba/deprecated.py",
|
"ba_data/python/ba/deprecated.py",
|
||||||
"ba_data/python/ba/internal.py",
|
"ba_data/python/ba/internal.py",
|
||||||
"ba_data/python/ba/macmusicapp.py",
|
"ba_data/python/ba/macmusicapp.py",
|
||||||
|
|||||||
@ -202,6 +202,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
|
|||||||
build/ba_data/python/ba/_teamgame.py \
|
build/ba_data/python/ba/_teamgame.py \
|
||||||
build/ba_data/python/ba/_tips.py \
|
build/ba_data/python/ba/_tips.py \
|
||||||
build/ba_data/python/ba/_tournament.py \
|
build/ba_data/python/ba/_tournament.py \
|
||||||
|
build/ba_data/python/ba/_ui.py \
|
||||||
build/ba_data/python/ba/deprecated.py \
|
build/ba_data/python/ba/deprecated.py \
|
||||||
build/ba_data/python/ba/internal.py \
|
build/ba_data/python/ba/internal.py \
|
||||||
build/ba_data/python/ba/macmusicapp.py \
|
build/ba_data/python/ba/macmusicapp.py \
|
||||||
@ -433,6 +434,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
|
|||||||
build/ba_data/python/ba/__pycache__/_teamgame.cpython-37.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_teamgame.cpython-37.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_tips.cpython-37.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_tips.cpython-37.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/_tournament.cpython-37.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/_tournament.cpython-37.opt-1.pyc \
|
||||||
|
build/ba_data/python/ba/__pycache__/_ui.cpython-37.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/deprecated.cpython-37.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/deprecated.cpython-37.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/internal.cpython-37.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/internal.cpython-37.opt-1.pyc \
|
||||||
build/ba_data/python/ba/__pycache__/macmusicapp.cpython-37.opt-1.pyc \
|
build/ba_data/python/ba/__pycache__/macmusicapp.cpython-37.opt-1.pyc \
|
||||||
|
|||||||
@ -2965,7 +2965,7 @@ def newactivity(activity_type: Type[ba.Activity],
|
|||||||
Category: General Utility Functions
|
Category: General Utility Functions
|
||||||
|
|
||||||
Activities require special setup and thus cannot be directly
|
Activities require special setup and thus cannot be directly
|
||||||
instantiated; You must go through this function.
|
instantiated; you must go through this function.
|
||||||
"""
|
"""
|
||||||
import ba # pylint: disable=cyclic-import
|
import ba # pylint: disable=cyclic-import
|
||||||
return ba.Activity(settings={})
|
return ba.Activity(settings={})
|
||||||
|
|||||||
@ -262,6 +262,7 @@ class App:
|
|||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
from ba._music import MusicController
|
from ba._music import MusicController
|
||||||
from ba._enums import UIScale
|
from ba._enums import UIScale
|
||||||
|
from ba._ui import UI
|
||||||
|
|
||||||
# Config.
|
# Config.
|
||||||
self.config_file_healthy = False
|
self.config_file_healthy = False
|
||||||
@ -397,20 +398,12 @@ class App:
|
|||||||
self.coop_session_args: Dict = {}
|
self.coop_session_args: Dict = {}
|
||||||
|
|
||||||
# UI.
|
# UI.
|
||||||
self.uicontroller: Optional[ba.UIController] = None
|
self.ui = UI()
|
||||||
self.main_menu_window: Optional[_ba.Widget] = None # FIXME: Kill this.
|
|
||||||
self.window_states: Dict = {} # FIXME: Kill this.
|
|
||||||
self.windows: Dict = {} # FIXME: Kill this.
|
|
||||||
self.main_window: Optional[str] = None # FIXME: Kill this.
|
|
||||||
self.main_menu_selection: Optional[str] = None # FIXME: Kill this.
|
|
||||||
self.have_party_queue_window = False
|
|
||||||
self.quit_window: Any = None
|
|
||||||
self.dismiss_wii_remotes_window_call: (Optional[Callable[[],
|
|
||||||
Any]]) = None
|
|
||||||
self.value_test_defaults: dict = {}
|
self.value_test_defaults: dict = {}
|
||||||
self.main_menu_window_refresh_check_count = 0
|
|
||||||
self.first_main_menu = True # FIXME: Move to mainmenu class.
|
self.first_main_menu = True # FIXME: Move to mainmenu class.
|
||||||
self.did_menu_intro = False # FIXME: Move to mainmenu class.
|
self.did_menu_intro = False # FIXME: Move to mainmenu class.
|
||||||
|
self.main_menu_window_refresh_check_count = 0 # FIXME: Mv to mainmenu.
|
||||||
self.main_menu_resume_callbacks: list = [] # Can probably go away.
|
self.main_menu_resume_callbacks: list = [] # Can probably go away.
|
||||||
self.special_offer: Optional[Dict] = None
|
self.special_offer: Optional[Dict] = None
|
||||||
self.league_rank_cache: Dict = {}
|
self.league_rank_cache: Dict = {}
|
||||||
@ -422,13 +415,6 @@ class App:
|
|||||||
self.store_items: Optional[Dict[str, Dict]] = None
|
self.store_items: Optional[Dict[str, Dict]] = None
|
||||||
self.pro_sale_start_time: Optional[int] = None
|
self.pro_sale_start_time: Optional[int] = None
|
||||||
self.pro_sale_start_val: Optional[int] = None
|
self.pro_sale_start_val: Optional[int] = None
|
||||||
self.party_window: Any = None # FIXME: Don't use Any.
|
|
||||||
self.title_color = (0.72, 0.7, 0.75)
|
|
||||||
self.heading_color = (0.72, 0.7, 0.75)
|
|
||||||
self.infotextcolor = (0.7, 0.9, 0.7)
|
|
||||||
self.uicleanupchecks: List[UICleanupCheck] = []
|
|
||||||
self.uiupkeeptimer: Optional[ba.Timer] = None
|
|
||||||
self.toolbars = env.get('toolbar_test', True)
|
|
||||||
|
|
||||||
self.delegate: Optional[ba.AppDelegate] = None
|
self.delegate: Optional[ba.AppDelegate] = None
|
||||||
|
|
||||||
@ -442,7 +428,6 @@ class App:
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from ba import _apputils
|
from ba import _apputils
|
||||||
from ba import _appconfig
|
from ba import _appconfig
|
||||||
from ba.ui import UIController, ui_upkeep
|
|
||||||
from ba import _achievement
|
from ba import _achievement
|
||||||
from ba import _map
|
from ba import _map
|
||||||
from ba import _meta
|
from ba import _meta
|
||||||
@ -456,7 +441,8 @@ class App:
|
|||||||
|
|
||||||
self.delegate = appdelegate.AppDelegate()
|
self.delegate = appdelegate.AppDelegate()
|
||||||
|
|
||||||
self.uicontroller = UIController()
|
self.ui.on_app_launch()
|
||||||
|
|
||||||
_achievement.init_achievements()
|
_achievement.init_achievements()
|
||||||
spazappearance.register_appearances()
|
spazappearance.register_appearances()
|
||||||
_campaign.init_campaigns()
|
_campaign.init_campaigns()
|
||||||
@ -478,13 +464,6 @@ class App:
|
|||||||
and not _ba.is_blessed()):
|
and not _ba.is_blessed()):
|
||||||
_ba.screenmessage('WARNING: NON-BLESSED BUILD', color=(1, 0, 0))
|
_ba.screenmessage('WARNING: NON-BLESSED BUILD', color=(1, 0, 0))
|
||||||
|
|
||||||
# Kick off our periodic UI upkeep.
|
|
||||||
# FIXME: Can probably kill this if we do immediate UI death checks.
|
|
||||||
self.uiupkeeptimer = _ba.Timer(2.6543,
|
|
||||||
ui_upkeep,
|
|
||||||
timetype=TimeType.REAL,
|
|
||||||
repeat=True)
|
|
||||||
|
|
||||||
# IMPORTANT: If tweaking UI stuff, make sure it behaves for small,
|
# IMPORTANT: If tweaking UI stuff, make sure it behaves for small,
|
||||||
# medium, and large UI modes. (doesn't run off screen, etc).
|
# medium, and large UI modes. (doesn't run off screen, etc).
|
||||||
# The overrides below can be used to test with different sizes.
|
# The overrides below can be used to test with different sizes.
|
||||||
@ -648,7 +627,7 @@ class App:
|
|||||||
from ba._general import Call
|
from ba._general import Call
|
||||||
from bastd.mainmenu import MainMenuSession
|
from bastd.mainmenu import MainMenuSession
|
||||||
if reset_ui:
|
if reset_ui:
|
||||||
_ba.app.main_window = None
|
_ba.app.ui.clear_main_menu_window()
|
||||||
|
|
||||||
if isinstance(_ba.get_foreground_host_session(), MainMenuSession):
|
if isinstance(_ba.get_foreground_host_session(), MainMenuSession):
|
||||||
# It may be possible we're on the main menu but the screen is faded
|
# It may be possible we're on the main menu but the screen is faded
|
||||||
@ -681,7 +660,7 @@ class App:
|
|||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
|
|
||||||
# If there's no main menu up, just call immediately.
|
# If there's no main menu up, just call immediately.
|
||||||
if not self.main_menu_window:
|
if not self.ui.has_main_menu_window():
|
||||||
with _ba.Context('ui'):
|
with _ba.Context('ui'):
|
||||||
call()
|
call()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -423,8 +423,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
|
|||||||
# Only attempt this if we're not currently paused
|
# Only attempt this if we're not currently paused
|
||||||
# and there appears to be no UI.
|
# and there appears to be no UI.
|
||||||
if (not gnode.paused
|
if (not gnode.paused
|
||||||
and _ba.app.main_menu_window is None
|
and not _ba.app.ui.has_main_menu_window()):
|
||||||
or not _ba.app.main_menu_window):
|
|
||||||
self._is_waiting_for_continue = True
|
self._is_waiting_for_continue = True
|
||||||
with _ba.Context('ui'):
|
with _ba.Context('ui'):
|
||||||
_ba.timer(
|
_ba.timer(
|
||||||
|
|||||||
@ -180,7 +180,7 @@ def purchases_restored_message() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def dismiss_wii_remotes_window() -> None:
|
def dismiss_wii_remotes_window() -> None:
|
||||||
call = _ba.app.dismiss_wii_remotes_window_call
|
call = _ba.app.ui.dismiss_wii_remotes_window_call
|
||||||
if call is not None:
|
if call is not None:
|
||||||
call()
|
call()
|
||||||
|
|
||||||
@ -256,10 +256,10 @@ def party_icon_activate(origin: Sequence[float]) -> None:
|
|||||||
_ba.playsound(_ba.getsound('swish'))
|
_ba.playsound(_ba.getsound('swish'))
|
||||||
|
|
||||||
# If it exists, dismiss it; otherwise make a new one.
|
# If it exists, dismiss it; otherwise make a new one.
|
||||||
if app.party_window is not None and app.party_window() is not None:
|
if app.ui.party_window is not None and app.ui.party_window() is not None:
|
||||||
app.party_window().close()
|
app.ui.party_window().close()
|
||||||
else:
|
else:
|
||||||
app.party_window = weakref.ref(PartyWindow(origin=origin))
|
app.ui.party_window = weakref.ref(PartyWindow(origin=origin))
|
||||||
|
|
||||||
|
|
||||||
def read_config() -> None:
|
def read_config() -> None:
|
||||||
@ -303,11 +303,11 @@ def gc_disable() -> None:
|
|||||||
|
|
||||||
def device_menu_press(device: ba.InputDevice) -> None:
|
def device_menu_press(device: ba.InputDevice) -> None:
|
||||||
from bastd.ui.mainmenu import MainMenuWindow
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
in_main_menu = bool(_ba.app.main_menu_window)
|
in_main_menu = _ba.app.ui.has_main_menu_window()
|
||||||
if not in_main_menu:
|
if not in_main_menu:
|
||||||
_ba.set_ui_input_device(device)
|
_ba.set_ui_input_device(device)
|
||||||
_ba.playsound(_ba.getsound('swish'))
|
_ba.playsound(_ba.getsound('swish'))
|
||||||
_ba.app.main_menu_window = (MainMenuWindow().get_root_widget())
|
_ba.app.ui.set_main_menu_window(MainMenuWindow().get_root_widget())
|
||||||
|
|
||||||
|
|
||||||
def show_url_window(address: str) -> None:
|
def show_url_window(address: str) -> None:
|
||||||
@ -338,9 +338,9 @@ def filter_chat_message(msg: str, client_id: int) -> Optional[str]:
|
|||||||
|
|
||||||
|
|
||||||
def local_chat_message(msg: str) -> None:
|
def local_chat_message(msg: str) -> None:
|
||||||
if (_ba.app.party_window is not None
|
if (_ba.app.ui.party_window is not None
|
||||||
and _ba.app.party_window() is not None):
|
and _ba.app.ui.party_window() is not None):
|
||||||
_ba.app.party_window().on_chat_message(msg)
|
_ba.app.ui.party_window().on_chat_message(msg)
|
||||||
|
|
||||||
|
|
||||||
def handle_remote_achievement_list(completed_achievements: List[str]) -> None:
|
def handle_remote_achievement_list(completed_achievements: List[str]) -> None:
|
||||||
|
|||||||
133
assets/src/ba_data/python/ba/_ui.py
Normal file
133
assets/src/ba_data/python/ba/_ui.py
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
# Copyright (c) 2011-2020 Eric Froemling
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
"""User interface functionality."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
import _ba
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Optional, Dict, Any, Callable, List
|
||||||
|
from ba.ui import UICleanupCheck
|
||||||
|
import ba
|
||||||
|
|
||||||
|
|
||||||
|
class UI:
|
||||||
|
"""UI subsystem for the app."""
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
env = _ba.env()
|
||||||
|
|
||||||
|
self.controller: Optional[ba.UIController] = None
|
||||||
|
|
||||||
|
self._main_menu_window: Optional[ba.Widget] = None
|
||||||
|
self._main_menu_location: Optional[str] = None
|
||||||
|
|
||||||
|
self.window_states: Dict = {} # FIXME: Kill this.
|
||||||
|
# self.windows: Dict = {} # FIXME: Kill this.
|
||||||
|
self.main_menu_selection: Optional[str] = None # FIXME: Kill this.
|
||||||
|
self.have_party_queue_window = False
|
||||||
|
self.quit_window: Any = None
|
||||||
|
self.dismiss_wii_remotes_window_call: (Optional[Callable[[],
|
||||||
|
Any]]) = None
|
||||||
|
self.cleanupchecks: List[UICleanupCheck] = []
|
||||||
|
self.upkeeptimer: Optional[ba.Timer] = None
|
||||||
|
self.use_toolbars = env.get('toolbar_test', True)
|
||||||
|
self.party_window: Any = None # FIXME: Don't use Any.
|
||||||
|
self.title_color = (0.72, 0.7, 0.75)
|
||||||
|
self.heading_color = (0.72, 0.7, 0.75)
|
||||||
|
self.infotextcolor = (0.7, 0.9, 0.7)
|
||||||
|
|
||||||
|
def on_app_launch(self) -> None:
|
||||||
|
"""Should be run on app launch."""
|
||||||
|
from ba.ui import UIController, ui_upkeep
|
||||||
|
from ba._enums import TimeType
|
||||||
|
|
||||||
|
self.controller = UIController()
|
||||||
|
|
||||||
|
# Kick off our periodic UI upkeep.
|
||||||
|
# FIXME: Can probably kill this if we do immediate UI death checks.
|
||||||
|
self.upkeeptimer = _ba.Timer(2.6543,
|
||||||
|
ui_upkeep,
|
||||||
|
timetype=TimeType.REAL,
|
||||||
|
repeat=True)
|
||||||
|
|
||||||
|
def set_main_menu_window(self, window: ba.Widget) -> None:
|
||||||
|
"""Set the current 'main' window, replacing any existing."""
|
||||||
|
existing = self._main_menu_window
|
||||||
|
from ba._enums import TimeType
|
||||||
|
from inspect import currentframe, getframeinfo
|
||||||
|
|
||||||
|
# Let's grab the location where we were called from to report
|
||||||
|
# if we have to force-kill the existing window (which normally
|
||||||
|
# should not happen).
|
||||||
|
frameline = None
|
||||||
|
try:
|
||||||
|
frame = currentframe()
|
||||||
|
if frame is not None:
|
||||||
|
frame = frame.f_back
|
||||||
|
if frame is not None:
|
||||||
|
frameinfo = getframeinfo(frame)
|
||||||
|
frameline = f'{frameinfo.filename} {frameinfo.lineno}'
|
||||||
|
except Exception:
|
||||||
|
from ba._error import print_exception
|
||||||
|
print_exception('Error calcing line for set_main_menu_window')
|
||||||
|
|
||||||
|
# With our legacy main-menu system, the caller is responsible for
|
||||||
|
# clearing out the old main menu window when assigning the new.
|
||||||
|
# However there are corner cases where that doesn't happen and we get
|
||||||
|
# old windows stuck under the new main one. So let's guard against that
|
||||||
|
# However, we can't simply delete the existing main window when
|
||||||
|
# a new one is assigned because the user may transition the old out
|
||||||
|
# *after* the assignment. Sigh. So as a happy medium let's check in
|
||||||
|
# on the old after a short bit of time and kill it if its still alive.
|
||||||
|
# That will be a bit ugly on screen but at least will un-break things.
|
||||||
|
def _delay_kill() -> None:
|
||||||
|
if existing:
|
||||||
|
print(f'Killing old main_menu_window'
|
||||||
|
f' when called at: {frameline}')
|
||||||
|
existing.delete()
|
||||||
|
|
||||||
|
_ba.timer(1.0, _delay_kill, timetype=TimeType.REAL)
|
||||||
|
self._main_menu_window = window
|
||||||
|
|
||||||
|
def clear_main_menu_window(self, transition: str = None) -> None:
|
||||||
|
"""Clear any existing 'main' window with the provided transition."""
|
||||||
|
if self._main_menu_window:
|
||||||
|
if transition is not None:
|
||||||
|
_ba.containerwidget(edit=self._main_menu_window,
|
||||||
|
transition=transition)
|
||||||
|
else:
|
||||||
|
self._main_menu_window.delete()
|
||||||
|
|
||||||
|
def has_main_menu_window(self) -> bool:
|
||||||
|
"""Return whether a main menu window is present."""
|
||||||
|
return bool(self._main_menu_window)
|
||||||
|
|
||||||
|
def set_main_menu_location(self, location: str) -> None:
|
||||||
|
"""Set the location represented by the current main menu window."""
|
||||||
|
self._main_menu_location = location
|
||||||
|
|
||||||
|
def get_main_menu_location(self) -> Optional[str]:
|
||||||
|
"""Return the current named main menu location, if any."""
|
||||||
|
return self._main_menu_location
|
||||||
@ -203,7 +203,7 @@ def uicleanupcheck(obj: Any, widget: ba.Widget) -> None:
|
|||||||
|
|
||||||
widget.add_delete_callback(foobar)
|
widget.add_delete_callback(foobar)
|
||||||
|
|
||||||
_ba.app.uicleanupchecks.append(
|
_ba.app.ui.cleanupchecks.append(
|
||||||
UICleanupCheck(obj=weakref.ref(obj),
|
UICleanupCheck(obj=weakref.ref(obj),
|
||||||
widget=widget,
|
widget=widget,
|
||||||
widget_death_time=None))
|
widget_death_time=None))
|
||||||
@ -211,10 +211,10 @@ def uicleanupcheck(obj: Any, widget: ba.Widget) -> None:
|
|||||||
|
|
||||||
def ui_upkeep() -> None:
|
def ui_upkeep() -> None:
|
||||||
"""Run UI cleanup checks, etc. should be called periodically."""
|
"""Run UI cleanup checks, etc. should be called periodically."""
|
||||||
app = _ba.app
|
ui = _ba.app.ui
|
||||||
remainingchecks = []
|
remainingchecks = []
|
||||||
now = _ba.time(TimeType.REAL)
|
now = _ba.time(TimeType.REAL)
|
||||||
for check in app.uicleanupchecks:
|
for check in ui.cleanupchecks:
|
||||||
obj = check.obj()
|
obj = check.obj()
|
||||||
|
|
||||||
# If the object has died, ignore and don't re-add.
|
# If the object has died, ignore and don't re-add.
|
||||||
@ -237,4 +237,4 @@ def ui_upkeep() -> None:
|
|||||||
' you probably have a memory leak.')
|
' you probably have a memory leak.')
|
||||||
else:
|
else:
|
||||||
remainingchecks.append(check)
|
remainingchecks.append(check)
|
||||||
app.uicleanupchecks = remainingchecks
|
ui.cleanupchecks = remainingchecks
|
||||||
|
|||||||
@ -40,8 +40,10 @@ class AppDelegate(ba.AppDelegate):
|
|||||||
|
|
||||||
# Replace the main window once we come up successfully.
|
# Replace the main window once we come up successfully.
|
||||||
from bastd.ui.playlist.editgame import PlaylistEditGameWindow
|
from bastd.ui.playlist.editgame import PlaylistEditGameWindow
|
||||||
prev_window = ba.app.main_menu_window
|
ba.app.ui.clear_main_menu_window(transition='out_left')
|
||||||
ba.app.main_menu_window = (PlaylistEditGameWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
gameclass, sessiontype, settings,
|
PlaylistEditGameWindow(
|
||||||
completion_call=completion_call).get_root_widget())
|
gameclass,
|
||||||
ba.containerwidget(edit=prev_window, transition='out_left')
|
sessiontype,
|
||||||
|
settings,
|
||||||
|
completion_call=completion_call).get_root_widget())
|
||||||
|
|||||||
@ -403,55 +403,58 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
|||||||
with ba.Context('ui'):
|
with ba.Context('ui'):
|
||||||
from bastd.ui import specialoffer
|
from bastd.ui import specialoffer
|
||||||
if bool(False):
|
if bool(False):
|
||||||
uicontroller = ba.app.uicontroller
|
uicontroller = ba.app.ui.controller
|
||||||
assert uicontroller is not None
|
assert uicontroller is not None
|
||||||
uicontroller.show_main_menu()
|
uicontroller.show_main_menu()
|
||||||
else:
|
else:
|
||||||
main_window = ba.app.main_window
|
main_menu_location = ba.app.ui.get_main_menu_location()
|
||||||
|
|
||||||
# When coming back from a kiosk-mode game, jump to
|
# When coming back from a kiosk-mode game, jump to
|
||||||
# the kiosk start screen.
|
# the kiosk start screen.
|
||||||
if ba.app.kiosk_mode:
|
if ba.app.kiosk_mode:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.kiosk import KioskWindow
|
from bastd.ui.kiosk import KioskWindow
|
||||||
ba.app.main_menu_window = KioskWindow().get_root_widget()
|
ba.app.ui.set_main_menu_window(
|
||||||
|
KioskWindow().get_root_widget())
|
||||||
# ..or in normal cases go back to the main menu
|
# ..or in normal cases go back to the main menu
|
||||||
else:
|
else:
|
||||||
main_window = ba.app.main_window
|
if main_menu_location == 'Gather':
|
||||||
if main_window == 'Gather':
|
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.gather import GatherWindow
|
from bastd.ui.gather import GatherWindow
|
||||||
ba.app.main_menu_window = (GatherWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition=None).get_root_widget())
|
GatherWindow(transition=None).get_root_widget())
|
||||||
elif main_window == 'Watch':
|
elif main_menu_location == 'Watch':
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.watch import WatchWindow
|
from bastd.ui.watch import WatchWindow
|
||||||
ba.app.main_menu_window = WatchWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition=None).get_root_widget()
|
WatchWindow(transition=None).get_root_widget())
|
||||||
elif main_window == 'Team Game Select':
|
elif main_menu_location == 'Team Game Select':
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.playlist.browser import (
|
from bastd.ui.playlist.browser import (
|
||||||
PlaylistBrowserWindow)
|
PlaylistBrowserWindow)
|
||||||
ba.app.main_menu_window = PlaylistBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
sessiontype=ba.DualTeamSession,
|
PlaylistBrowserWindow(
|
||||||
transition=None).get_root_widget()
|
sessiontype=ba.DualTeamSession,
|
||||||
elif main_window == 'Free-for-All Game Select':
|
transition=None).get_root_widget())
|
||||||
|
elif main_menu_location == 'Free-for-All Game Select':
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.playlist.browser import (
|
from bastd.ui.playlist.browser import (
|
||||||
PlaylistBrowserWindow)
|
PlaylistBrowserWindow)
|
||||||
ba.app.main_menu_window = PlaylistBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
sessiontype=ba.FreeForAllSession,
|
PlaylistBrowserWindow(
|
||||||
transition=None).get_root_widget()
|
sessiontype=ba.FreeForAllSession,
|
||||||
elif main_window == 'Coop Select':
|
transition=None).get_root_widget())
|
||||||
|
elif main_menu_location == 'Coop Select':
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.coop.browser import CoopBrowserWindow
|
from bastd.ui.coop.browser import CoopBrowserWindow
|
||||||
ba.app.main_menu_window = CoopBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition=None).get_root_widget()
|
CoopBrowserWindow(
|
||||||
|
transition=None).get_root_widget())
|
||||||
else:
|
else:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.mainmenu import MainMenuWindow
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
ba.app.main_menu_window = MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition=None).get_root_widget()
|
MainMenuWindow(transition=None).get_root_widget())
|
||||||
|
|
||||||
# attempt to show any pending offers immediately.
|
# attempt to show any pending offers immediately.
|
||||||
# If that doesn't work, try again in a few seconds
|
# If that doesn't work, try again in a few seconds
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class AccountLinkWindow(ba.Window):
|
|||||||
'accountSettingsWindow.linkAccountsInstructionsNewText'),
|
'accountSettingsWindow.linkAccountsInstructionsNewText'),
|
||||||
subs=[('${COUNT}', str(maxlinks))]),
|
subs=[('${COUNT}', str(maxlinks))]),
|
||||||
maxwidth=self._width * 0.9,
|
maxwidth=self._width * 0.9,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
max_height=self._height * 0.6,
|
max_height=self._height * 0.6,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
scale=(2.09 if uiscale is ba.UIScale.SMALL else
|
scale=(2.09 if uiscale is ba.UIScale.SMALL else
|
||||||
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
||||||
stack_offset=(0, -19) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
stack_offset=(0, -19) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._back)
|
on_cancel_call=self._back)
|
||||||
@ -140,7 +140,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, self._height - 41),
|
position=(self._width * 0.5, self._height - 41),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=self._width - 340,
|
maxwidth=self._width - 340,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -363,7 +363,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=txt,
|
text=txt,
|
||||||
scale=0.9,
|
scale=0.9,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=self._sub_width * 0.9,
|
maxwidth=self._sub_width * 0.9,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -450,7 +450,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
on_activate_call=lambda: self._sign_in_press('Google Play'))
|
on_activate_call=lambda: self._sign_in_press('Google Play'))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -475,7 +475,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
on_activate_call=lambda: self._sign_in_press('Game Circle'))
|
on_activate_call=lambda: self._sign_in_press('Game Circle'))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -499,7 +499,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
on_activate_call=lambda: self._sign_in_press('Ali'))
|
on_activate_call=lambda: self._sign_in_press('Ali'))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -545,7 +545,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
color=(0.55, 0.8, 0.5))
|
color=(0.55, 0.8, 0.5))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -592,7 +592,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
color=(0.55, 0.8, 0.5))
|
color=(0.55, 0.8, 0.5))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -614,7 +614,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
on_activate_call=self._player_profiles_press)
|
on_activate_call=self._player_profiles_press)
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=0)
|
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=0)
|
||||||
@ -642,7 +642,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
label=account_type_name)
|
label=account_type_name)
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -684,7 +684,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
label='')
|
label='')
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -712,7 +712,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
label=ba.Lstr(resource='leaderboardsText'))
|
label=ba.Lstr(resource='leaderboardsText'))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -782,7 +782,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
action=self._reset_progress))
|
action=self._reset_progress))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn)
|
ba.widget(edit=btn, left_widget=bbtn)
|
||||||
@ -837,7 +837,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
color=(0.75, 0.7, 0.8))
|
color=(0.75, 0.7, 0.8))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=50)
|
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=50)
|
||||||
@ -865,7 +865,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
color=(0.75, 0.7, 0.8))
|
color=(0.75, 0.7, 0.8))
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=50)
|
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=50)
|
||||||
@ -886,7 +886,7 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
on_activate_call=self._sign_out_press)
|
on_activate_call=self._sign_out_press)
|
||||||
if first_selectable is None:
|
if first_selectable is None:
|
||||||
first_selectable = btn
|
first_selectable = btn
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=15)
|
ba.widget(edit=btn, left_widget=bbtn, show_buffer_bottom=15)
|
||||||
@ -1090,14 +1090,14 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui import mainmenu
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
|
|
||||||
if not self._modal:
|
if not self._modal:
|
||||||
ba.app.main_menu_window = (mainmenu.MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _save_state(self) -> None:
|
def _save_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
@ -1108,13 +1108,13 @@ class AccountSettingsWindow(ba.Window):
|
|||||||
sel_name = 'Scroll'
|
sel_name = 'Scroll'
|
||||||
else:
|
else:
|
||||||
raise ValueError('unrecognized selection')
|
raise ValueError('unrecognized selection')
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(f'Error saving state for {self}.')
|
ba.print_exception(f'Error saving state for {self}.')
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
if sel_name == 'Back':
|
if sel_name == 'Back':
|
||||||
sel = self._back_button
|
sel = self._back_button
|
||||||
elif sel_name == 'Scroll':
|
elif sel_name == 'Scroll':
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class AccountUnlinkWindow(ba.Window):
|
|||||||
resource='accountSettingsWindow.unlinkAccountsInstructionsText'
|
resource='accountSettingsWindow.unlinkAccountsInstructionsText'
|
||||||
),
|
),
|
||||||
maxwidth=self._width * 0.7,
|
maxwidth=self._width * 0.7,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
|
|||||||
@ -292,7 +292,7 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
scale=title_scale,
|
scale=title_scale,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=account_title,
|
text=account_title,
|
||||||
maxwidth=sub_width * maxwidth_scale)
|
maxwidth=sub_width * maxwidth_scale)
|
||||||
draw_small = (showing_character
|
draw_small = (showing_character
|
||||||
@ -319,7 +319,7 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
scale=title_scale,
|
scale=title_scale,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=ba.Lstr(resource='rankText'),
|
text=ba.Lstr(resource='rankText'),
|
||||||
maxwidth=sub_width * maxwidth_scale)
|
maxwidth=sub_width * maxwidth_scale)
|
||||||
v -= 14
|
v -= 14
|
||||||
@ -433,7 +433,7 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
scale=title_scale,
|
scale=title_scale,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=ba.Lstr(resource='achievementsText'),
|
text=ba.Lstr(resource='achievementsText'),
|
||||||
maxwidth=sub_width * maxwidth_scale)
|
maxwidth=sub_width * maxwidth_scale)
|
||||||
v -= 14
|
v -= 14
|
||||||
@ -462,7 +462,7 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
scale=title_scale,
|
scale=title_scale,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
flatness=1.0,
|
flatness=1.0,
|
||||||
text=ba.Lstr(resource='trophiesThisSeasonText',
|
text=ba.Lstr(resource='trophiesThisSeasonText',
|
||||||
fallback_resource='trophiesText'),
|
fallback_resource='trophiesText'),
|
||||||
|
|||||||
@ -202,7 +202,7 @@ class ShowFriendCodeWindow(ba.Window):
|
|||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height * 0.8),
|
position=(self._width * 0.5, self._height * 0.8),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
flatness=1.0,
|
flatness=1.0,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -231,7 +231,7 @@ class ShowFriendCodeWindow(ba.Window):
|
|||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height * 0.37),
|
position=(self._width * 0.5, self._height * 0.37),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
flatness=1.0,
|
flatness=1.0,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
|
|||||||
@ -147,18 +147,19 @@ class QuitWindow:
|
|||||||
swish: bool = False,
|
swish: bool = False,
|
||||||
back: bool = False,
|
back: bool = False,
|
||||||
origin_widget: ba.Widget = None):
|
origin_widget: ba.Widget = None):
|
||||||
|
ui = ba.app.ui
|
||||||
app = ba.app
|
app = ba.app
|
||||||
self._back = back
|
self._back = back
|
||||||
|
|
||||||
# If there's already one of us up somewhere, kill it.
|
# If there's already one of us up somewhere, kill it.
|
||||||
if app.quit_window is not None:
|
if ui.quit_window is not None:
|
||||||
app.quit_window.delete()
|
ui.quit_window.delete()
|
||||||
app.quit_window = None
|
ui.quit_window = None
|
||||||
if swish:
|
if swish:
|
||||||
ba.playsound(ba.getsound('swish'))
|
ba.playsound(ba.getsound('swish'))
|
||||||
quit_resource = ('quitGameText'
|
quit_resource = ('quitGameText'
|
||||||
if app.platform == 'mac' else 'exitGameText')
|
if app.platform == 'mac' else 'exitGameText')
|
||||||
self._root_widget = app.quit_window = (ConfirmWindow(
|
self._root_widget = ui.quit_window = (ConfirmWindow(
|
||||||
ba.Lstr(resource=quit_resource,
|
ba.Lstr(resource=quit_resource,
|
||||||
subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))]),
|
subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))]),
|
||||||
self._fade_and_quit,
|
self._fade_and_quit,
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class ContinuesWindow(ba.Window):
|
|||||||
|
|
||||||
self._tickets_text_base: Optional[str]
|
self._tickets_text_base: Optional[str]
|
||||||
self._tickets_text: Optional[ba.Widget]
|
self._tickets_text: Optional[ba.Widget]
|
||||||
if not ba.app.toolbars:
|
if not ba.app.ui.use_toolbars:
|
||||||
self._tickets_text_base = ba.Lstr(
|
self._tickets_text_base = ba.Lstr(
|
||||||
resource='getTicketsWindow.youHaveShortText',
|
resource='getTicketsWindow.youHaveShortText',
|
||||||
fallback_resource='getTicketsWindow.youHaveText').evaluate()
|
fallback_resource='getTicketsWindow.youHaveText').evaluate()
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._x_inset = x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
|
self._x_inset = x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
|
||||||
self._height = (657 if uiscale is ba.UIScale.SMALL else
|
self._height = (657 if uiscale is ba.UIScale.SMALL else
|
||||||
730 if uiscale is ba.UIScale.MEDIUM else 800)
|
730 if uiscale is ba.UIScale.MEDIUM else 800)
|
||||||
app.main_window = 'Coop Select'
|
app.ui.set_main_menu_location('Coop Select')
|
||||||
self._r = 'coopSelectWindow'
|
self._r = 'coopSelectWindow'
|
||||||
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
|
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
scale=(1.2 if uiscale is ba.UIScale.SMALL else
|
scale=(1.2 if uiscale is ba.UIScale.SMALL else
|
||||||
0.8 if uiscale is ba.UIScale.MEDIUM else 0.75)))
|
0.8 if uiscale is ba.UIScale.MEDIUM else 0.75)))
|
||||||
|
|
||||||
if app.toolbars and uiscale is ba.UIScale.SMALL:
|
if app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
else:
|
else:
|
||||||
self._back_button = ba.buttonwidget(
|
self._back_button = ba.buttonwidget(
|
||||||
@ -140,7 +140,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._store_button_widget: Optional[ba.Widget]
|
self._store_button_widget: Optional[ba.Widget]
|
||||||
self._league_rank_button_widget: Optional[ba.Widget]
|
self._league_rank_button_widget: Optional[ba.Widget]
|
||||||
|
|
||||||
if not app.toolbars:
|
if not app.ui.use_toolbars:
|
||||||
prb = self._league_rank_button = LeagueRankButton(
|
prb = self._league_rank_button = LeagueRankButton(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width - (282 + x_inset), self._height - 85 -
|
position=(self._width - (282 + x_inset), self._height - 85 -
|
||||||
@ -206,12 +206,12 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource='playModes.singlePlayerCoopText',
|
text=ba.Lstr(resource='playModes.singlePlayerCoopText',
|
||||||
fallback_resource='playModes.coopText'),
|
fallback_resource='playModes.coopText'),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
color=app.title_color,
|
color=app.ui.title_color,
|
||||||
scale=1.5,
|
scale=1.5,
|
||||||
maxwidth=500,
|
maxwidth=500,
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
if app.toolbars and uiscale is ba.UIScale.SMALL:
|
if app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
ba.textwidget(edit=txt, text='')
|
ba.textwidget(edit=txt, text='')
|
||||||
|
|
||||||
if self._back_button is not None:
|
if self._back_button is not None:
|
||||||
@ -232,9 +232,9 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self.a_outline_model = ba.getmodel('achievementOutline')
|
self.a_outline_model = ba.getmodel('achievementOutline')
|
||||||
|
|
||||||
self._scroll_width = self._width - (130 + 2 * x_inset)
|
self._scroll_width = self._width - (130 + 2 * x_inset)
|
||||||
self._scroll_height = (
|
self._scroll_height = (self._height -
|
||||||
self._height -
|
(190 if uiscale is ba.UIScale.SMALL
|
||||||
(190 if uiscale is ba.UIScale.SMALL and app.toolbars else 160))
|
and app.ui.use_toolbars else 160))
|
||||||
|
|
||||||
self._subcontainerwidth = 800.0
|
self._subcontainerwidth = 800.0
|
||||||
self._subcontainerheight = 1400.0
|
self._subcontainerheight = 1400.0
|
||||||
@ -242,9 +242,8 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._scrollwidget = ba.scrollwidget(
|
self._scrollwidget = ba.scrollwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
highlight=False,
|
highlight=False,
|
||||||
position=(65 + x_inset,
|
position=(65 + x_inset, 120) if uiscale is ba.UIScale.SMALL
|
||||||
120) if uiscale is ba.UIScale.SMALL and app.toolbars else
|
and app.ui.use_toolbars else (65 + x_inset, 70),
|
||||||
(65 + x_inset, 70),
|
|
||||||
size=(self._scroll_width, self._scroll_height),
|
size=(self._scroll_width, self._scroll_height),
|
||||||
simple_culling_v=10.0)
|
simple_culling_v=10.0)
|
||||||
self._subcontainer: Optional[ba.Widget] = None
|
self._subcontainer: Optional[ba.Widget] = None
|
||||||
@ -815,15 +814,15 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
v = self._subcontainerheight - 73
|
v = self._subcontainerheight - 73
|
||||||
|
|
||||||
self._campaign_percent_text = ba.textwidget(parent=w_parent,
|
self._campaign_percent_text = ba.textwidget(
|
||||||
position=(h_base + 27,
|
parent=w_parent,
|
||||||
v + 30),
|
position=(h_base + 27, v + 30),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text='',
|
text='',
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.1)
|
scale=1.1)
|
||||||
|
|
||||||
row_v_show_buffer = 100
|
row_v_show_buffer = 100
|
||||||
v -= 198
|
v -= 198
|
||||||
@ -867,7 +866,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
text=txt,
|
text=txt,
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.1)
|
scale=1.1)
|
||||||
self._tournament_info_button = ba.buttonwidget(
|
self._tournament_info_button = ba.buttonwidget(
|
||||||
parent=w_parent,
|
parent=w_parent,
|
||||||
@ -901,7 +900,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
text=unavailable_text,
|
text=unavailable_text,
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=0.9)
|
scale=0.9)
|
||||||
v -= 40
|
v -= 40
|
||||||
v -= 198
|
v -= 198
|
||||||
@ -947,7 +946,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
fallback_resource='coopSelectWindow.customText'),
|
fallback_resource='coopSelectWindow.customText'),
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.1)
|
scale=1.1)
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
@ -1371,9 +1370,9 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
assert self._league_rank_button is not None
|
assert self._league_rank_button is not None
|
||||||
ba.app.main_menu_window = (LeagueRankWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._league_rank_button.get_button()).
|
LeagueRankWindow(origin_widget=self._league_rank_button.get_button(
|
||||||
get_root_widget())
|
)).get_root_widget())
|
||||||
|
|
||||||
def _switch_to_score(self, show_tab: Optional[str] = 'extras') -> None:
|
def _switch_to_score(self, show_tab: Optional[str] = 'extras') -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -1385,10 +1384,11 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
assert self._store_button is not None
|
assert self._store_button is not None
|
||||||
ba.app.main_menu_window = (StoreBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._store_button.get_button(),
|
StoreBrowserWindow(
|
||||||
show_tab=show_tab,
|
origin_widget=self._store_button.get_button(),
|
||||||
back_location='CoopBrowserWindow').get_root_widget())
|
show_tab=show_tab,
|
||||||
|
back_location='CoopBrowserWindow').get_root_widget())
|
||||||
|
|
||||||
def _show_leader(self, tournament_button: Dict[str, Any]) -> None:
|
def _show_leader(self, tournament_button: Dict[str, Any]) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -1551,13 +1551,13 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (PlayWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
PlayWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__,
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__,
|
||||||
{}).get('sel_name')
|
{}).get('sel_name')
|
||||||
if sel_name == 'Back':
|
if sel_name == 'Back':
|
||||||
sel = self._back_button
|
sel = self._back_button
|
||||||
elif sel_name == 'Scroll':
|
elif sel_name == 'Scroll':
|
||||||
@ -1586,7 +1586,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
sel_name = 'Scroll'
|
sel_name = 'Scroll'
|
||||||
else:
|
else:
|
||||||
raise ValueError('unrecognized selection')
|
raise ValueError('unrecognized selection')
|
||||||
ba.app.window_states[self.__class__.__name__] = {
|
ba.app.ui.window_states[self.__class__.__name__] = {
|
||||||
'sel_name': sel_name
|
'sel_name': sel_name
|
||||||
}
|
}
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class CoopLevelLockedWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource='levelMustBeCompletedFirstText',
|
text=ba.Lstr(resource='levelMustBeCompletedFirstText',
|
||||||
subs=[('${LEVEL}', dep_name)]),
|
subs=[('${LEVEL}', dep_name)]),
|
||||||
maxwidth=400,
|
maxwidth=400,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
scale=0.8)
|
scale=0.8)
|
||||||
ba.imagewidget(parent=self._root_widget,
|
ba.imagewidget(parent=self._root_widget,
|
||||||
position=(56 - 20, height * 0.39),
|
position=(56 - 20, height * 0.39),
|
||||||
|
|||||||
@ -66,7 +66,7 @@ class CreditsListWindow(ba.Window):
|
|||||||
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
||||||
stack_offset=(0, -8) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
stack_offset=(0, -8) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
||||||
|
|
||||||
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._back)
|
on_cancel_call=self._back)
|
||||||
else:
|
else:
|
||||||
@ -98,7 +98,7 @@ class CreditsListWindow(ba.Window):
|
|||||||
subs=[('${APP_NAME}',
|
subs=[('${APP_NAME}',
|
||||||
ba.Lstr(resource='titleText'))]),
|
ba.Lstr(resource='titleText'))]),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=330,
|
maxwidth=330,
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class CreditsListWindow(ba.Window):
|
|||||||
height - 100),
|
height - 100),
|
||||||
capture_arrows=True)
|
capture_arrows=True)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=scroll,
|
ba.widget(edit=scroll,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if uiscale is ba.UIScale.SMALL:
|
if uiscale is ba.UIScale.SMALL:
|
||||||
@ -280,8 +280,8 @@ class CreditsListWindow(ba.Window):
|
|||||||
voffs -= line_height
|
voffs -= line_height
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui import mainmenu
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = mainmenu.MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget()
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -77,7 +77,7 @@ class DebugWindow(ba.Window):
|
|||||||
size=(width, 30),
|
size=(width, 30),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=260)
|
maxwidth=260)
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class DebugWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.stressTestTitleText'),
|
text=ba.Lstr(resource=self._r + '.stressTestTitleText'),
|
||||||
maxwidth=200,
|
maxwidth=200,
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.85,
|
scale=0.85,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -143,7 +143,7 @@ class DebugWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r +
|
text=ba.Lstr(resource=self._r +
|
||||||
'.stressTestPlaylistTypeText'),
|
'.stressTestPlaylistTypeText'),
|
||||||
maxwidth=130,
|
maxwidth=130,
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.65,
|
scale=0.65,
|
||||||
h_align='right',
|
h_align='right',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -169,7 +169,7 @@ class DebugWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r +
|
text=ba.Lstr(resource=self._r +
|
||||||
'.stressTestPlaylistNameText'),
|
'.stressTestPlaylistNameText'),
|
||||||
maxwidth=130,
|
maxwidth=130,
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.65,
|
scale=0.65,
|
||||||
h_align='right',
|
h_align='right',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -333,5 +333,5 @@ class DebugWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings.advanced import AdvancedSettingsWindow
|
from bastd.ui.settings.advanced import AdvancedSettingsWindow
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (AdvancedSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
AdvancedSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -57,7 +57,7 @@ def ask_for_rating() -> Optional[ba.Widget]:
|
|||||||
ba.textwidget(parent=dlg,
|
ba.textwidget(parent=dlg,
|
||||||
position=(15, v - 55),
|
position=(15, v - 55),
|
||||||
size=(width - 30, 30),
|
size=(width - 30, 30),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=ba.Lstr(resource='pleaseRateText',
|
text=ba.Lstr(resource='pleaseRateText',
|
||||||
subs=[('${APP_NAME}',
|
subs=[('${APP_NAME}',
|
||||||
ba.Lstr(resource='titleText'))]),
|
ba.Lstr(resource='titleText'))]),
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class FileSelectorWindow(ba.Window):
|
|||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 42),
|
position=(self._width * 0.5, self._height - 42),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
text=ba.Lstr(resource=self._r + '.titleFolderText') if
|
text=ba.Lstr(resource=self._r + '.titleFolderText') if
|
||||||
@ -121,7 +121,7 @@ class FileSelectorWindow(ba.Window):
|
|||||||
position=(self._folder_center,
|
position=(self._folder_center,
|
||||||
self._height - 98),
|
self._height - 98),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
text=self._path,
|
text=self._path,
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class GatherWindow(ba.Window):
|
|||||||
else:
|
else:
|
||||||
self._transition_out = 'out_right'
|
self._transition_out = 'out_right'
|
||||||
scale_origin = None
|
scale_origin = None
|
||||||
ba.app.main_window = 'Gather'
|
ba.app.ui.set_main_menu_location('Gather')
|
||||||
_ba.set_party_icon_always_visible(True)
|
_ba.set_party_icon_always_visible(True)
|
||||||
self._public_parties: Dict[str, Dict[str, Any]] = {}
|
self._public_parties: Dict[str, Dict[str, Any]] = {}
|
||||||
uiscale = ba.app.uiscale
|
uiscale = ba.app.uiscale
|
||||||
@ -114,7 +114,7 @@ class GatherWindow(ba.Window):
|
|||||||
stack_offset=(0, -11) if uiscale is ba.UIScale.SMALL else (
|
stack_offset=(0, -11) if uiscale is ba.UIScale.SMALL else (
|
||||||
0, 0) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
|
0, 0) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
|
||||||
|
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._back)
|
on_cancel_call=self._back)
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
@ -138,7 +138,7 @@ class GatherWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 42),
|
position=(self._width * 0.5, self._height - 42),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.5,
|
scale=1.5,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -172,7 +172,7 @@ class GatherWindow(ba.Window):
|
|||||||
size=(self._width - tab_buffer_h, 50),
|
size=(self._width - tab_buffer_h, 50),
|
||||||
on_select_call=self._set_tab)
|
on_select_call=self._set_tab)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=self._tab_buttons[tabs_def[-1][0]],
|
ba.widget(edit=self._tab_buttons[tabs_def[-1][0]],
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if uiscale is ba.UIScale.SMALL:
|
if uiscale is ba.UIScale.SMALL:
|
||||||
@ -1147,7 +1147,7 @@ class GatherWindow(ba.Window):
|
|||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=200,
|
maxwidth=200,
|
||||||
scale=0.8,
|
scale=0.8,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
position=(210, v - 9),
|
position=(210, v - 9),
|
||||||
text=party_name_text)
|
text=party_name_text)
|
||||||
self._internet_host_name_text = ba.textwidget(
|
self._internet_host_name_text = ba.textwidget(
|
||||||
@ -1172,7 +1172,7 @@ class GatherWindow(ba.Window):
|
|||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=200,
|
maxwidth=200,
|
||||||
scale=0.8,
|
scale=0.8,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
position=(210, v - 9),
|
position=(210, v - 9),
|
||||||
text=ba.Lstr(resource='maxPartySizeText',
|
text=ba.Lstr(resource='maxPartySizeText',
|
||||||
fallback_resource='maxConnectionsText'))
|
fallback_resource='maxConnectionsText'))
|
||||||
@ -1251,7 +1251,7 @@ class GatherWindow(ba.Window):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=c_width * 0.9,
|
maxwidth=c_width * 0.9,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
position=(c_width * 0.5, v))
|
position=(c_width * 0.5, v))
|
||||||
|
|
||||||
# If public sharing is already on,
|
# If public sharing is already on,
|
||||||
@ -1561,7 +1561,7 @@ class GatherWindow(ba.Window):
|
|||||||
|
|
||||||
# Special case: if a party-queue window is up, don't do any of this
|
# Special case: if a party-queue window is up, don't do any of this
|
||||||
# (keeps things smoother).
|
# (keeps things smoother).
|
||||||
if ba.app.have_party_queue_window:
|
if ba.app.ui.have_party_queue_window:
|
||||||
return
|
return
|
||||||
|
|
||||||
# If we've got a party-name text widget, keep its value plugged
|
# If we've got a party-name text widget, keep its value plugged
|
||||||
@ -1922,7 +1922,7 @@ class GatherWindow(ba.Window):
|
|||||||
sel_name = 'TabContainer'
|
sel_name = 'TabContainer'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection: \'{sel}\'')
|
raise ValueError(f'unrecognized selection: \'{sel}\'')
|
||||||
ba.app.window_states[self.__class__.__name__] = {
|
ba.app.ui.window_states[self.__class__.__name__] = {
|
||||||
'sel_name': sel_name,
|
'sel_name': sel_name,
|
||||||
'tab': self._current_tab,
|
'tab': self._current_tab,
|
||||||
'internet_tab': self._internet_tab
|
'internet_tab': self._internet_tab
|
||||||
@ -1932,7 +1932,7 @@ class GatherWindow(ba.Window):
|
|||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
winstate = ba.app.window_states.get(self.__class__.__name__, {})
|
winstate = ba.app.ui.window_states.get(self.__class__.__name__, {})
|
||||||
sel_name = winstate.get('sel_name', None)
|
sel_name = winstate.get('sel_name', None)
|
||||||
self._internet_tab = winstate.get('internet_tab', 'join')
|
self._internet_tab = winstate.get('internet_tab', 'join')
|
||||||
current_tab = ba.app.config.get('Gather Tab', None)
|
current_tab = ba.app.config.get('Gather Tab', None)
|
||||||
@ -1952,9 +1952,9 @@ class GatherWindow(ba.Window):
|
|||||||
ba.print_exception(f'Error restoring state for {self}.')
|
ba.print_exception(f'Error restoring state for {self}.')
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui import mainmenu
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (mainmenu.MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 55),
|
position=(self._width * 0.5, self._height - 55),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.2,
|
scale=1.2,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -602,7 +602,7 @@ class GetCurrencyWindow(ba.Window):
|
|||||||
modal=self._from_modal_store,
|
modal=self._from_modal_store,
|
||||||
back_location=self._store_back_location).get_root_widget()
|
back_location=self._store_back_location).get_root_widget()
|
||||||
if not self._from_modal_store:
|
if not self._from_modal_store:
|
||||||
ba.app.main_menu_window = window
|
ba.app.ui.set_main_menu_window(window)
|
||||||
self._transitioning_out = True
|
self._transitioning_out = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class HelpWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r + '.titleText',
|
text=ba.Lstr(resource=self._r + '.titleText',
|
||||||
subs=[('${APP_NAME}',
|
subs=[('${APP_NAME}',
|
||||||
ba.Lstr(resource='titleText'))]),
|
ba.Lstr(resource='titleText'))]),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='top')
|
v_align='top')
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ class HelpWindow(ba.Window):
|
|||||||
height - 120 + (5 if uiscale is ba.UIScale.SMALL else 0)),
|
height - 120 + (5 if uiscale is ba.UIScale.SMALL else 0)),
|
||||||
capture_arrows=True)
|
capture_arrows=True)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=self._scrollwidget,
|
ba.widget(edit=self._scrollwidget,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
@ -100,7 +100,7 @@ class HelpWindow(ba.Window):
|
|||||||
|
|
||||||
# ugly: create this last so it gets first dibs at touch events (since
|
# ugly: create this last so it gets first dibs at touch events (since
|
||||||
# we have it close to the scroll widget)
|
# we have it close to the scroll widget)
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._close)
|
on_cancel_call=self._close)
|
||||||
ba.widget(edit=self._scrollwidget,
|
ba.widget(edit=self._scrollwidget,
|
||||||
@ -600,9 +600,9 @@ class HelpWindow(ba.Window):
|
|||||||
|
|
||||||
def _close(self) -> None:
|
def _close(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui import mainmenu
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if self._main_menu:
|
if self._main_menu:
|
||||||
ba.app.main_menu_window = (mainmenu.MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -337,7 +337,7 @@ class KioskWindow(ba.Window):
|
|||||||
repeat=True)
|
repeat=True)
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
sel: Optional[ba.Widget]
|
sel: Optional[ba.Widget]
|
||||||
if sel_name == 'b1':
|
if sel_name == 'b1':
|
||||||
sel = self._b1
|
sel = self._b1
|
||||||
@ -376,7 +376,7 @@ class KioskWindow(ba.Window):
|
|||||||
sel_name = 'b7'
|
sel_name = 'b7'
|
||||||
else:
|
else:
|
||||||
sel_name = 'b1'
|
sel_name = 'b1'
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
|
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
# Kiosk-mode is designed to be used signed-out... try for force
|
# Kiosk-mode is designed to be used signed-out... try for force
|
||||||
@ -466,4 +466,4 @@ class KioskWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.did_menu_intro = True # prevent delayed transition-in
|
ba.app.did_menu_intro = True # prevent delayed transition-in
|
||||||
ba.app.main_menu_window = (MainMenuWindow().get_root_widget())
|
ba.app.ui.set_main_menu_window(MainMenuWindow().get_root_widget())
|
||||||
|
|||||||
@ -340,7 +340,7 @@ class LeagueRankButton:
|
|||||||
txt = ba.Lstr(
|
txt = ba.Lstr(
|
||||||
resource='league.leagueRankText',
|
resource='league.leagueRankText',
|
||||||
fallback_resource='coopSelectWindow.powerRankingText')
|
fallback_resource='coopSelectWindow.powerRankingText')
|
||||||
t_color = ba.app.title_color
|
t_color = ba.app.ui.title_color
|
||||||
ba.textwidget(edit=self._title_text, text=txt, color=t_color)
|
ba.textwidget(edit=self._title_text, text=txt, color=t_color)
|
||||||
ba.textwidget(edit=self._value_text, text=status_text)
|
ba.textwidget(edit=self._value_text, text=status_text)
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class LeagueRankWindow(ba.Window):
|
|||||||
resource='league.leagueRankText',
|
resource='league.leagueRankText',
|
||||||
fallback_resource='coopSelectWindow.powerRankingText'),
|
fallback_resource='coopSelectWindow.powerRankingText'),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.4,
|
scale=1.4,
|
||||||
maxwidth=600,
|
maxwidth=600,
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -931,10 +931,10 @@ class LeagueRankWindow(ba.Window):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.coop import browser
|
from bastd.ui.coop.browser import CoopBrowserWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if not self._modal:
|
if not self._modal:
|
||||||
ba.app.main_menu_window = (browser.CoopBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
CoopBrowserWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -840,16 +840,17 @@ class MainMenuWindow(ba.Window):
|
|||||||
from bastd.ui.kiosk import KioskWindow
|
from bastd.ui.kiosk import KioskWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (KioskWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
KioskWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _show_account_window(self) -> None:
|
def _show_account_window(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account.settings import AccountSettingsWindow
|
from bastd.ui.account.settings import AccountSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (AccountSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._gc_button).get_root_widget())
|
AccountSettingsWindow(
|
||||||
|
origin_widget=self._gc_button).get_root_widget())
|
||||||
|
|
||||||
def _on_store_pressed(self) -> None:
|
def _on_store_pressed(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -860,8 +861,9 @@ class MainMenuWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (StoreBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._store_button).get_root_widget())
|
StoreBrowserWindow(
|
||||||
|
origin_widget=self._store_button).get_root_widget())
|
||||||
|
|
||||||
def _confirm_end_game(self) -> None:
|
def _confirm_end_game(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -916,25 +918,28 @@ class MainMenuWindow(ba.Window):
|
|||||||
from bastd.ui.creditslist import CreditsListWindow
|
from bastd.ui.creditslist import CreditsListWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (CreditsListWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._credits_button).get_root_widget())
|
CreditsListWindow(
|
||||||
|
origin_widget=self._credits_button).get_root_widget())
|
||||||
|
|
||||||
def _howtoplay(self) -> None:
|
def _howtoplay(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.helpui import HelpWindow
|
from bastd.ui.helpui import HelpWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (HelpWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
main_menu=True,
|
HelpWindow(
|
||||||
origin_widget=self._how_to_play_button).get_root_widget())
|
main_menu=True,
|
||||||
|
origin_widget=self._how_to_play_button).get_root_widget())
|
||||||
|
|
||||||
def _settings(self) -> None:
|
def _settings(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings.allsettings import AllSettingsWindow
|
from bastd.ui.settings.allsettings import AllSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (AllSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._settings_button).get_root_widget())
|
AllSettingsWindow(
|
||||||
|
origin_widget=self._settings_button).get_root_widget())
|
||||||
|
|
||||||
def _resume_and_call(self, call: Callable[[], Any]) -> None:
|
def _resume_and_call(self, call: Callable[[], Any]) -> None:
|
||||||
self._resume()
|
self._resume()
|
||||||
@ -951,28 +956,28 @@ class MainMenuWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
sel = self._root_widget.get_selected_child()
|
sel = self._root_widget.get_selected_child()
|
||||||
if sel == self._start_button:
|
if sel == self._start_button:
|
||||||
ba.app.main_menu_selection = 'Start'
|
ba.app.ui.main_menu_selection = 'Start'
|
||||||
elif sel == self._gather_button:
|
elif sel == self._gather_button:
|
||||||
ba.app.main_menu_selection = 'Gather'
|
ba.app.ui.main_menu_selection = 'Gather'
|
||||||
elif sel == self._watch_button:
|
elif sel == self._watch_button:
|
||||||
ba.app.main_menu_selection = 'Watch'
|
ba.app.ui.main_menu_selection = 'Watch'
|
||||||
elif sel == self._how_to_play_button:
|
elif sel == self._how_to_play_button:
|
||||||
ba.app.main_menu_selection = 'HowToPlay'
|
ba.app.ui.main_menu_selection = 'HowToPlay'
|
||||||
elif sel == self._credits_button:
|
elif sel == self._credits_button:
|
||||||
ba.app.main_menu_selection = 'Credits'
|
ba.app.ui.main_menu_selection = 'Credits'
|
||||||
elif sel == self._settings_button:
|
elif sel == self._settings_button:
|
||||||
ba.app.main_menu_selection = 'Settings'
|
ba.app.ui.main_menu_selection = 'Settings'
|
||||||
elif sel == self._gc_button:
|
elif sel == self._gc_button:
|
||||||
ba.app.main_menu_selection = 'GameService'
|
ba.app.ui.main_menu_selection = 'GameService'
|
||||||
elif sel == self._store_button:
|
elif sel == self._store_button:
|
||||||
ba.app.main_menu_selection = 'Store'
|
ba.app.ui.main_menu_selection = 'Store'
|
||||||
elif sel == self._quit_button:
|
elif sel == self._quit_button:
|
||||||
ba.app.main_menu_selection = 'Quit'
|
ba.app.ui.main_menu_selection = 'Quit'
|
||||||
elif sel == self._demo_menu_button:
|
elif sel == self._demo_menu_button:
|
||||||
ba.app.main_menu_selection = 'DemoMenu'
|
ba.app.ui.main_menu_selection = 'DemoMenu'
|
||||||
else:
|
else:
|
||||||
print('unknown widget in main menu store selection:', sel)
|
print('unknown widget in main menu store selection:', sel)
|
||||||
ba.app.main_menu_selection = 'Start'
|
ba.app.ui.main_menu_selection = 'Start'
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
@ -980,7 +985,7 @@ class MainMenuWindow(ba.Window):
|
|||||||
# Don't do this for the in-game menu.
|
# Don't do this for the in-game menu.
|
||||||
if self._in_game:
|
if self._in_game:
|
||||||
return
|
return
|
||||||
sel_name = ba.app.main_menu_selection
|
sel_name = ba.app.ui.main_menu_selection
|
||||||
sel: Optional[ba.Widget]
|
sel: Optional[ba.Widget]
|
||||||
if sel_name is None:
|
if sel_name is None:
|
||||||
sel_name = 'Start'
|
sel_name = 'Start'
|
||||||
@ -1012,30 +1017,30 @@ class MainMenuWindow(ba.Window):
|
|||||||
from bastd.ui.gather import GatherWindow
|
from bastd.ui.gather import GatherWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (GatherWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._gather_button).get_root_widget())
|
GatherWindow(origin_widget=self._gather_button).get_root_widget())
|
||||||
|
|
||||||
def _watch_press(self) -> None:
|
def _watch_press(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.watch import WatchWindow
|
from bastd.ui.watch import WatchWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (WatchWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._watch_button).get_root_widget())
|
WatchWindow(origin_widget=self._watch_button).get_root_widget())
|
||||||
|
|
||||||
def _play_press(self) -> None:
|
def _play_press(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.play import PlayWindow
|
from bastd.ui.play import PlayWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (PlayWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._start_button).get_root_widget())
|
PlayWindow(origin_widget=self._start_button).get_root_widget())
|
||||||
|
|
||||||
def _resume(self) -> None:
|
def _resume(self) -> None:
|
||||||
ba.app.resume()
|
ba.app.resume()
|
||||||
if self._root_widget:
|
if self._root_widget:
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = None
|
ba.app.ui.clear_main_menu_window()
|
||||||
|
|
||||||
# If there's callbacks waiting for this window to go away, call them.
|
# If there's callbacks waiting for this window to go away, call them.
|
||||||
for call in ba.app.main_menu_resume_callbacks:
|
for call in ba.app.main_menu_resume_callbacks:
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
scale=0.95,
|
scale=0.95,
|
||||||
text=label,
|
text=label,
|
||||||
maxwidth=self._width - 140,
|
maxwidth=self._width - 140,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
|
|||||||
@ -187,7 +187,7 @@ class PartyQueueWindow(ba.Window):
|
|||||||
self._boost_brightness += 0.6
|
self._boost_brightness += 0.6
|
||||||
|
|
||||||
def __init__(self, queue_id: str, address: str, port: int):
|
def __init__(self, queue_id: str, address: str, port: int):
|
||||||
ba.app.have_party_queue_window = True
|
ba.app.ui.have_party_queue_window = True
|
||||||
self._address = address
|
self._address = address
|
||||||
self._port = port
|
self._port = port
|
||||||
self._queue_id = queue_id
|
self._queue_id = queue_id
|
||||||
@ -274,7 +274,7 @@ class PartyQueueWindow(ba.Window):
|
|||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
try:
|
try:
|
||||||
ba.app.have_party_queue_window = False
|
ba.app.ui.have_party_queue_window = False
|
||||||
_ba.add_transaction({
|
_ba.add_transaction({
|
||||||
'type': 'PARTY_QUEUE_REMOVE',
|
'type': 'PARTY_QUEUE_REMOVE',
|
||||||
'q': self._queue_id
|
'q': self._queue_id
|
||||||
|
|||||||
@ -92,7 +92,7 @@ class PlayWindow(ba.Window):
|
|||||||
scale=1.7,
|
scale=1.7,
|
||||||
res_scale=2.0,
|
res_scale=2.0,
|
||||||
maxwidth=400,
|
maxwidth=400,
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -100,14 +100,15 @@ class PlayWindow(ba.Window):
|
|||||||
button_type='backSmall',
|
button_type='backSmall',
|
||||||
size=(60, 60),
|
size=(60, 60),
|
||||||
label=ba.charstr(ba.SpecialChar.BACK))
|
label=ba.charstr(ba.SpecialChar.BACK))
|
||||||
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
ba.textwidget(edit=txt, text='')
|
ba.textwidget(edit=txt, text='')
|
||||||
|
|
||||||
v = height - (110 if new_style else 60)
|
v = height - (110 if new_style else 60)
|
||||||
v -= 100
|
v -= 100
|
||||||
clr = (0.6, 0.7, 0.6, 1.0)
|
clr = (0.6, 0.7, 0.6, 1.0)
|
||||||
v -= 280 if new_style else 180
|
v -= 280 if new_style else 180
|
||||||
v += 30 if ba.app.toolbars and uiscale is ba.UIScale.SMALL else 0
|
v += (30
|
||||||
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL else 0)
|
||||||
hoffs = x_offs + 80 if new_style else 0
|
hoffs = x_offs + 80 if new_style else 0
|
||||||
scl = 1.13 if new_style else 0.68
|
scl = 1.13 if new_style else 0.68
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ class PlayWindow(ba.Window):
|
|||||||
text_scale=1.13,
|
text_scale=1.13,
|
||||||
on_activate_call=self._coop)
|
on_activate_call=self._coop)
|
||||||
|
|
||||||
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
left_widget=_ba.get_special_widget('back_button'))
|
left_widget=_ba.get_special_widget('back_button'))
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
@ -218,7 +219,7 @@ class PlayWindow(ba.Window):
|
|||||||
text_scale=1.13,
|
text_scale=1.13,
|
||||||
on_activate_call=self._team_tourney)
|
on_activate_call=self._team_tourney)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
up_widget=_ba.get_special_widget('tickets_plus_button'),
|
up_widget=_ba.get_special_widget('tickets_plus_button'),
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
@ -404,7 +405,7 @@ class PlayWindow(ba.Window):
|
|||||||
maxwidth=scl * button_width * 0.7,
|
maxwidth=scl * button_width * 0.7,
|
||||||
color=clr)
|
color=clr)
|
||||||
|
|
||||||
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
back_button.delete()
|
back_button.delete()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._back,
|
on_cancel_call=self._back,
|
||||||
@ -429,8 +430,8 @@ class PlayWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.mainmenu import MainMenuWindow
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.app.main_menu_window = (MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
|
|
||||||
@ -443,26 +444,29 @@ class PlayWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (CoopBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._coop_button).get_root_widget())
|
CoopBrowserWindow(
|
||||||
|
origin_widget=self._coop_button).get_root_widget())
|
||||||
|
|
||||||
def _team_tourney(self) -> None:
|
def _team_tourney(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.playlist.browser import PlaylistBrowserWindow
|
from bastd.ui.playlist.browser import PlaylistBrowserWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (PlaylistBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._teams_button,
|
PlaylistBrowserWindow(
|
||||||
sessiontype=ba.DualTeamSession).get_root_widget())
|
origin_widget=self._teams_button,
|
||||||
|
sessiontype=ba.DualTeamSession).get_root_widget())
|
||||||
|
|
||||||
def _free_for_all(self) -> None:
|
def _free_for_all(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.playlist.browser import PlaylistBrowserWindow
|
from bastd.ui.playlist.browser import PlaylistBrowserWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (PlaylistBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._free_for_all_button,
|
PlaylistBrowserWindow(
|
||||||
sessiontype=ba.FreeForAllSession).get_root_widget())
|
origin_widget=self._free_for_all_button,
|
||||||
|
sessiontype=ba.FreeForAllSession).get_root_widget())
|
||||||
|
|
||||||
def _draw_dude(self, i: int, btn: ba.Widget, hoffs: float, v: float,
|
def _draw_dude(self, i: int, btn: ba.Widget, hoffs: float, v: float,
|
||||||
scl: float, position: Tuple[float, float],
|
scl: float, position: Tuple[float, float],
|
||||||
@ -554,13 +558,13 @@ class PlayWindow(ba.Window):
|
|||||||
sel_name = 'Back'
|
sel_name = 'Back'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection {sel}')
|
raise ValueError(f'unrecognized selection {sel}')
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(f'Error saving state for {self}.')
|
ba.print_exception(f'Error saving state for {self}.')
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
if sel_name == 'Team Games':
|
if sel_name == 'Team Games':
|
||||||
sel = self._teams_button
|
sel = self._teams_button
|
||||||
elif sel_name == 'Co-op Games':
|
elif sel_name == 'Co-op Games':
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class PlaylistAddGameWindow(ba.Window):
|
|||||||
label=ba.Lstr(resource='selectText'),
|
label=ba.Lstr(resource='selectText'),
|
||||||
on_activate_call=self._add)
|
on_activate_call=self._add)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=select_button,
|
ba.widget(edit=select_button,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class PlaylistAddGameWindow(ba.Window):
|
|||||||
scale=1.0,
|
scale=1.0,
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=250,
|
maxwidth=250,
|
||||||
v_align='center')
|
v_align='center')
|
||||||
v = self._height - 64
|
v = self._height - 64
|
||||||
|
|||||||
@ -56,10 +56,10 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
# Store state for when we exit the next game.
|
# Store state for when we exit the next game.
|
||||||
if issubclass(sessiontype, ba.DualTeamSession):
|
if issubclass(sessiontype, ba.DualTeamSession):
|
||||||
ba.app.main_window = 'Team Game Select'
|
ba.app.ui.set_main_menu_location('Team Game Select')
|
||||||
ba.set_analytics_screen('Teams Window')
|
ba.set_analytics_screen('Teams Window')
|
||||||
elif issubclass(sessiontype, ba.FreeForAllSession):
|
elif issubclass(sessiontype, ba.FreeForAllSession):
|
||||||
ba.app.main_window = 'Free-for-All Game Select'
|
ba.app.ui.set_main_menu_location('Free-for-All Game Select')
|
||||||
ba.set_analytics_screen('FreeForAll Window')
|
ba.set_analytics_screen('FreeForAll Window')
|
||||||
else:
|
else:
|
||||||
raise TypeError(f'Invalid sessiontype: {sessiontype}.')
|
raise TypeError(f'Invalid sessiontype: {sessiontype}.')
|
||||||
@ -253,10 +253,10 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
text=self._pvars.window_title_name,
|
text=self._pvars.window_title_name,
|
||||||
scale=1.3,
|
scale=1.3,
|
||||||
res_scale=1.5,
|
res_scale=1.5,
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
ba.textwidget(edit=txt, text='')
|
ba.textwidget(edit=txt, text='')
|
||||||
|
|
||||||
ba.buttonwidget(edit=self._back_button,
|
ba.buttonwidget(edit=self._back_button,
|
||||||
@ -265,7 +265,7 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
position=(59 + x_inset, self._height - 67),
|
position=(59 + x_inset, self._height - 67),
|
||||||
label=ba.charstr(ba.SpecialChar.BACK))
|
label=ba.charstr(ba.SpecialChar.BACK))
|
||||||
|
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
self._back_button.delete()
|
self._back_button.delete()
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
@ -274,8 +274,9 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
else:
|
else:
|
||||||
scroll_offs = 0
|
scroll_offs = 0
|
||||||
self._scroll_width = self._width - (100 + 2 * x_inset)
|
self._scroll_width = self._width - (100 + 2 * x_inset)
|
||||||
self._scroll_height = self._height - (
|
self._scroll_height = (self._height -
|
||||||
146 if uiscale is ba.UIScale.SMALL and ba.app.toolbars else 136)
|
(146 if uiscale is ba.UIScale.SMALL
|
||||||
|
and ba.app.ui.use_toolbars else 136))
|
||||||
self._scrollwidget = ba.scrollwidget(
|
self._scrollwidget = ba.scrollwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
highlight=False,
|
highlight=False,
|
||||||
@ -351,7 +352,7 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
maxwidth=400,
|
maxwidth=400,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='left',
|
h_align='left',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -380,11 +381,12 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
label='',
|
label='',
|
||||||
position=pos)
|
position=pos)
|
||||||
|
|
||||||
if x == 0 and ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if (x == 0 and ba.app.ui.use_toolbars
|
||||||
|
and uiscale is ba.UIScale.SMALL):
|
||||||
ba.widget(
|
ba.widget(
|
||||||
edit=btn,
|
edit=btn,
|
||||||
left_widget=_ba.get_special_widget('back_button'))
|
left_widget=_ba.get_special_widget('back_button'))
|
||||||
if (x == columns - 1 and ba.app.toolbars
|
if (x == columns - 1 and ba.app.ui.use_toolbars
|
||||||
and uiscale is ba.UIScale.SMALL):
|
and uiscale is ba.UIScale.SMALL):
|
||||||
ba.widget(
|
ba.widget(
|
||||||
edit=btn,
|
edit=btn,
|
||||||
@ -604,9 +606,10 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
PlaylistCustomizeBrowserWindow)
|
PlaylistCustomizeBrowserWindow)
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (PlaylistCustomizeBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._customize_button,
|
PlaylistCustomizeBrowserWindow(
|
||||||
sessiontype=self._sessiontype).get_root_widget())
|
origin_widget=self._customize_button,
|
||||||
|
sessiontype=self._sessiontype).get_root_widget())
|
||||||
|
|
||||||
def _on_back_press(self) -> None:
|
def _on_back_press(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -625,8 +628,8 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (PlayWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
PlayWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _save_state(self) -> None:
|
def _save_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
@ -642,13 +645,13 @@ class PlaylistBrowserWindow(ba.Window):
|
|||||||
sel_name = 'Scroll'
|
sel_name = 'Scroll'
|
||||||
else:
|
else:
|
||||||
raise Exception('unrecognized selected widget')
|
raise Exception('unrecognized selected widget')
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(f'Error saving state for {self}.')
|
ba.print_exception(f'Error saving state for {self}.')
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
if sel_name == 'Back':
|
if sel_name == 'Back':
|
||||||
sel = self._back_button
|
sel = self._back_button
|
||||||
elif sel_name == 'Scroll':
|
elif sel_name == 'Scroll':
|
||||||
|
|||||||
@ -90,7 +90,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r + '.titleText',
|
text=ba.Lstr(resource=self._r + '.titleText',
|
||||||
subs=[('${TYPE}',
|
subs=[('${TYPE}',
|
||||||
self._pvars.window_title_name)]),
|
self._pvars.window_title_name)]),
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
maxwidth=290,
|
maxwidth=290,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -242,7 +242,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
ba.widget(edit=scrollwidget,
|
ba.widget(edit=scrollwidget,
|
||||||
left_widget=new_button,
|
left_widget=new_button,
|
||||||
right_widget=_ba.get_special_widget('party_button')
|
right_widget=_ba.get_special_widget('party_button')
|
||||||
if ba.app.toolbars else None)
|
if ba.app.ui.use_toolbars else None)
|
||||||
|
|
||||||
# make sure config exists
|
# make sure config exists
|
||||||
self._config_name_full = self._pvars.config_name + ' Playlists'
|
self._config_name_full = self._pvars.config_name + ' Playlists'
|
||||||
@ -285,9 +285,10 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (browser.PlaylistBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left',
|
browser.PlaylistBrowserWindow(
|
||||||
sessiontype=self._sessiontype).get_root_widget())
|
transition='in_left',
|
||||||
|
sessiontype=self._sessiontype).get_root_widget())
|
||||||
|
|
||||||
def _select(self, name: str, index: int) -> None:
|
def _select(self, name: str, index: int) -> None:
|
||||||
self._selected_playlist_name = name
|
self._selected_playlist_name = name
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
label=ba.Lstr(resource='saveText'),
|
label=ba.Lstr(resource='saveText'),
|
||||||
text_scale=1.2)
|
text_scale=1.2)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
position=(-10, self._height - 50),
|
position=(-10, self._height - 50),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.05,
|
scale=1.05,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -246,14 +246,16 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
self._editcontroller.set_edit_ui_selection(selection)
|
self._editcontroller.set_edit_ui_selection(selection)
|
||||||
|
|
||||||
def _cancel(self) -> None:
|
def _cancel(self) -> None:
|
||||||
from bastd.ui.playlist import customizebrowser as cb
|
from bastd.ui.playlist.customizebrowser import (
|
||||||
|
PlaylistCustomizeBrowserWindow)
|
||||||
ba.playsound(ba.getsound('powerdown01'))
|
ba.playsound(ba.getsound('powerdown01'))
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (cb.PlaylistCustomizeBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left',
|
PlaylistCustomizeBrowserWindow(
|
||||||
sessiontype=self._editcontroller.get_session_type(),
|
transition='in_left',
|
||||||
select_playlist=self._editcontroller.get_existing_playlist_name()).
|
sessiontype=self._editcontroller.get_session_type(),
|
||||||
get_root_widget())
|
select_playlist=self._editcontroller.
|
||||||
|
get_existing_playlist_name()).get_root_widget())
|
||||||
|
|
||||||
def _add(self) -> None:
|
def _add(self) -> None:
|
||||||
# Store list name then tell the session to perform an add.
|
# Store list name then tell the session to perform an add.
|
||||||
@ -268,7 +270,8 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
self._editcontroller.edit_game_pressed()
|
self._editcontroller.edit_game_pressed()
|
||||||
|
|
||||||
def _save_press(self) -> None:
|
def _save_press(self) -> None:
|
||||||
from bastd.ui.playlist import customizebrowser as cb
|
from bastd.ui.playlist.customizebrowser import (
|
||||||
|
PlaylistCustomizeBrowserWindow)
|
||||||
new_name = cast(str, ba.textwidget(query=self._text_field))
|
new_name = cast(str, ba.textwidget(query=self._text_field))
|
||||||
if (new_name != self._editcontroller.get_existing_playlist_name()
|
if (new_name != self._editcontroller.get_existing_playlist_name()
|
||||||
and new_name
|
and new_name
|
||||||
@ -316,10 +319,11 @@ class PlaylistEditWindow(ba.Window):
|
|||||||
|
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.playsound(ba.getsound('gunCocking'))
|
ba.playsound(ba.getsound('gunCocking'))
|
||||||
ba.app.main_menu_window = (cb.PlaylistCustomizeBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left',
|
PlaylistCustomizeBrowserWindow(
|
||||||
sessiontype=self._editcontroller.get_session_type(),
|
transition='in_left',
|
||||||
select_playlist=new_name).get_root_widget())
|
sessiontype=self._editcontroller.get_session_type(),
|
||||||
|
select_playlist=new_name).get_root_widget())
|
||||||
|
|
||||||
def _save_press_with_sound(self) -> None:
|
def _save_press_with_sound(self) -> None:
|
||||||
ba.playsound(ba.getsound('swish'))
|
ba.playsound(ba.getsound('swish'))
|
||||||
|
|||||||
@ -41,8 +41,8 @@ class PlaylistEditController:
|
|||||||
playlist: List[Dict[str, Any]] = None,
|
playlist: List[Dict[str, Any]] = None,
|
||||||
playlist_name: str = None):
|
playlist_name: str = None):
|
||||||
from ba.internal import preload_map_preview_media, filter_playlist
|
from ba.internal import preload_map_preview_media, filter_playlist
|
||||||
from bastd.ui import playlist as playlistui
|
from bastd.ui.playlist import PlaylistTypeVars
|
||||||
from bastd.ui.playlist import edit as peditui
|
from bastd.ui.playlist.edit import PlaylistEditWindow
|
||||||
|
|
||||||
appconfig = ba.app.config
|
appconfig = ba.app.config
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class PlaylistEditController:
|
|||||||
|
|
||||||
self._editing_game = False
|
self._editing_game = False
|
||||||
self._editing_game_type: Optional[Type[ba.GameActivity]] = None
|
self._editing_game_type: Optional[Type[ba.GameActivity]] = None
|
||||||
self._pvars = playlistui.PlaylistTypeVars(sessiontype)
|
self._pvars = PlaylistTypeVars(sessiontype)
|
||||||
self._existing_playlist_name = existing_playlist_name
|
self._existing_playlist_name = existing_playlist_name
|
||||||
self._config_name_full = self._pvars.config_name + ' Playlists'
|
self._config_name_full = self._pvars.config_name + ' Playlists'
|
||||||
|
|
||||||
@ -96,8 +96,9 @@ class PlaylistEditController:
|
|||||||
# and that's all they can do.
|
# and that's all they can do.
|
||||||
self._edit_ui_selection = 'add_button'
|
self._edit_ui_selection = 'add_button'
|
||||||
|
|
||||||
ba.app.main_menu_window = (peditui.PlaylistEditWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
editcontroller=self, transition=transition).get_root_widget())
|
PlaylistEditWindow(editcontroller=self,
|
||||||
|
transition=transition).get_root_widget())
|
||||||
|
|
||||||
def get_config_name(self) -> str:
|
def get_config_name(self) -> str:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
@ -149,10 +150,10 @@ class PlaylistEditController:
|
|||||||
|
|
||||||
def add_game_pressed(self) -> None:
|
def add_game_pressed(self) -> None:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
from bastd.ui.playlist import addgame
|
from bastd.ui.playlist.addgame import PlaylistAddGameWindow
|
||||||
ba.containerwidget(edit=ba.app.main_menu_window, transition='out_left')
|
ba.app.ui.clear_main_menu_window(transition='out_left')
|
||||||
ba.app.main_menu_window = (addgame.PlaylistAddGameWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
editcontroller=self).get_root_widget())
|
PlaylistAddGameWindow(editcontroller=self).get_root_widget())
|
||||||
|
|
||||||
def edit_game_pressed(self) -> None:
|
def edit_game_pressed(self) -> None:
|
||||||
"""Should be called by supplemental UIs when a game is to be edited."""
|
"""Should be called by supplemental UIs when a game is to be edited."""
|
||||||
@ -166,11 +167,11 @@ class PlaylistEditController:
|
|||||||
|
|
||||||
def add_game_cancelled(self) -> None:
|
def add_game_cancelled(self) -> None:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
from bastd.ui.playlist import edit as pedit
|
from bastd.ui.playlist.edit import PlaylistEditWindow
|
||||||
ba.containerwidget(edit=ba.app.main_menu_window,
|
ba.app.ui.clear_main_menu_window(transition='out_right')
|
||||||
transition='out_right')
|
ba.app.ui.set_main_menu_window(
|
||||||
ba.app.main_menu_window = (pedit.PlaylistEditWindow(
|
PlaylistEditWindow(editcontroller=self,
|
||||||
editcontroller=self, transition='in_left').get_root_widget())
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _show_edit_ui(self, gametype: Type[ba.GameActivity],
|
def _show_edit_ui(self, gametype: Type[ba.GameActivity],
|
||||||
settings: Optional[Dict[str, Any]]) -> None:
|
settings: Optional[Dict[str, Any]]) -> None:
|
||||||
@ -185,26 +186,25 @@ class PlaylistEditController:
|
|||||||
self._show_edit_ui(gametype=gametype, settings=None)
|
self._show_edit_ui(gametype=gametype, settings=None)
|
||||||
|
|
||||||
def _edit_game_done(self, config: Optional[Dict[str, Any]]) -> None:
|
def _edit_game_done(self, config: Optional[Dict[str, Any]]) -> None:
|
||||||
from bastd.ui.playlist import edit as pedit
|
from bastd.ui.playlist.edit import PlaylistEditWindow
|
||||||
from bastd.ui.playlist import addgame
|
from bastd.ui.playlist.addgame import PlaylistAddGameWindow
|
||||||
from ba.internal import get_type_name
|
from ba.internal import get_type_name
|
||||||
if config is None:
|
if config is None:
|
||||||
# If we were editing, go back to our list.
|
# If we were editing, go back to our list.
|
||||||
if self._editing_game:
|
if self._editing_game:
|
||||||
ba.playsound(ba.getsound('powerdown01'))
|
ba.playsound(ba.getsound('powerdown01'))
|
||||||
ba.containerwidget(edit=ba.app.main_menu_window,
|
ba.app.ui.clear_main_menu_window(transition='out_right')
|
||||||
transition='out_right')
|
ba.app.ui.set_main_menu_window(
|
||||||
ba.app.main_menu_window = (pedit.PlaylistEditWindow(
|
PlaylistEditWindow(editcontroller=self,
|
||||||
editcontroller=self,
|
transition='in_left').get_root_widget())
|
||||||
transition='in_left').get_root_widget())
|
|
||||||
|
|
||||||
# Otherwise we were adding; go back to the add type choice list.
|
# Otherwise we were adding; go back to the add type choice list.
|
||||||
else:
|
else:
|
||||||
ba.containerwidget(edit=ba.app.main_menu_window,
|
ba.app.ui.clear_main_menu_window(transition='out_right')
|
||||||
transition='out_right')
|
ba.app.ui.set_main_menu_window(
|
||||||
ba.app.main_menu_window = (addgame.PlaylistAddGameWindow(
|
PlaylistAddGameWindow(
|
||||||
editcontroller=self,
|
editcontroller=self,
|
||||||
transition='in_left').get_root_widget())
|
transition='in_left').get_root_widget())
|
||||||
else:
|
else:
|
||||||
# Make sure type is in there.
|
# Make sure type is in there.
|
||||||
assert self._editing_game_type is not None
|
assert self._editing_game_type is not None
|
||||||
@ -220,7 +220,7 @@ class PlaylistEditController:
|
|||||||
self._selected_index = insert_index
|
self._selected_index = insert_index
|
||||||
|
|
||||||
ba.playsound(ba.getsound('gunCocking'))
|
ba.playsound(ba.getsound('gunCocking'))
|
||||||
ba.containerwidget(edit=ba.app.main_menu_window,
|
ba.app.ui.clear_main_menu_window(transition='out_right')
|
||||||
transition='out_right')
|
ba.app.ui.set_main_menu_window(
|
||||||
ba.app.main_menu_window = (pedit.PlaylistEditWindow(
|
PlaylistEditWindow(editcontroller=self,
|
||||||
editcontroller=self, transition='in_left').get_root_widget())
|
transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -151,7 +151,7 @@ class PlaylistEditGameWindow(ba.Window):
|
|||||||
'.addGameText') if is_add else ba.Lstr(
|
'.addGameText') if is_add else ba.Lstr(
|
||||||
resource='doneText'))
|
resource='doneText'))
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
pbtn = _ba.get_special_widget('party_button')
|
pbtn = _ba.get_special_widget('party_button')
|
||||||
ba.widget(edit=add_button, right_widget=pbtn, up_widget=pbtn)
|
ba.widget(edit=add_button, right_widget=pbtn, up_widget=pbtn)
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ class PlaylistEditGameWindow(ba.Window):
|
|||||||
position=(-8, height - 70 + y_extra2),
|
position=(-8, height - 70 + y_extra2),
|
||||||
size=(width, 25),
|
size=(width, 25),
|
||||||
text=gameclass.get_display_string(),
|
text=gameclass.get_display_string(),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=235,
|
maxwidth=235,
|
||||||
scale=1.1,
|
scale=1.1,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -451,10 +451,11 @@ class PlaylistEditGameWindow(ba.Window):
|
|||||||
|
|
||||||
# Replace ourself with the map-select UI.
|
# Replace ourself with the map-select UI.
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = PlaylistMapSelectWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
self._gameclass, self._sessiontype,
|
PlaylistMapSelectWindow(self._gameclass, self._sessiontype,
|
||||||
copy.deepcopy(self._getconfig()), self._edit_info,
|
copy.deepcopy(self._getconfig()),
|
||||||
self._completion_call).get_root_widget()
|
self._edit_info,
|
||||||
|
self._completion_call).get_root_widget())
|
||||||
|
|
||||||
def _choice_inc(self, setting_name: str, widget: ba.Widget,
|
def _choice_inc(self, setting_name: str, widget: ba.Widget,
|
||||||
setting: ba.ChoiceSetting, increment: int) -> None:
|
setting: ba.ChoiceSetting, increment: int) -> None:
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class PlaylistMapSelectWindow(ba.Window):
|
|||||||
subs=[('${GAME}',
|
subs=[('${GAME}',
|
||||||
self._gameclass.get_display_string())
|
self._gameclass.get_display_string())
|
||||||
]),
|
]),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
v = height - 70
|
v = height - 70
|
||||||
@ -182,7 +182,7 @@ class PlaylistMapSelectWindow(ba.Window):
|
|||||||
ba.widget(edit=btn, left_widget=self._cancel_button)
|
ba.widget(edit=btn, left_widget=self._cancel_button)
|
||||||
if y == 0:
|
if y == 0:
|
||||||
ba.widget(edit=btn, up_widget=self._cancel_button)
|
ba.widget(edit=btn, up_widget=self._cancel_button)
|
||||||
if x == columns - 1 and ba.app.toolbars:
|
if x == columns - 1 and ba.app.ui.use_toolbars:
|
||||||
ba.widget(
|
ba.widget(
|
||||||
edit=btn,
|
edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
@ -240,17 +240,18 @@ class PlaylistMapSelectWindow(ba.Window):
|
|||||||
self._refresh(select_get_more_maps_button=True)
|
self._refresh(select_get_more_maps_button=True)
|
||||||
|
|
||||||
def _select(self, map_name: str) -> None:
|
def _select(self, map_name: str) -> None:
|
||||||
from bastd.ui.playlist import editgame
|
from bastd.ui.playlist.editgame import PlaylistEditGameWindow
|
||||||
self._config['settings']['map'] = map_name
|
self._config['settings']['map'] = map_name
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (editgame.PlaylistEditGameWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
self._gameclass,
|
PlaylistEditGameWindow(
|
||||||
self._sessiontype,
|
self._gameclass,
|
||||||
self._config,
|
self._sessiontype,
|
||||||
self._completion_call,
|
self._config,
|
||||||
default_selection='map',
|
self._completion_call,
|
||||||
transition='in_left',
|
default_selection='map',
|
||||||
edit_info=self._edit_info).get_root_widget())
|
transition='in_left',
|
||||||
|
edit_info=self._edit_info).get_root_widget())
|
||||||
|
|
||||||
def _select_with_delay(self, map_name: str) -> None:
|
def _select_with_delay(self, map_name: str) -> None:
|
||||||
_ba.lock_all_input()
|
_ba.lock_all_input()
|
||||||
@ -260,13 +261,14 @@ class PlaylistMapSelectWindow(ba.Window):
|
|||||||
timetype=ba.TimeType.REAL)
|
timetype=ba.TimeType.REAL)
|
||||||
|
|
||||||
def _cancel(self) -> None:
|
def _cancel(self) -> None:
|
||||||
from bastd.ui.playlist import editgame
|
from bastd.ui.playlist.editgame import PlaylistEditGameWindow
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (editgame.PlaylistEditGameWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
self._gameclass,
|
PlaylistEditGameWindow(
|
||||||
self._sessiontype,
|
self._gameclass,
|
||||||
self._config,
|
self._sessiontype,
|
||||||
self._completion_call,
|
self._config,
|
||||||
default_selection='map',
|
self._completion_call,
|
||||||
transition='in_left',
|
default_selection='map',
|
||||||
edit_info=self._edit_info).get_root_widget())
|
transition='in_left',
|
||||||
|
edit_info=self._edit_info).get_root_widget())
|
||||||
|
|||||||
@ -115,7 +115,7 @@ class SharePlaylistResultsWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height * 0.745),
|
position=(self._width * 0.5, self._height * 0.745),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
flatness=1.0,
|
flatness=1.0,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -128,7 +128,7 @@ class SharePlaylistResultsWindow(ba.Window):
|
|||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height * 0.645),
|
position=(self._width * 0.5, self._height * 0.645),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
scale=0.6,
|
scale=0.6,
|
||||||
flatness=1.0,
|
flatness=1.0,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
maxwidth=300,
|
maxwidth=300,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=0.9,
|
scale=0.9,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -160,7 +160,7 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, self._height - 71),
|
position=(self._width * 0.5, self._height - 71),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.explanationText'),
|
text=ba.Lstr(resource=self._r + '.explanationText'),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
maxwidth=self._width * 0.83,
|
maxwidth=self._width * 0.83,
|
||||||
scale=0.6,
|
scale=0.6,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -188,19 +188,18 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
def _new_profile(self) -> None:
|
def _new_profile(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from ba.internal import have_pro_options
|
from ba.internal import have_pro_options
|
||||||
from bastd.ui.profile import edit as pedit
|
from bastd.ui.profile.edit import EditProfileWindow
|
||||||
from bastd.ui import purchase
|
from bastd.ui.purchase import PurchaseWindow
|
||||||
|
|
||||||
# Limit to a handful profiles if they don't have pro-options.
|
# Limit to a handful profiles if they don't have pro-options.
|
||||||
max_non_pro_profiles = _ba.get_account_misc_read_val('mnpp', 5)
|
max_non_pro_profiles = _ba.get_account_misc_read_val('mnpp', 5)
|
||||||
assert self._profiles is not None
|
assert self._profiles is not None
|
||||||
if (not have_pro_options()
|
if (not have_pro_options()
|
||||||
and len(self._profiles) >= max_non_pro_profiles):
|
and len(self._profiles) >= max_non_pro_profiles):
|
||||||
purchase.PurchaseWindow(items=['pro'],
|
PurchaseWindow(items=['pro'],
|
||||||
header_text=ba.Lstr(
|
header_text=ba.Lstr(
|
||||||
resource='unlockThisProfilesText',
|
resource='unlockThisProfilesText',
|
||||||
subs=[('${NUM}',
|
subs=[('${NUM}', str(max_non_pro_profiles))]))
|
||||||
str(max_non_pro_profiles))]))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Clamp at 100 profiles (otherwise the server will and that's less
|
# Clamp at 100 profiles (otherwise the server will and that's less
|
||||||
@ -215,9 +214,10 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (pedit.EditProfileWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
existing_profile=None,
|
EditProfileWindow(
|
||||||
in_main_menu=self._in_main_menu).get_root_widget())
|
existing_profile=None,
|
||||||
|
in_main_menu=self._in_main_menu).get_root_widget())
|
||||||
|
|
||||||
def _delete_profile(self) -> None:
|
def _delete_profile(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -253,7 +253,7 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
def _edit_profile(self) -> None:
|
def _edit_profile(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.profile import edit as pedit
|
from bastd.ui.profile.edit import EditProfileWindow
|
||||||
if self._selected_profile is None:
|
if self._selected_profile is None:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
ba.screenmessage(ba.Lstr(resource='nothingIsSelectedErrorText'),
|
ba.screenmessage(ba.Lstr(resource='nothingIsSelectedErrorText'),
|
||||||
@ -261,9 +261,10 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (pedit.EditProfileWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
self._selected_profile,
|
EditProfileWindow(
|
||||||
in_main_menu=self._in_main_menu).get_root_widget())
|
self._selected_profile,
|
||||||
|
in_main_menu=self._in_main_menu).get_root_widget())
|
||||||
|
|
||||||
def _select(self, name: str, index: int) -> None:
|
def _select(self, name: str, index: int) -> None:
|
||||||
del index # Unused.
|
del index # Unused.
|
||||||
@ -271,13 +272,13 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.account import settings
|
from bastd.ui.account.settings import AccountSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if self._in_main_menu:
|
if self._in_main_menu:
|
||||||
ba.app.main_menu_window = (settings.AccountSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
AccountSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
# If we're being called up standalone, handle pause/resume ourself.
|
# If we're being called up standalone, handle pause/resume ourself.
|
||||||
else:
|
else:
|
||||||
@ -363,13 +364,13 @@ class ProfileBrowserWindow(ba.Window):
|
|||||||
sel_name = 'Scroll'
|
sel_name = 'Scroll'
|
||||||
else:
|
else:
|
||||||
sel_name = 'Back'
|
sel_name = 'Back'
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(f'Error saving state for {self}.')
|
ba.print_exception(f'Error saving state for {self}.')
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
if sel_name == 'Scroll':
|
if sel_name == 'Scroll':
|
||||||
sel = self._scrollwidget
|
sel = self._scrollwidget
|
||||||
elif sel_name == 'New':
|
elif sel_name == 'New':
|
||||||
|
|||||||
@ -40,8 +40,9 @@ class EditProfileWindow(ba.Window):
|
|||||||
def reload_window(self) -> None:
|
def reload_window(self) -> None:
|
||||||
"""Transitions out and recreates ourself."""
|
"""Transitions out and recreates ourself."""
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = EditProfileWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
self.getname(), self._in_main_menu).get_root_widget()
|
EditProfileWindow(self.getname(),
|
||||||
|
self._in_main_menu).get_root_widget())
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
existing_profile: Optional[str],
|
existing_profile: Optional[str],
|
||||||
@ -102,7 +103,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
text=(ba.Lstr(resource=self._r + '.titleNewText')
|
text=(ba.Lstr(resource=self._r + '.titleNewText')
|
||||||
if existing_profile is None else ba.Lstr(
|
if existing_profile is None else ba.Lstr(
|
||||||
resource=self._r + '.titleEditText')),
|
resource=self._r + '.titleEditText')),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=290,
|
maxwidth=290,
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -211,7 +212,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, v - 39),
|
position=(self._width * 0.5, v - 39),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
scale=0.6,
|
scale=0.6,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=txtl,
|
text=txtl,
|
||||||
maxwidth=270,
|
maxwidth=270,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -258,7 +259,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
draw_controller=btn,
|
draw_controller=btn,
|
||||||
text=ba.Lstr(resource=self._r + '.iconText'),
|
text=ba.Lstr(resource=self._r + '.iconText'),
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=120)
|
maxwidth=120)
|
||||||
|
|
||||||
self._update_icon()
|
self._update_icon()
|
||||||
@ -281,7 +282,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, v - 39),
|
position=(self._width * 0.5, v - 39),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
scale=0.6,
|
scale=0.6,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=txtl,
|
text=txtl,
|
||||||
maxwidth=240,
|
maxwidth=240,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -322,7 +323,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, v - 43),
|
position=(self._width * 0.5, v - 43),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
scale=0.6,
|
scale=0.6,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
text=txtl,
|
text=txtl,
|
||||||
maxwidth=270,
|
maxwidth=270,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -379,7 +380,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
draw_controller=btn,
|
draw_controller=btn,
|
||||||
text=ba.Lstr(resource=self._r + '.colorText'),
|
text=ba.Lstr(resource=self._r + '.colorText'),
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=120)
|
maxwidth=120)
|
||||||
|
|
||||||
self._character_button = btn = ba.buttonwidget(
|
self._character_button = btn = ba.buttonwidget(
|
||||||
@ -403,7 +404,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
draw_controller=btn,
|
draw_controller=btn,
|
||||||
text=ba.Lstr(resource=self._r + '.characterText'),
|
text=ba.Lstr(resource=self._r + '.characterText'),
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=130)
|
maxwidth=130)
|
||||||
|
|
||||||
self._highlight_button = btn = ba.buttonwidget(
|
self._highlight_button = btn = ba.buttonwidget(
|
||||||
@ -436,7 +437,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
draw_controller=btn,
|
draw_controller=btn,
|
||||||
text=ba.Lstr(resource=self._r + '.highlightText'),
|
text=ba.Lstr(resource=self._r + '.highlightText'),
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=120)
|
maxwidth=120)
|
||||||
self._update_character()
|
self._update_character()
|
||||||
|
|
||||||
@ -559,12 +560,13 @@ class EditProfileWindow(ba.Window):
|
|||||||
tag=picker_type)
|
tag=picker_type)
|
||||||
|
|
||||||
def _cancel(self) -> None:
|
def _cancel(self) -> None:
|
||||||
from bastd.ui.profile import browser as pbrowser
|
from bastd.ui.profile.browser import ProfileBrowserWindow
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = pbrowser.ProfileBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
'in_left',
|
ProfileBrowserWindow(
|
||||||
selected_profile=self._existing_profile,
|
'in_left',
|
||||||
in_main_menu=self._in_main_menu).get_root_widget()
|
selected_profile=self._existing_profile,
|
||||||
|
in_main_menu=self._in_main_menu).get_root_widget())
|
||||||
|
|
||||||
def _set_color(self, color: Tuple[float, float, float]) -> None:
|
def _set_color(self, color: Tuple[float, float, float]) -> None:
|
||||||
self._color = color
|
self._color = color
|
||||||
@ -644,7 +646,7 @@ class EditProfileWindow(ba.Window):
|
|||||||
|
|
||||||
def save(self, transition_out: bool = True) -> bool:
|
def save(self, transition_out: bool = True) -> bool:
|
||||||
"""Save has been selected."""
|
"""Save has been selected."""
|
||||||
from bastd.ui.profile import browser as pbrowser
|
from bastd.ui.profile.browser import ProfileBrowserWindow
|
||||||
new_name = self.getname().strip()
|
new_name = self.getname().strip()
|
||||||
|
|
||||||
if not new_name:
|
if not new_name:
|
||||||
@ -681,8 +683,9 @@ class EditProfileWindow(ba.Window):
|
|||||||
if transition_out:
|
if transition_out:
|
||||||
_ba.run_transactions()
|
_ba.run_transactions()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (pbrowser.ProfileBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
'in_left',
|
ProfileBrowserWindow(
|
||||||
selected_profile=new_name,
|
'in_left',
|
||||||
in_main_menu=self._in_main_menu).get_root_widget())
|
selected_profile=new_name,
|
||||||
|
in_main_menu=self._in_main_menu).get_root_widget())
|
||||||
return True
|
return True
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r +
|
text=ba.Lstr(resource=self._r +
|
||||||
'.upgradeToGlobalProfileText'),
|
'.upgradeToGlobalProfileText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=self._width * 0.45,
|
maxwidth=self._width * 0.45,
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -95,7 +95,7 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r +
|
text=ba.Lstr(resource=self._r +
|
||||||
'.upgradeProfileInfoText'),
|
'.upgradeProfileInfoText'),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
maxwidth=self._width * 0.8,
|
maxwidth=self._width * 0.8,
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -125,7 +125,7 @@ class ProfileUpgradeWindow(ba.Window):
|
|||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
self._tickets_text: Optional[ba.Widget]
|
self._tickets_text: Optional[ba.Widget]
|
||||||
if not ba.app.toolbars:
|
if not ba.app.ui.use_toolbars:
|
||||||
self._tickets_text = ba.textwidget(
|
self._tickets_text = ba.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.9 - 5, self._height - 30),
|
position=(self._width * 0.9 - 5, self._height - 30),
|
||||||
|
|||||||
@ -110,24 +110,24 @@ class PromoCodeWindow(ba.Window):
|
|||||||
|
|
||||||
def _do_back(self) -> None:
|
def _do_back(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import advanced
|
from bastd.ui.settings.advanced import AdvancedSettingsWindow
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if not self._modal:
|
if not self._modal:
|
||||||
ba.app.main_menu_window = (advanced.AdvancedSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
AdvancedSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _activate_enter_button(self) -> None:
|
def _activate_enter_button(self) -> None:
|
||||||
self._enter_button.activate()
|
self._enter_button.activate()
|
||||||
|
|
||||||
def _do_enter(self) -> None:
|
def _do_enter(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import advanced
|
from bastd.ui.settings.advanced import AdvancedSettingsWindow
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if not self._modal:
|
if not self._modal:
|
||||||
ba.app.main_menu_window = (advanced.AdvancedSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
AdvancedSettingsWindow(transition='in_left').get_root_widget())
|
||||||
_ba.add_transaction({
|
_ba.add_transaction({
|
||||||
'type': 'PROMO_CODE',
|
'type': 'PROMO_CODE',
|
||||||
'expire_time': time.time() + 5,
|
'expire_time': time.time() + 5,
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
self._r = 'settingsWindowAdvanced'
|
self._r = 'settingsWindowAdvanced'
|
||||||
|
|
||||||
if app.toolbars and uiscale is ba.UIScale.SMALL:
|
if app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._do_back)
|
on_cancel_call=self._do_back)
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
@ -120,7 +120,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=ba.Lstr(resource=self._r +
|
text=ba.Lstr(resource=self._r +
|
||||||
'.titleText'),
|
'.titleText'),
|
||||||
color=app.title_color,
|
color=app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='top')
|
v_align='top')
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r + '.languageText'),
|
text=ba.Lstr(resource=self._r + '.languageText'),
|
||||||
maxwidth=150,
|
maxwidth=150,
|
||||||
scale=0.95,
|
scale=0.95,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='right',
|
h_align='right',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
for child in self._subcontainer.get_children():
|
for child in self._subcontainer.get_children():
|
||||||
ba.widget(edit=child, show_buffer_bottom=30, show_buffer_top=20)
|
ba.widget(edit=child, show_buffer_bottom=30, show_buffer_top=20)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
pbtn = _ba.get_special_widget('party_button')
|
pbtn = _ba.get_special_widget('party_button')
|
||||||
ba.widget(edit=self._scrollwidget, right_widget=pbtn)
|
ba.widget(edit=self._scrollwidget, right_widget=pbtn)
|
||||||
if self._back_button is None:
|
if self._back_button is None:
|
||||||
@ -523,18 +523,18 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
_ba.run_transactions()
|
_ba.run_transactions()
|
||||||
|
|
||||||
def _on_vr_test_press(self) -> None:
|
def _on_vr_test_press(self) -> None:
|
||||||
from bastd.ui.settings import vrtesting
|
from bastd.ui.settings.vrtesting import VRTestingWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (vrtesting.VRTestingWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_right').get_root_widget())
|
VRTestingWindow(transition='in_right').get_root_widget())
|
||||||
|
|
||||||
def _on_net_test_press(self) -> None:
|
def _on_net_test_press(self) -> None:
|
||||||
from bastd.ui.settings import nettesting
|
from bastd.ui.settings.nettesting import NetTestingWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (nettesting.NetTestingWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_right').get_root_widget())
|
NetTestingWindow(transition='in_right').get_root_widget())
|
||||||
|
|
||||||
def _on_friend_promo_code_press(self) -> None:
|
def _on_friend_promo_code_press(self) -> None:
|
||||||
from bastd.ui import appinvite
|
from bastd.ui import appinvite
|
||||||
@ -545,24 +545,25 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
appinvite.handle_app_invites_press()
|
appinvite.handle_app_invites_press()
|
||||||
|
|
||||||
def _on_promo_code_press(self) -> None:
|
def _on_promo_code_press(self) -> None:
|
||||||
from bastd.ui import promocode
|
from bastd.ui.promocode import PromoCodeWindow
|
||||||
from bastd.ui import account
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
|
|
||||||
# We have to be logged in for promo-codes to work.
|
# We have to be logged in for promo-codes to work.
|
||||||
if _ba.get_account_state() != 'signed_in':
|
if _ba.get_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (promocode.PromoCodeWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._promo_code_button).get_root_widget())
|
PromoCodeWindow(
|
||||||
|
origin_widget=self._promo_code_button).get_root_widget())
|
||||||
|
|
||||||
def _on_benchmark_press(self) -> None:
|
def _on_benchmark_press(self) -> None:
|
||||||
from bastd.ui import debug
|
from bastd.ui.debug import DebugWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (debug.DebugWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_right').get_root_widget())
|
DebugWindow(transition='in_right').get_root_widget())
|
||||||
|
|
||||||
def _save_state(self) -> None:
|
def _save_state(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
@ -603,7 +604,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
sel_name = 'Back'
|
sel_name = 'Back'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection \'{sel}\'')
|
raise ValueError(f'unrecognized selection \'{sel}\'')
|
||||||
ba.app.window_states[self.__class__.__name__] = {
|
ba.app.ui.window_states[self.__class__.__name__] = {
|
||||||
'sel_name': sel_name
|
'sel_name': sel_name
|
||||||
}
|
}
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -612,8 +613,8 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__,
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__,
|
||||||
{}).get('sel_name')
|
{}).get('sel_name')
|
||||||
if sel_name == 'Back':
|
if sel_name == 'Back':
|
||||||
sel = self._back_button
|
sel = self._back_button
|
||||||
else:
|
else:
|
||||||
@ -678,9 +679,9 @@ class AdvancedSettingsWindow(ba.Window):
|
|||||||
timetype=ba.TimeType.REAL)
|
timetype=ba.TimeType.REAL)
|
||||||
|
|
||||||
def _do_back(self) -> None:
|
def _do_back(self) -> None:
|
||||||
from bastd.ui.settings import allsettings
|
from bastd.ui.settings.allsettings import AllSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (allsettings.AllSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
AllSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -72,7 +72,7 @@ class AllSettingsWindow(ba.Window):
|
|||||||
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
||||||
stack_offset=(0, -8) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
stack_offset=(0, -8) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
||||||
|
|
||||||
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._do_back)
|
on_cancel_call=self._do_back)
|
||||||
@ -93,7 +93,7 @@ class AllSettingsWindow(ba.Window):
|
|||||||
position=(0, height - 44),
|
position=(0, height - 44),
|
||||||
size=(width, 25),
|
size=(width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=130)
|
maxwidth=130)
|
||||||
@ -136,7 +136,7 @@ class AllSettingsWindow(ba.Window):
|
|||||||
button_type='square',
|
button_type='square',
|
||||||
label='',
|
label='',
|
||||||
on_activate_call=self._do_controllers)
|
on_activate_call=self._do_controllers)
|
||||||
if ba.app.toolbars and self._back_button is None:
|
if ba.app.ui.use_toolbars and self._back_button is None:
|
||||||
bbtn = _ba.get_special_widget('back_button')
|
bbtn = _ba.get_special_widget('back_button')
|
||||||
ba.widget(edit=ctb, left_widget=bbtn)
|
ba.widget(edit=ctb, left_widget=bbtn)
|
||||||
_b_title(x_offs2, v, ctb,
|
_b_title(x_offs2, v, ctb,
|
||||||
@ -156,7 +156,7 @@ class AllSettingsWindow(ba.Window):
|
|||||||
button_type='square',
|
button_type='square',
|
||||||
label='',
|
label='',
|
||||||
on_activate_call=self._do_graphics)
|
on_activate_call=self._do_graphics)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
pbtn = _ba.get_special_widget('party_button')
|
pbtn = _ba.get_special_widget('party_button')
|
||||||
ba.widget(edit=gfxb, up_widget=pbtn, right_widget=pbtn)
|
ba.widget(edit=gfxb, up_widget=pbtn, right_widget=pbtn)
|
||||||
_b_title(x_offs3, v, gfxb, ba.Lstr(resource=self._r + '.graphicsText'))
|
_b_title(x_offs3, v, gfxb, ba.Lstr(resource=self._r + '.graphicsText'))
|
||||||
@ -220,40 +220,44 @@ class AllSettingsWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _do_controllers(self) -> None:
|
def _do_controllers(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings.controls import ControlsSettingsWindow
|
from bastd.ui.settings.controls import ControlsSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._controllers_button).get_root_widget())
|
ControlsSettingsWindow(
|
||||||
|
origin_widget=self._controllers_button).get_root_widget())
|
||||||
|
|
||||||
def _do_graphics(self) -> None:
|
def _do_graphics(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings.graphics import GraphicsSettingsWindow
|
from bastd.ui.settings.graphics import GraphicsSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (GraphicsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._graphics_button).get_root_widget())
|
GraphicsSettingsWindow(
|
||||||
|
origin_widget=self._graphics_button).get_root_widget())
|
||||||
|
|
||||||
def _do_audio(self) -> None:
|
def _do_audio(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings.audio import AudioSettingsWindow
|
from bastd.ui.settings.audio import AudioSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (AudioSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._audio_button).get_root_widget())
|
AudioSettingsWindow(
|
||||||
|
origin_widget=self._audio_button).get_root_widget())
|
||||||
|
|
||||||
def _do_advanced(self) -> None:
|
def _do_advanced(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings.advanced import AdvancedSettingsWindow
|
from bastd.ui.settings.advanced import AdvancedSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (AdvancedSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._advanced_button).get_root_widget())
|
AdvancedSettingsWindow(
|
||||||
|
origin_widget=self._advanced_button).get_root_widget())
|
||||||
|
|
||||||
def _save_state(self) -> None:
|
def _save_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
@ -270,7 +274,7 @@ class AllSettingsWindow(ba.Window):
|
|||||||
sel_name = 'Back'
|
sel_name = 'Back'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection \'{sel}\'')
|
raise ValueError(f'unrecognized selection \'{sel}\'')
|
||||||
ba.app.window_states[self.__class__.__name__] = {
|
ba.app.ui.window_states[self.__class__.__name__] = {
|
||||||
'sel_name': sel_name
|
'sel_name': sel_name
|
||||||
}
|
}
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -278,8 +282,8 @@ class AllSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__,
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__,
|
||||||
{}).get('sel_name')
|
{}).get('sel_name')
|
||||||
sel: Optional[ba.Widget]
|
sel: Optional[ba.Widget]
|
||||||
if sel_name == 'Controllers':
|
if sel_name == 'Controllers':
|
||||||
sel = self._controllers_button
|
sel = self._controllers_button
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class AudioSettingsWindow(ba.Window):
|
|||||||
position=(width * 0.5, height - 32),
|
position=(width * 0.5, height - 32),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=180,
|
maxwidth=180,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -122,7 +122,7 @@ class AudioSettingsWindow(ba.Window):
|
|||||||
minval=0.0,
|
minval=0.0,
|
||||||
maxval=1.0,
|
maxval=1.0,
|
||||||
increment=0.1)
|
increment=0.1)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=svne.plusbutton,
|
ba.widget(edit=svne.plusbutton,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
v -= spacing
|
v -= spacing
|
||||||
@ -237,8 +237,9 @@ class AudioSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (stb.SoundtrackBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
origin_widget=self._soundtrack_button).get_root_widget())
|
stb.SoundtrackBrowserWindow(
|
||||||
|
origin_widget=self._soundtrack_button).get_root_widget())
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -246,8 +247,9 @@ class AudioSettingsWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (allsettings.AllSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
allsettings.AllSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _save_state(self) -> None:
|
def _save_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
@ -268,13 +270,13 @@ class AudioSettingsWindow(ba.Window):
|
|||||||
sel_name = 'VRHeadRelative'
|
sel_name = 'VRHeadRelative'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection \'{sel}\'')
|
raise ValueError(f'unrecognized selection \'{sel}\'')
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(f'Error saving state for {self.__class__}.')
|
ba.print_exception(f'Error saving state for {self.__class__}.')
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
sel: Optional[ba.Widget]
|
sel: Optional[ba.Widget]
|
||||||
if sel_name == 'SoundMinus':
|
if sel_name == 'SoundMinus':
|
||||||
sel = self._sound_volume_numedit.minusbutton
|
sel = self._sound_volume_numedit.minusbutton
|
||||||
|
|||||||
@ -178,7 +178,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
position=(0, height - 49),
|
position=(0, height - 49),
|
||||||
size=(width, 25),
|
size=(width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='top')
|
v_align='top')
|
||||||
ba.buttonwidget(edit=btn,
|
ba.buttonwidget(edit=btn,
|
||||||
@ -197,7 +197,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.configureTouchText'),
|
label=ba.Lstr(resource=self._r + '.configureTouchText'),
|
||||||
on_activate_call=self._do_touchscreen)
|
on_activate_call=self._do_touchscreen)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if not self._have_selected_child:
|
if not self._have_selected_child:
|
||||||
@ -216,7 +216,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.configureControllersText'),
|
label=ba.Lstr(resource=self._r + '.configureControllersText'),
|
||||||
on_activate_call=self._do_gamepads)
|
on_activate_call=self._do_gamepads)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if not self._have_selected_child:
|
if not self._have_selected_child:
|
||||||
@ -240,7 +240,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.configureKeyboardText'),
|
label=ba.Lstr(resource=self._r + '.configureKeyboardText'),
|
||||||
on_activate_call=self._config_keyboard)
|
on_activate_call=self._config_keyboard)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if not self._have_selected_child:
|
if not self._have_selected_child:
|
||||||
@ -269,7 +269,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.configureMobileText'),
|
label=ba.Lstr(resource=self._r + '.configureMobileText'),
|
||||||
on_activate_call=self._do_mobile_devices)
|
on_activate_call=self._do_mobile_devices)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if not self._have_selected_child:
|
if not self._have_selected_child:
|
||||||
@ -287,7 +287,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.ps3Text'),
|
label=ba.Lstr(resource=self._r + '.ps3Text'),
|
||||||
on_activate_call=self._do_ps3_controllers)
|
on_activate_call=self._do_ps3_controllers)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
v -= spacing
|
v -= spacing
|
||||||
@ -299,7 +299,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.xbox360Text'),
|
label=ba.Lstr(resource=self._r + '.xbox360Text'),
|
||||||
on_activate_call=self._do_360_controllers)
|
on_activate_call=self._do_360_controllers)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
v -= spacing
|
v -= spacing
|
||||||
@ -311,7 +311,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource=self._r + '.wiimotesText'),
|
label=ba.Lstr(resource=self._r + '.wiimotesText'),
|
||||||
on_activate_call=self._do_wiimotes)
|
on_activate_call=self._do_wiimotes)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn,
|
ba.widget(edit=btn,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
v -= spacing
|
v -= spacing
|
||||||
@ -342,7 +342,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
scale=0.5,
|
scale=0.5,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
maxwidth=width * 0.8)
|
maxwidth=width * 0.8)
|
||||||
v -= spacing
|
v -= spacing
|
||||||
if show_mac_controller_subsystem:
|
if show_mac_controller_subsystem:
|
||||||
@ -369,7 +369,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
scale=1.0,
|
scale=1.0,
|
||||||
h_align='right',
|
h_align='right',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
maxwidth=180)
|
maxwidth=180)
|
||||||
ba.textwidget(
|
ba.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
@ -379,7 +379,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
scale=0.5,
|
scale=0.5,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
maxwidth=width * 0.8)
|
maxwidth=width * 0.8)
|
||||||
v -= spacing
|
v -= spacing
|
||||||
self._restore_state()
|
self._restore_state()
|
||||||
@ -391,67 +391,69 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
def _config_keyboard(self) -> None:
|
def _config_keyboard(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import keyboard
|
from bastd.ui.settings.keyboard import ConfigKeyboardWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (keyboard.ConfigKeyboardWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
_ba.getinputdevice('Keyboard', '#1')).get_root_widget())
|
ConfigKeyboardWindow(_ba.getinputdevice('Keyboard',
|
||||||
|
'#1')).get_root_widget())
|
||||||
|
|
||||||
def _config_keyboard2(self) -> None:
|
def _config_keyboard2(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import keyboard
|
from bastd.ui.settings.keyboard import ConfigKeyboardWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (keyboard.ConfigKeyboardWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
_ba.getinputdevice('Keyboard', '#2')).get_root_widget())
|
ConfigKeyboardWindow(_ba.getinputdevice('Keyboard',
|
||||||
|
'#2')).get_root_widget())
|
||||||
|
|
||||||
def _do_mobile_devices(self) -> None:
|
def _do_mobile_devices(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import remoteapp
|
from bastd.ui.settings.remoteapp import RemoteAppSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
remoteapp.RemoteAppSettingsWindow().get_root_widget())
|
RemoteAppSettingsWindow().get_root_widget())
|
||||||
|
|
||||||
def _do_ps3_controllers(self) -> None:
|
def _do_ps3_controllers(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import ps3controller
|
from bastd.ui.settings.ps3controller import PS3ControllerSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
ps3controller.PS3ControllerSettingsWindow().get_root_widget())
|
PS3ControllerSettingsWindow().get_root_widget())
|
||||||
|
|
||||||
def _do_360_controllers(self) -> None:
|
def _do_360_controllers(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import xbox360controller as xbox
|
from bastd.ui.settings.xbox360controller import (
|
||||||
|
XBox360ControllerSettingsWindow)
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
xbox.XBox360ControllerSettingsWindow().get_root_widget())
|
XBox360ControllerSettingsWindow().get_root_widget())
|
||||||
|
|
||||||
def _do_wiimotes(self) -> None:
|
def _do_wiimotes(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import wiimote
|
from bastd.ui.settings.wiimote import WiimoteSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
wiimote.WiimoteSettingsWindow().get_root_widget())
|
WiimoteSettingsWindow().get_root_widget())
|
||||||
|
|
||||||
def _do_gamepads(self) -> None:
|
def _do_gamepads(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import gamepadselect
|
from bastd.ui.settings.gamepadselect import GamepadSelectWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(GamepadSelectWindow().get_root_widget())
|
||||||
gamepadselect.GamepadSelectWindow().get_root_widget())
|
|
||||||
|
|
||||||
def _do_touchscreen(self) -> None:
|
def _do_touchscreen(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import touchscreen
|
from bastd.ui.settings.touchscreen import TouchscreenSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
touchscreen.TouchscreenSettingsWindow().get_root_widget())
|
TouchscreenSettingsWindow().get_root_widget())
|
||||||
|
|
||||||
def _save_state(self) -> None:
|
def _save_state(self) -> None:
|
||||||
sel = self._root_widget.get_selected_child()
|
sel = self._root_widget.get_selected_child()
|
||||||
@ -473,10 +475,10 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
sel_name = 'Wiimotes'
|
sel_name = 'Wiimotes'
|
||||||
else:
|
else:
|
||||||
sel_name = 'Back'
|
sel_name = 'Back'
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
if sel_name == 'GamePads':
|
if sel_name == 'GamePads':
|
||||||
sel = self._gamepads_button
|
sel = self._gamepads_button
|
||||||
elif sel_name == 'Touch':
|
elif sel_name == 'Touch':
|
||||||
@ -502,9 +504,9 @@ class ControlsSettingsWindow(ba.Window):
|
|||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui.settings import allsettings
|
from bastd.ui.settings.allsettings import AllSettingsWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = allsettings.AllSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget()
|
AllSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -202,7 +202,7 @@ class GamepadSettingsWindow(ba.Window):
|
|||||||
position=(0, v + 5),
|
position=(0, v + 5),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=310,
|
maxwidth=310,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -212,7 +212,7 @@ class GamepadSettingsWindow(ba.Window):
|
|||||||
position=(0, v + 3),
|
position=(0, v + 3),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=self._name,
|
text=self._name,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
maxwidth=self._width * 0.9,
|
maxwidth=self._width * 0.9,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -235,7 +235,7 @@ class GamepadSettingsWindow(ba.Window):
|
|||||||
position=(0, v + 5),
|
position=(0, v + 5),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.secondaryText'),
|
text=ba.Lstr(resource=self._r + '.secondaryText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=300,
|
maxwidth=300,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -710,12 +710,12 @@ class GamepadSettingsWindow(ba.Window):
|
|||||||
return btn
|
return btn
|
||||||
|
|
||||||
def _cancel(self) -> None:
|
def _cancel(self) -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings.controls import ControlsSettingsWindow
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if self._is_main_menu:
|
if self._is_main_menu:
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
ControlsSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _save(self) -> None:
|
def _save(self) -> None:
|
||||||
from ba.internal import (master_server_post, get_input_device_config,
|
from ba.internal import (master_server_post, get_input_device_config,
|
||||||
@ -758,9 +758,9 @@ class GamepadSettingsWindow(ba.Window):
|
|||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
|
|
||||||
if self._is_main_menu:
|
if self._is_main_menu:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings.controls import ControlsSettingsWindow
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
ControlsSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
|
|
||||||
class AwaitGamepadInputWindow(ba.Window):
|
class AwaitGamepadInputWindow(ba.Window):
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class GamepadAdvancedSettingsWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.advancedTitleText'),
|
text=ba.Lstr(resource=self._r + '.advancedTitleText'),
|
||||||
maxwidth=320,
|
maxwidth=320,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None:
|
|||||||
return
|
return
|
||||||
_ba.release_gamepad_input()
|
_ba.release_gamepad_input()
|
||||||
try:
|
try:
|
||||||
ba.containerwidget(edit=ba.app.main_menu_window, transition='out_left')
|
ba.app.ui.clear_main_menu_window(transition='out_left')
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception('Error transitioning out main_menu_window.')
|
ba.print_exception('Error transitioning out main_menu_window.')
|
||||||
ba.playsound(ba.getsound('activateBeep'))
|
ba.playsound(ba.getsound('activateBeep'))
|
||||||
@ -49,18 +49,19 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None:
|
|||||||
inputdevice = event['input_device']
|
inputdevice = event['input_device']
|
||||||
assert isinstance(inputdevice, ba.InputDevice)
|
assert isinstance(inputdevice, ba.InputDevice)
|
||||||
if inputdevice.allows_configuring:
|
if inputdevice.allows_configuring:
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
gamepad.GamepadSettingsWindow(inputdevice).get_root_widget())
|
gamepad.GamepadSettingsWindow(inputdevice).get_root_widget())
|
||||||
else:
|
else:
|
||||||
width = 700
|
width = 700
|
||||||
height = 200
|
height = 200
|
||||||
button_width = 100
|
button_width = 100
|
||||||
uiscale = ba.app.uiscale
|
uiscale = ba.app.uiscale
|
||||||
ba.app.main_menu_window = dlg = (ba.containerwidget(
|
dlg = (ba.containerwidget(
|
||||||
scale=(1.7 if uiscale is ba.UIScale.SMALL else
|
scale=(1.7 if uiscale is ba.UIScale.SMALL else
|
||||||
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
||||||
size=(width, height),
|
size=(width, height),
|
||||||
transition='in_right'))
|
transition='in_right'))
|
||||||
|
ba.app.ui.set_main_menu_window(dlg)
|
||||||
device_name = inputdevice.name
|
device_name = inputdevice.name
|
||||||
if device_name == 'iDevice':
|
if device_name == 'iDevice':
|
||||||
msg = ba.Lstr(resource='bsRemoteConfigureInAppText',
|
msg = ba.Lstr(resource='bsRemoteConfigureInAppText',
|
||||||
@ -79,8 +80,9 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None:
|
|||||||
def _ok() -> None:
|
def _ok() -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
ba.containerwidget(edit=dlg, transition='out_right')
|
ba.containerwidget(edit=dlg, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
ba.buttonwidget(parent=dlg,
|
ba.buttonwidget(parent=dlg,
|
||||||
position=((width - button_width) / 2, 20),
|
position=((width - button_width) / 2, 20),
|
||||||
@ -124,7 +126,7 @@ class GamepadSelectWindow(ba.Window):
|
|||||||
size=(width, 25),
|
size=(width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
maxwidth=250,
|
maxwidth=250,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -141,7 +143,7 @@ class GamepadSelectWindow(ba.Window):
|
|||||||
scale=0.8,
|
scale=0.8,
|
||||||
text=ba.Lstr(resource=self._r + '.pressAnyButtonText'),
|
text=ba.Lstr(resource=self._r + '.pressAnyButtonText'),
|
||||||
maxwidth=width * 0.95,
|
maxwidth=width * 0.95,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='top')
|
v_align='top')
|
||||||
v -= spacing * 1.24
|
v -= spacing * 1.24
|
||||||
@ -162,5 +164,6 @@ class GamepadSelectWindow(ba.Window):
|
|||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
_ba.release_gamepad_input()
|
_ba.release_gamepad_input()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -112,7 +112,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
position=(0, height - 44),
|
position=(0, height - 44),
|
||||||
size=(width, 25),
|
size=(width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='top')
|
v_align='top')
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
increment=0.1,
|
increment=0.1,
|
||||||
xoffset=-70,
|
xoffset=-70,
|
||||||
textscale=0.85)
|
textscale=0.85)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=gmc.plusbutton,
|
ba.widget(edit=gmc.plusbutton,
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if not self._have_selected_child:
|
if not self._have_selected_child:
|
||||||
@ -172,7 +172,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
position=(60, v),
|
position=(60, v),
|
||||||
size=(160, 25),
|
size=(160, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.visualsText'),
|
text=ba.Lstr(resource=self._r + '.visualsText'),
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.65,
|
scale=0.65,
|
||||||
maxwidth=150,
|
maxwidth=150,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -200,7 +200,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
position=(230, v),
|
position=(230, v),
|
||||||
size=(160, 25),
|
size=(160, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.texturesText'),
|
text=ba.Lstr(resource=self._r + '.texturesText'),
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.65,
|
scale=0.65,
|
||||||
maxwidth=150,
|
maxwidth=150,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -219,7 +219,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
],
|
],
|
||||||
current_choice=ba.app.config.resolve('Texture Quality'),
|
current_choice=ba.app.config.resolve('Texture Quality'),
|
||||||
on_value_change_call=self._set_textures)
|
on_value_change_call=self._set_textures)
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=textures_popup.get_button(),
|
ba.widget(edit=textures_popup.get_button(),
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
v -= 80
|
v -= 80
|
||||||
@ -232,7 +232,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
position=(h_offs + 60, v),
|
position=(h_offs + 60, v),
|
||||||
size=(160, 25),
|
size=(160, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.resolutionText'),
|
text=ba.Lstr(resource=self._r + '.resolutionText'),
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.65,
|
scale=0.65,
|
||||||
maxwidth=150,
|
maxwidth=150,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -306,7 +306,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
position=(230, v),
|
position=(230, v),
|
||||||
size=(160, 25),
|
size=(160, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.verticalSyncText'),
|
text=ba.Lstr(resource=self._r + '.verticalSyncText'),
|
||||||
color=ba.app.heading_color,
|
color=ba.app.ui.heading_color,
|
||||||
scale=0.65,
|
scale=0.65,
|
||||||
maxwidth=150,
|
maxwidth=150,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -367,8 +367,9 @@ class GraphicsSettingsWindow(ba.Window):
|
|||||||
from bastd.ui.settings import allsettings
|
from bastd.ui.settings import allsettings
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (allsettings.AllSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
allsettings.AllSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _set_quality(self, quality: str) -> None:
|
def _set_quality(self, quality: str) -> None:
|
||||||
cfg = ba.app.config
|
cfg = ba.app.config
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class ConfigKeyboardWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.configuringText',
|
text=ba.Lstr(resource=self._r + '.configuringText',
|
||||||
subs=[('${DEVICE}', self._displayname)]),
|
subs=[('${DEVICE}', self._displayname)]),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=270,
|
maxwidth=270,
|
||||||
@ -120,7 +120,7 @@ class ConfigKeyboardWindow(ba.Window):
|
|||||||
scale=0.7,
|
scale=0.7,
|
||||||
maxwidth=self._width * 0.75,
|
maxwidth=self._width * 0.75,
|
||||||
max_height=110,
|
max_height=110,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='top')
|
v_align='top')
|
||||||
v -= 40
|
v -= 40
|
||||||
@ -226,8 +226,8 @@ class ConfigKeyboardWindow(ba.Window):
|
|||||||
def _cancel(self) -> None:
|
def _cancel(self) -> None:
|
||||||
from bastd.ui.settings.controls import ControlsSettingsWindow
|
from bastd.ui.settings.controls import ControlsSettingsWindow
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
ControlsSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _save(self) -> None:
|
def _save(self) -> None:
|
||||||
from bastd.ui.settings.controls import ControlsSettingsWindow
|
from bastd.ui.settings.controls import ControlsSettingsWindow
|
||||||
@ -257,8 +257,8 @@ class ConfigKeyboardWindow(ba.Window):
|
|||||||
'v': 2
|
'v': 2
|
||||||
})
|
})
|
||||||
ba.app.config.apply_and_commit()
|
ba.app.config.apply_and_commit()
|
||||||
ba.app.main_menu_window = (ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
ControlsSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
|
|
||||||
class AwaitKeyboardInputWindow(ba.Window):
|
class AwaitKeyboardInputWindow(ba.Window):
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class PS3ControllerSettingsWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r + '.titleText',
|
text=ba.Lstr(resource=self._r + '.titleText',
|
||||||
subs=[('${APP_NAME}',
|
subs=[('${APP_NAME}',
|
||||||
ba.Lstr(resource='titleText'))]),
|
ba.Lstr(resource='titleText'))]),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -120,5 +120,6 @@ class PS3ControllerSettingsWindow(ba.Window):
|
|||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class RemoteAppSettingsWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
maxwidth=370,
|
maxwidth=370,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=0.8,
|
scale=0.8,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -131,5 +131,6 @@ class RemoteAppSettingsWindow(ba.Window):
|
|||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class TestingWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 35),
|
position=(self._width * 0.5, self._height - 35),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=245,
|
maxwidth=245,
|
||||||
@ -77,7 +77,7 @@ class TestingWindow(ba.Window):
|
|||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 75),
|
position=(self._width * 0.5, self._height - 75),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=self._width * 0.75,
|
maxwidth=self._width * 0.75,
|
||||||
@ -194,6 +194,6 @@ class TestingWindow(ba.Window):
|
|||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
import bastd.ui.settings.advanced
|
import bastd.ui.settings.advanced
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (
|
ba.app.ui.set_main_menu_window(
|
||||||
bastd.ui.settings.advanced.AdvancedSettingsWindow(
|
bastd.ui.settings.advanced.AdvancedSettingsWindow(
|
||||||
transition='in_left').get_root_widget())
|
transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class TouchscreenSettingsWindow(ba.Window):
|
|||||||
position=(25, self._height - 50),
|
position=(25, self._height - 50),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=280,
|
maxwidth=280,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -251,6 +251,7 @@ class TouchscreenSettingsWindow(ba.Window):
|
|||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
_ba.set_touchscreen_editing(False)
|
_ba.set_touchscreen_editing(False)
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class WiimoteSettingsWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
maxwidth=270,
|
maxwidth=270,
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -108,8 +108,9 @@ class WiimoteSettingsWindow(ba.Window):
|
|||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
|
|
||||||
class WiimoteListenWindow(ba.Window):
|
class WiimoteListenWindow(ba.Window):
|
||||||
@ -131,12 +132,12 @@ class WiimoteListenWindow(ba.Window):
|
|||||||
ba.containerwidget(edit=self._root_widget, cancel_button=btn)
|
ba.containerwidget(edit=self._root_widget, cancel_button=btn)
|
||||||
_ba.start_listening_for_wii_remotes()
|
_ba.start_listening_for_wii_remotes()
|
||||||
self._wiimote_connect_counter = 15
|
self._wiimote_connect_counter = 15
|
||||||
ba.app.dismiss_wii_remotes_window_call = ba.WeakCall(self._dismiss)
|
ba.app.ui.dismiss_wii_remotes_window_call = ba.WeakCall(self._dismiss)
|
||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(15, height - 55),
|
position=(15, height - 55),
|
||||||
size=(width - 30, 30),
|
size=(width - 30, 30),
|
||||||
text=ba.Lstr(resource=self._r + '.listeningText'),
|
text=ba.Lstr(resource=self._r + '.listeningText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=320,
|
maxwidth=320,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -204,7 +205,7 @@ class WiimoteLicenseWindow(ba.Window):
|
|||||||
size=(width, 30),
|
size=(width, 30),
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
v_align='center')
|
v_align='center')
|
||||||
license_text = (
|
license_text = (
|
||||||
'Copyright (c) 2007, DarwiinRemote Team\n'
|
'Copyright (c) 2007, DarwiinRemote Team\n'
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class XBox360ControllerSettingsWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r + '.titleText',
|
text=ba.Lstr(resource=self._r + '.titleText',
|
||||||
subs=[('${APP_NAME}',
|
subs=[('${APP_NAME}',
|
||||||
ba.Lstr(resource='titleText'))]),
|
ba.Lstr(resource='titleText'))]),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=400,
|
maxwidth=400,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -128,5 +128,6 @@ class XBox360ControllerSettingsWindow(ba.Window):
|
|||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui.settings import controls
|
from bastd.ui.settings import controls
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (controls.ControlsSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
controls.ControlsSettingsWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||||||
1.6 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
1.6 if uiscale is ba.UIScale.MEDIUM else 1.0),
|
||||||
stack_offset=(0, -18) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
stack_offset=(0, -18) if uiscale is ba.UIScale.SMALL else (0, 0)))
|
||||||
|
|
||||||
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
|
if ba.app.ui.use_toolbars and uiscale is ba.UIScale.SMALL:
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
else:
|
else:
|
||||||
self._back_button = ba.buttonwidget(
|
self._back_button = ba.buttonwidget(
|
||||||
@ -90,7 +90,7 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
maxwidth=300,
|
maxwidth=300,
|
||||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||||||
ba.widget(edit=self._scrollwidget,
|
ba.widget(edit=self._scrollwidget,
|
||||||
left_widget=self._new_button,
|
left_widget=self._new_button,
|
||||||
right_widget=_ba.get_special_widget('party_button')
|
right_widget=_ba.get_special_widget('party_button')
|
||||||
if ba.app.toolbars else self._scrollwidget)
|
if ba.app.ui.use_toolbars else self._scrollwidget)
|
||||||
self._col = ba.columnwidget(parent=scrollwidget)
|
self._col = ba.columnwidget(parent=scrollwidget)
|
||||||
|
|
||||||
self._soundtracks: Optional[Dict[str, Any]] = None
|
self._soundtracks: Optional[Dict[str, Any]] = None
|
||||||
@ -337,8 +337,8 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (audio.AudioSettingsWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
audio.AudioSettingsWindow(transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _edit_soundtrack_with_sound(self) -> None:
|
def _edit_soundtrack_with_sound(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -369,8 +369,10 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (stedit.SoundtrackEditWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
existing_soundtrack=self._selected_soundtrack).get_root_widget())
|
stedit.SoundtrackEditWindow(
|
||||||
|
existing_soundtrack=self._selected_soundtrack).get_root_widget(
|
||||||
|
))
|
||||||
|
|
||||||
def _get_soundtrack_display_name(self, soundtrack: str) -> ba.Lstr:
|
def _get_soundtrack_display_name(self, soundtrack: str) -> ba.Lstr:
|
||||||
if soundtrack == '__default__':
|
if soundtrack == '__default__':
|
||||||
@ -485,13 +487,13 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||||||
sel_name = 'Back'
|
sel_name = 'Back'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection \'{sel}\'')
|
raise ValueError(f'unrecognized selection \'{sel}\'')
|
||||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
ba.app.ui.window_states[self.__class__.__name__] = sel_name
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(f'Error saving state for {self}.')
|
ba.print_exception(f'Error saving state for {self}.')
|
||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__)
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__)
|
||||||
if sel_name == 'Scroll':
|
if sel_name == 'Scroll':
|
||||||
sel = self._scrollwidget
|
sel = self._scrollwidget
|
||||||
elif sel_name == 'New':
|
elif sel_name == 'New':
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class SoundtrackEditWindow(ba.Window):
|
|||||||
text=ba.Lstr(resource=self._r +
|
text=ba.Lstr(resource=self._r +
|
||||||
('.editSoundtrackText' if existing_soundtrack
|
('.editSoundtrackText' if existing_soundtrack
|
||||||
is not None else '.newSoundtrackText')),
|
is not None else '.newSoundtrackText')),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=280)
|
maxwidth=280)
|
||||||
@ -310,8 +310,8 @@ class SoundtrackEditWindow(ba.Window):
|
|||||||
else:
|
else:
|
||||||
soundtrack[musictype] = entry
|
soundtrack[musictype] = entry
|
||||||
|
|
||||||
ba.app.main_menu_window = (cls(state,
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
cls(state, transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _get_entry(self, song_type: str, entry: Any,
|
def _get_entry(self, song_type: str, entry: Any,
|
||||||
selection_target_name: str) -> None:
|
selection_target_name: str) -> None:
|
||||||
@ -325,7 +325,7 @@ class SoundtrackEditWindow(ba.Window):
|
|||||||
'last_edited_song_type': song_type
|
'last_edited_song_type': song_type
|
||||||
}
|
}
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
ba.app.main_menu_window = (music.get_music_player().select_entry(
|
ba.app.ui.set_main_menu_window(music.get_music_player().select_entry(
|
||||||
ba.Call(self._restore_editor, state, song_type), entry,
|
ba.Call(self._restore_editor, state, song_type), entry,
|
||||||
selection_target_name).get_root_widget())
|
selection_target_name).get_root_widget())
|
||||||
|
|
||||||
@ -372,8 +372,9 @@ class SoundtrackEditWindow(ba.Window):
|
|||||||
# Resets music back to normal.
|
# Resets music back to normal.
|
||||||
music.set_music_play_mode(ba.MusicPlayMode.REGULAR)
|
music.set_music_play_mode(ba.MusicPlayMode.REGULAR)
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
ba.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
ba.app.main_menu_window = (stb.SoundtrackBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
stb.SoundtrackBrowserWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _do_it(self) -> None:
|
def _do_it(self) -> None:
|
||||||
from bastd.ui.soundtrack import browser as stb
|
from bastd.ui.soundtrack import browser as stb
|
||||||
@ -414,8 +415,9 @@ class SoundtrackEditWindow(ba.Window):
|
|||||||
# Resets music back to normal.
|
# Resets music back to normal.
|
||||||
music.set_music_play_mode(ba.MusicPlayMode.REGULAR, force_restart=True)
|
music.set_music_play_mode(ba.MusicPlayMode.REGULAR, force_restart=True)
|
||||||
|
|
||||||
ba.app.main_menu_window = (stb.SoundtrackBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
stb.SoundtrackBrowserWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
|
|
||||||
def _do_it_with_sound(self) -> None:
|
def _do_it_with_sound(self) -> None:
|
||||||
ba.playsound(ba.getsound('swish'))
|
ba.playsound(ba.getsound('swish'))
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class SoundtrackEntryTypeSelectWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, self._height - 32),
|
position=(self._width * 0.5, self._height - 32),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=ba.Lstr(resource=self._r + '.selectASourceText'),
|
text=ba.Lstr(resource=self._r + '.selectASourceText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
maxwidth=230,
|
maxwidth=230,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center')
|
v_align='center')
|
||||||
@ -91,7 +91,7 @@ class SoundtrackEntryTypeSelectWindow(ba.Window):
|
|||||||
position=(self._width * 0.5, self._height - 56),
|
position=(self._width * 0.5, self._height - 56),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=selection_target_name,
|
text=selection_target_name,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
scale=0.7,
|
scale=0.7,
|
||||||
maxwidth=230,
|
maxwidth=230,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
@ -161,33 +161,36 @@ class SoundtrackEntryTypeSelectWindow(ba.Window):
|
|||||||
self._current_entry)
|
self._current_entry)
|
||||||
else:
|
else:
|
||||||
current_playlist_entry = None
|
current_playlist_entry = None
|
||||||
ba.app.main_menu_window = (macmusicapp.MacMusicAppPlaylistSelectWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
self._callback, current_playlist_entry,
|
macmusicapp.MacMusicAppPlaylistSelectWindow(
|
||||||
self._current_entry).get_root_widget())
|
self._callback, current_playlist_entry,
|
||||||
|
self._current_entry).get_root_widget())
|
||||||
|
|
||||||
def _on_music_file_press(self) -> None:
|
def _on_music_file_press(self) -> None:
|
||||||
from ba.osmusic import OSMusicPlayer
|
from ba.osmusic import OSMusicPlayer
|
||||||
from bastd.ui import fileselector
|
from bastd.ui import fileselector
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
base_path = _ba.android_get_external_storage_path()
|
base_path = _ba.android_get_external_storage_path()
|
||||||
ba.app.main_menu_window = (fileselector.FileSelectorWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
base_path,
|
fileselector.FileSelectorWindow(
|
||||||
callback=self._music_file_selector_cb,
|
base_path,
|
||||||
show_base_path=False,
|
callback=self._music_file_selector_cb,
|
||||||
valid_file_extensions=(
|
show_base_path=False,
|
||||||
OSMusicPlayer.get_valid_music_file_extensions()),
|
valid_file_extensions=(
|
||||||
allow_folders=False).get_root_widget())
|
OSMusicPlayer.get_valid_music_file_extensions()),
|
||||||
|
allow_folders=False).get_root_widget())
|
||||||
|
|
||||||
def _on_music_folder_press(self) -> None:
|
def _on_music_folder_press(self) -> None:
|
||||||
from bastd.ui import fileselector
|
from bastd.ui import fileselector
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
base_path = _ba.android_get_external_storage_path()
|
base_path = _ba.android_get_external_storage_path()
|
||||||
ba.app.main_menu_window = (fileselector.FileSelectorWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
base_path,
|
fileselector.FileSelectorWindow(
|
||||||
callback=self._music_folder_selector_cb,
|
base_path,
|
||||||
show_base_path=False,
|
callback=self._music_folder_selector_cb,
|
||||||
valid_file_extensions=[],
|
show_base_path=False,
|
||||||
allow_folders=True).get_root_widget())
|
valid_file_extensions=[],
|
||||||
|
allow_folders=True).get_root_widget())
|
||||||
|
|
||||||
def _music_file_selector_cb(self, result: Optional[str]) -> None:
|
def _music_file_selector_cb(self, result: Optional[str]) -> None:
|
||||||
if result is None:
|
if result is None:
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class MacMusicAppPlaylistSelectWindow(ba.Window):
|
|||||||
position=(20, self._height - 54),
|
position=(20, self._height - 54),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=ba.Lstr(resource=self._r + '.selectAPlaylistText'),
|
text=ba.Lstr(resource=self._r + '.selectAPlaylistText'),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=200)
|
maxwidth=200)
|
||||||
|
|||||||
@ -160,7 +160,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 44),
|
position=(self._width * 0.5, self._height - 44),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=app.title_color,
|
color=app.ui.title_color,
|
||||||
scale=1.5,
|
scale=1.5,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -1008,7 +1008,7 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
self._tab_buttons.values()).index(sel)]
|
self._tab_buttons.values()).index(sel)]
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection \'{sel}\'')
|
raise ValueError(f'unrecognized selection \'{sel}\'')
|
||||||
ba.app.window_states[self.__class__.__name__] = {
|
ba.app.ui.window_states[self.__class__.__name__] = {
|
||||||
'sel_name': sel_name,
|
'sel_name': sel_name,
|
||||||
'tab': self._current_tab
|
'tab': self._current_tab
|
||||||
}
|
}
|
||||||
@ -1018,8 +1018,8 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel: Optional[ba.Widget]
|
sel: Optional[ba.Widget]
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__,
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__,
|
||||||
{}).get('sel_name')
|
{}).get('sel_name')
|
||||||
current_tab = ba.app.config.get('Store Tab')
|
current_tab = ba.app.config.get('Store Tab')
|
||||||
if self._show_tab is not None:
|
if self._show_tab is not None:
|
||||||
current_tab = self._show_tab
|
current_tab = self._show_tab
|
||||||
@ -1047,18 +1047,18 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
|
|
||||||
def _on_get_more_tickets_press(self) -> None:
|
def _on_get_more_tickets_press(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bastd.ui import account
|
from bastd.ui.account import show_sign_in_prompt
|
||||||
from bastd.ui import getcurrency
|
from bastd.ui.getcurrency import GetCurrencyWindow
|
||||||
if _ba.get_account_state() != 'signed_in':
|
if _ba.get_account_state() != 'signed_in':
|
||||||
account.show_sign_in_prompt()
|
show_sign_in_prompt()
|
||||||
return
|
return
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||||
window = getcurrency.GetCurrencyWindow(
|
window = GetCurrencyWindow(
|
||||||
from_modal_store=self._modal,
|
from_modal_store=self._modal,
|
||||||
store_back_location=self._back_location).get_root_widget()
|
store_back_location=self._back_location).get_root_widget()
|
||||||
if not self._modal:
|
if not self._modal:
|
||||||
ba.app.main_menu_window = window
|
ba.app.ui.set_main_menu_window(window)
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
@ -1069,10 +1069,12 @@ class StoreBrowserWindow(ba.Window):
|
|||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
if not self._modal:
|
if not self._modal:
|
||||||
if self._back_location == 'CoopBrowserWindow':
|
if self._back_location == 'CoopBrowserWindow':
|
||||||
ba.app.main_menu_window = (browser.CoopBrowserWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
browser.CoopBrowserWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
else:
|
else:
|
||||||
ba.app.main_menu_window = (mainmenu.MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
mainmenu.MainMenuWindow(
|
||||||
|
transition='in_left').get_root_widget())
|
||||||
if self._on_close_call is not None:
|
if self._on_close_call is not None:
|
||||||
self._on_close_call()
|
self._on_close_call()
|
||||||
|
|||||||
@ -233,7 +233,7 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
self._pay_with_ad_btn = None
|
self._pay_with_ad_btn = None
|
||||||
|
|
||||||
self._get_tickets_button: Optional[ba.Widget]
|
self._get_tickets_button: Optional[ba.Widget]
|
||||||
if not ba.app.toolbars:
|
if not ba.app.ui.use_toolbars:
|
||||||
self._get_tickets_button = ba.buttonwidget(
|
self._get_tickets_button = ba.buttonwidget(
|
||||||
parent=self.root_widget,
|
parent=self.root_widget,
|
||||||
position=(self._width - 190 + 110, 15),
|
position=(self._width - 190 + 110, 15),
|
||||||
@ -255,7 +255,7 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||||||
# Let's also ask the server for info about this tournament
|
# Let's also ask the server for info about this tournament
|
||||||
# (time remaining, etc) so we can show the user time remaining,
|
# (time remaining, etc) so we can show the user time remaining,
|
||||||
# disallow entry if time has run out, etc.
|
# disallow entry if time has run out, etc.
|
||||||
xoffs = 104 if ba.app.toolbars else 0
|
xoffs = 104 if ba.app.ui.use_toolbars else 0
|
||||||
self._time_remaining_text = ba.textwidget(parent=self.root_widget,
|
self._time_remaining_text = ba.textwidget(parent=self.root_widget,
|
||||||
position=(70 + xoffs, 23),
|
position=(70 + xoffs, 23),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class ShowURLWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 10),
|
position=(self._width * 0.5, self._height - 10),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
text=ba.Lstr(resource='directBrowserToURLText'),
|
text=ba.Lstr(resource='directBrowserToURLText'),
|
||||||
@ -84,7 +84,7 @@ class ShowURLWindow(ba.Window):
|
|||||||
self._height * 0.5 + 29),
|
self._height * 0.5 + 29),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
scale=1.3,
|
scale=1.3,
|
||||||
color=ba.app.infotextcolor,
|
color=ba.app.ui.infotextcolor,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
text=address,
|
text=address,
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class WatchWindow(ba.Window):
|
|||||||
else:
|
else:
|
||||||
self._transition_out = 'out_right'
|
self._transition_out = 'out_right'
|
||||||
scale_origin = None
|
scale_origin = None
|
||||||
ba.app.main_window = 'Watch'
|
ba.app.ui.set_main_menu_location('Watch')
|
||||||
self._tab_data: Dict[str, Any] = {}
|
self._tab_data: Dict[str, Any] = {}
|
||||||
self._my_replays_scroll_width: Optional[float] = None
|
self._my_replays_scroll_width: Optional[float] = None
|
||||||
self._my_replays_watch_replay_button: Optional[ba.Widget] = None
|
self._my_replays_watch_replay_button: Optional[ba.Widget] = None
|
||||||
@ -78,7 +78,7 @@ class WatchWindow(ba.Window):
|
|||||||
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (
|
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (
|
||||||
0, 15) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
|
0, 15) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
|
||||||
|
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
on_cancel_call=self._back)
|
on_cancel_call=self._back)
|
||||||
self._back_button = None
|
self._back_button = None
|
||||||
@ -101,7 +101,7 @@ class WatchWindow(ba.Window):
|
|||||||
ba.textwidget(parent=self._root_widget,
|
ba.textwidget(parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 38),
|
position=(self._width * 0.5, self._height - 38),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
color=ba.app.title_color,
|
color=ba.app.ui.title_color,
|
||||||
scale=1.5,
|
scale=1.5,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -121,7 +121,7 @@ class WatchWindow(ba.Window):
|
|||||||
size=(self._width - tab_buffer_h, 50),
|
size=(self._width - tab_buffer_h, 50),
|
||||||
on_select_call=self._set_tab)
|
on_select_call=self._set_tab)
|
||||||
|
|
||||||
if ba.app.toolbars:
|
if ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=self._tab_buttons[tabs_def[-1][0]],
|
ba.widget(edit=self._tab_buttons[tabs_def[-1][0]],
|
||||||
right_widget=_ba.get_special_widget('party_button'))
|
right_widget=_ba.get_special_widget('party_button'))
|
||||||
if uiscale is ba.UIScale.SMALL:
|
if uiscale is ba.UIScale.SMALL:
|
||||||
@ -231,7 +231,7 @@ class WatchWindow(ba.Window):
|
|||||||
label=ba.Lstr(resource=self._r + '.watchReplayButtonText'),
|
label=ba.Lstr(resource=self._r + '.watchReplayButtonText'),
|
||||||
autoselect=True)
|
autoselect=True)
|
||||||
ba.widget(edit=btn1, up_widget=self._tab_buttons[tab])
|
ba.widget(edit=btn1, up_widget=self._tab_buttons[tab])
|
||||||
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
|
if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars:
|
||||||
ba.widget(edit=btn1,
|
ba.widget(edit=btn1,
|
||||||
left_widget=_ba.get_special_widget('back_button'))
|
left_widget=_ba.get_special_widget('back_button'))
|
||||||
btnv -= b_height + b_space_extra
|
btnv -= b_height + b_space_extra
|
||||||
@ -492,7 +492,7 @@ class WatchWindow(ba.Window):
|
|||||||
sel_name = 'TabContainer'
|
sel_name = 'TabContainer'
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unrecognized selection {sel}')
|
raise ValueError(f'unrecognized selection {sel}')
|
||||||
ba.app.window_states[self.__class__.__name__] = {
|
ba.app.ui.window_states[self.__class__.__name__] = {
|
||||||
'sel_name': sel_name,
|
'sel_name': sel_name,
|
||||||
'tab': self._current_tab
|
'tab': self._current_tab
|
||||||
}
|
}
|
||||||
@ -501,8 +501,8 @@ class WatchWindow(ba.Window):
|
|||||||
|
|
||||||
def _restore_state(self) -> None:
|
def _restore_state(self) -> None:
|
||||||
try:
|
try:
|
||||||
sel_name = ba.app.window_states.get(self.__class__.__name__,
|
sel_name = ba.app.ui.window_states.get(self.__class__.__name__,
|
||||||
{}).get('sel_name')
|
{}).get('sel_name')
|
||||||
current_tab = ba.app.config.get('Watch Tab')
|
current_tab = ba.app.config.get('Watch Tab')
|
||||||
if current_tab is None or current_tab not in self._tab_buttons:
|
if current_tab is None or current_tab not in self._tab_buttons:
|
||||||
current_tab = 'my_replays'
|
current_tab = 'my_replays'
|
||||||
@ -523,9 +523,9 @@ class WatchWindow(ba.Window):
|
|||||||
ba.print_exception(f'Error restoring state for {self}.')
|
ba.print_exception(f'Error restoring state for {self}.')
|
||||||
|
|
||||||
def _back(self) -> None:
|
def _back(self) -> None:
|
||||||
from bastd.ui import mainmenu
|
from bastd.ui.mainmenu import MainMenuWindow
|
||||||
self._save_state()
|
self._save_state()
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
transition=self._transition_out)
|
transition=self._transition_out)
|
||||||
ba.app.main_menu_window = (mainmenu.MainMenuWindow(
|
ba.app.ui.set_main_menu_window(
|
||||||
transition='in_left').get_root_widget())
|
MainMenuWindow(transition='in_left').get_root_widget())
|
||||||
|
|||||||
@ -62,26 +62,26 @@ disable=broad-except,
|
|||||||
enable=useless-suppression
|
enable=useless-suppression
|
||||||
|
|
||||||
[BASIC]
|
[BASIC]
|
||||||
# I use x, y, h, and v for graphical purposes often, where I feel like they are
|
# Allowing a handfull of short names commonly understood to be iterators,
|
||||||
# meaningful, so adding them to the allowed list.
|
# math concepts, or temporary variables.
|
||||||
# Also t, r, s for translate/rotate/scale
|
|
||||||
# (i found myself just changing them to xval and yval which doesnt help)
|
|
||||||
|
|
||||||
good-names=i,
|
good-names=i,
|
||||||
j,
|
j,
|
||||||
k,
|
k,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
z,
|
||||||
h,
|
h,
|
||||||
v,
|
v,
|
||||||
s,
|
s,
|
||||||
|
ui,
|
||||||
h2,
|
h2,
|
||||||
v2,
|
v2,
|
||||||
ex,
|
ex,
|
||||||
Run,
|
Run,
|
||||||
id,
|
id,
|
||||||
T,
|
|
||||||
S,
|
S,
|
||||||
|
T,
|
||||||
U,
|
U,
|
||||||
_
|
_
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||||
<h4><em>last updated on 2020-07-13 for Ballistica version 1.5.20 build 20135</em></h4>
|
<h4><em>last updated on 2020-07-13 for Ballistica version 1.5.20 build 20136</em></h4>
|
||||||
<p>This page documents the Python classes and functions in the 'ba' module,
|
<p>This page documents the Python classes and functions in the 'ba' module,
|
||||||
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
|
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
|
||||||
<hr>
|
<hr>
|
||||||
@ -6401,7 +6401,7 @@ so in most cases you can just use that.</p>
|
|||||||
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
|
<p>Category: <a href="#function_category_General_Utility_Functions">General Utility Functions</a></p>
|
||||||
|
|
||||||
<p>Activities require special setup and thus cannot be directly
|
<p>Activities require special setup and thus cannot be directly
|
||||||
instantiated; You must go through this function.</p>
|
instantiated; you must go through this function.</p>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<h2><strong><a name="function_ba_newnode">ba.newnode()</a></strong></h3>
|
<h2><strong><a name="function_ba_newnode">ba.newnode()</a></strong></h3>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user