mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-28 18:15:45 +08:00
Progress on getting UI back to stable 1.4 state (disabling new location stuff for now)
This commit is contained in:
parent
1560a15ddd
commit
d933200197
1
.idea/dictionaries/ericf.xml
generated
1
.idea/dictionaries/ericf.xml
generated
@ -1776,6 +1776,7 @@
|
||||
<w>uber</w>
|
||||
<w>ugrade</w>
|
||||
<w>uibounds</w>
|
||||
<w>uicleanup</w>
|
||||
<w>uicleanupcheck</w>
|
||||
<w>uicleanupchecks</w>
|
||||
<w>uicontroller</w>
|
||||
|
||||
@ -81,7 +81,7 @@ from ba._messages import (OutOfBoundsMessage, DieMessage, StandMessage,
|
||||
from ba._music import setmusic, MusicPlayer, MusicType, MusicPlayMode
|
||||
from ba._powerup import PowerupMessage, PowerupAcceptMessage
|
||||
from ba._teambasesession import TeamBaseSession
|
||||
from ba.ui import (OldWindow, UILocation, UILocationWindow, UIController,
|
||||
from ba.ui import (Window, UILocation, UILocationWindow, UIController,
|
||||
uicleanupcheck)
|
||||
|
||||
app: App
|
||||
|
||||
@ -29,6 +29,7 @@ import _ba
|
||||
if TYPE_CHECKING:
|
||||
import ba
|
||||
from ba import _lang, _meta
|
||||
from ba.ui import UICleanupCheck
|
||||
from bastd.actor import spazappearance
|
||||
from typing import (Optional, Dict, Tuple, Set, Any, List, Type, Tuple,
|
||||
Callable)
|
||||
@ -429,7 +430,7 @@ class App:
|
||||
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[dict] = []
|
||||
self.uicleanupchecks: List[UICleanupCheck] = []
|
||||
self.uiupkeeptimer: Optional[ba.Timer] = None
|
||||
self.delegate: Optional[ba.AppDelegate] = None
|
||||
|
||||
|
||||
@ -22,7 +22,9 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import weakref
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, cast, Type
|
||||
|
||||
import _ba
|
||||
@ -30,11 +32,17 @@ from ba._enums import TimeType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, List, Any
|
||||
from weakref import ReferenceType
|
||||
|
||||
import ba
|
||||
|
||||
# Set environment variable BA_DEBUG_UI_CLEANUP_CHECKS to 1
|
||||
# to print detailed info about what is getting cleaned up when.
|
||||
DEBUG_UI_CLEANUP_CHECKS = os.environ.get('BA_DEBUG_UI_CLEANUP_CHECKS') == '1'
|
||||
|
||||
class OldWindow:
|
||||
"""Temp for transitioning windows over to UILocationWindows.
|
||||
|
||||
class Window:
|
||||
"""A basic window.
|
||||
|
||||
Category: User Interface Classes
|
||||
"""
|
||||
@ -47,6 +55,14 @@ class OldWindow:
|
||||
return self._root_widget
|
||||
|
||||
|
||||
@dataclass
|
||||
class UICleanupCheck:
|
||||
"""Holds info about a uicleanupcheck target."""
|
||||
obj: ReferenceType
|
||||
widget: ba.Widget
|
||||
widget_death_time: Optional[float]
|
||||
|
||||
|
||||
class UILocation:
|
||||
"""Defines a specific 'place' in the UI the user can navigate to.
|
||||
|
||||
@ -143,7 +159,7 @@ class UIController:
|
||||
self._update_ui()
|
||||
|
||||
def _update_ui(self) -> None:
|
||||
"""Instantiates the topmost ui in our stacks."""
|
||||
"""Instantiate the topmost ui in our stacks."""
|
||||
|
||||
# First tell any existing UIs to get outta here.
|
||||
for stack in (self._dialog_stack, self._main_stack):
|
||||
@ -173,19 +189,21 @@ def uicleanupcheck(obj: Any, widget: ba.Widget) -> None:
|
||||
strong referencing can lead to such objects never getting destroyed,
|
||||
however, and this helps detect such cases to avoid memory leaks.
|
||||
"""
|
||||
if DEBUG_UI_CLEANUP_CHECKS:
|
||||
print(f'adding uicleanup to {obj}')
|
||||
if not isinstance(widget, _ba.Widget):
|
||||
raise Exception('widget arg is not a ba.Widget')
|
||||
|
||||
def foobar() -> None:
|
||||
"""Just testing."""
|
||||
print('uicleanupcheck widget dying...')
|
||||
if DEBUG_UI_CLEANUP_CHECKS:
|
||||
print('uicleanupcheck widget dying...')
|
||||
|
||||
widget.add_delete_callback(foobar)
|
||||
_ba.app.uicleanupchecks.append({
|
||||
'obj': weakref.ref(obj),
|
||||
'widget': widget,
|
||||
'widgetdeathtime': None
|
||||
})
|
||||
_ba.app.uicleanupchecks.append(
|
||||
UICleanupCheck(obj=weakref.ref(obj),
|
||||
widget=widget,
|
||||
widget_death_time=None))
|
||||
|
||||
|
||||
def upkeep() -> None:
|
||||
@ -194,20 +212,22 @@ def upkeep() -> None:
|
||||
remainingchecks = []
|
||||
now = _ba.time(TimeType.REAL)
|
||||
for check in app.uicleanupchecks:
|
||||
obj = check['obj']()
|
||||
obj = check.obj()
|
||||
|
||||
# If the object has died, ignore and don't re-add.
|
||||
if obj is None:
|
||||
if DEBUG_UI_CLEANUP_CHECKS:
|
||||
print('uicleanupcheck object is dead; hooray!')
|
||||
continue
|
||||
|
||||
# If the widget hadn't died yet, note if it has.
|
||||
if check['widgetdeathtime'] is None:
|
||||
if check.widget_death_time is None:
|
||||
remainingchecks.append(check)
|
||||
if not check['widget']:
|
||||
check['widgetdeathtime'] = now
|
||||
if not check.widget:
|
||||
check.widget_death_time = now
|
||||
else:
|
||||
# Widget was already dead; complain if its been too long.
|
||||
if now - check['widgetdeathtime'] > 5.0:
|
||||
if now - check.widget_death_time > 5.0:
|
||||
print(
|
||||
'WARNING:', obj,
|
||||
'is still alive 5 second after its widget died;'
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Tuple, Optional, Dict
|
||||
|
||||
|
||||
class AccountLinkWindow(ba.OldWindow):
|
||||
class AccountLinkWindow(ba.Window):
|
||||
"""Window for linking accounts."""
|
||||
|
||||
def __init__(self, origin_widget: ba.Widget = None):
|
||||
@ -125,7 +125,7 @@ class AccountLinkWindow(ba.OldWindow):
|
||||
transition=self._transition_out)
|
||||
|
||||
|
||||
class AccountLinkCodeWindow(ba.OldWindow):
|
||||
class AccountLinkCodeWindow(ba.Window):
|
||||
"""Window showing code for account-linking."""
|
||||
|
||||
def __init__(self, data: Dict[str, Any]):
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Optional, Tuple, List, Union
|
||||
|
||||
|
||||
class AccountSettingsWindow(ba.OldWindow):
|
||||
class AccountSettingsWindow(ba.Window):
|
||||
"""Window for account related functionality."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, Dict
|
||||
|
||||
|
||||
class AccountUnlinkWindow(ba.OldWindow):
|
||||
class AccountUnlinkWindow(ba.Window):
|
||||
"""A window to kick off account unlinks."""
|
||||
|
||||
def __init__(self, origin_widget: ba.Widget = None):
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Dict, Union
|
||||
|
||||
|
||||
class AppInviteWindow(ba.OldWindow):
|
||||
class AppInviteWindow(ba.Window):
|
||||
"""Window for showing different ways to invite people to try the game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
@ -164,7 +164,7 @@ class AppInviteWindow(ba.OldWindow):
|
||||
ba.containerwidget(edit=self._root_widget, transition='out_scale')
|
||||
|
||||
|
||||
class ShowFriendCodeWindow(ba.OldWindow):
|
||||
class ShowFriendCodeWindow(ba.Window):
|
||||
"""Window showing a code for sharing with friends."""
|
||||
|
||||
def __init__(self, data: Dict[str, Any]):
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
class ConfigErrorWindow(ba.OldWindow):
|
||||
class ConfigErrorWindow(ba.Window):
|
||||
"""Window for dealing with a broken config."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
|
||||
class ContinuesWindow(ba.OldWindow):
|
||||
class ContinuesWindow(ba.Window):
|
||||
"""A window to continue a game."""
|
||||
|
||||
def __init__(self, activity: ba.Activity, cost: int,
|
||||
|
||||
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, Dict, List, Union
|
||||
|
||||
|
||||
class CoopBrowserWindow(ba.OldWindow):
|
||||
class CoopBrowserWindow(ba.Window):
|
||||
"""Window for browsing co-op levels/games/etc."""
|
||||
|
||||
def _update_corner_button_positions(self) -> None:
|
||||
|
||||
@ -25,7 +25,7 @@ from __future__ import annotations
|
||||
import ba
|
||||
|
||||
|
||||
class CoopLevelLockedWindow(ba.OldWindow):
|
||||
class CoopLevelLockedWindow(ba.Window):
|
||||
"""Window showing that a level is locked."""
|
||||
|
||||
def __init__(self, name: ba.Lstr, dep_name: ba.Lstr):
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Tuple, Optional, Sequence
|
||||
|
||||
|
||||
class CreditsListWindow(ba.OldWindow):
|
||||
class CreditsListWindow(ba.Window):
|
||||
"""Window for displaying game credits."""
|
||||
|
||||
def __init__(self, origin_widget: ba.Widget = None):
|
||||
|
||||
@ -30,7 +30,7 @@ if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
class DebugWindow(ba.OldWindow):
|
||||
class DebugWindow(ba.Window):
|
||||
"""Window for debugging internal values."""
|
||||
|
||||
def __init__(self, transition: str = 'in_right'):
|
||||
|
||||
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Sequence, List, Optional
|
||||
|
||||
|
||||
class FileSelectorWindow(ba.OldWindow):
|
||||
class FileSelectorWindow(ba.Window):
|
||||
"""Window for selecting files."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, Dict, List, Union, Callable
|
||||
|
||||
|
||||
class GatherWindow(ba.OldWindow):
|
||||
class GatherWindow(ba.Window):
|
||||
"""Window for joining/inviting friends."""
|
||||
|
||||
def __del__(self) -> None:
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, Union, Dict
|
||||
|
||||
|
||||
class GetCurrencyWindow(ba.OldWindow):
|
||||
class GetCurrencyWindow(ba.Window):
|
||||
"""Window for purchasing/acquiring currency."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Optional, Tuple
|
||||
|
||||
|
||||
class HelpWindow(ba.OldWindow):
|
||||
class HelpWindow(ba.Window):
|
||||
"""A window providing help on how to play."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class KioskWindow(ba.OldWindow):
|
||||
class KioskWindow(ba.Window):
|
||||
"""Kiosk mode window."""
|
||||
|
||||
def __init__(self, transition: str = 'in_right'):
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, List, Dict, Union
|
||||
|
||||
|
||||
class LeagueRankWindow(ba.OldWindow):
|
||||
class LeagueRankWindow(ba.Window):
|
||||
"""Window for showing league rank."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Callable, List, Dict, Tuple, Optional, Union
|
||||
|
||||
|
||||
class MainMenuWindow(ba.OldWindow):
|
||||
class MainMenuWindow(ba.Window):
|
||||
"""The main menu window, both in-game and in the main menu."""
|
||||
|
||||
def __init__(self, transition: str = 'in_right'):
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import List, Tuple, Optional
|
||||
|
||||
|
||||
class OnScreenKeyboardWindow(ba.OldWindow):
|
||||
class OnScreenKeyboardWindow(ba.Window):
|
||||
"""Simple built-in on-screen keyboard."""
|
||||
|
||||
def __init__(self, textwidget: ba.Widget, label: str, max_chars: int):
|
||||
|
||||
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from typing import List, Sequence, Optional, Dict, Any
|
||||
|
||||
|
||||
class PartyWindow(ba.OldWindow):
|
||||
class PartyWindow(ba.Window):
|
||||
"""Party list/chat window."""
|
||||
|
||||
def __del__(self) -> None:
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, List, Dict
|
||||
|
||||
|
||||
class PartyQueueWindow(ba.OldWindow):
|
||||
class PartyQueueWindow(ba.Window):
|
||||
"""Window showing players waiting to join a server."""
|
||||
|
||||
# ewww this needs quite a bit of de-linting if/when i revisit it..
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Optional, Tuple
|
||||
|
||||
|
||||
class PlayWindow(ba.OldWindow):
|
||||
class PlayWindow(ba.Window):
|
||||
"""Window for selecting overall play type."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from bastd.ui.playlist.editcontroller import PlaylistEditController
|
||||
|
||||
|
||||
class PlaylistAddGameWindow(ba.OldWindow):
|
||||
class PlaylistAddGameWindow(ba.Window):
|
||||
"""Window for selecting a game type to add to a playlist."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Type, Optional, Tuple, Union
|
||||
|
||||
|
||||
class PlaylistBrowserWindow(ba.OldWindow):
|
||||
class PlaylistBrowserWindow(ba.Window):
|
||||
"""Window for starting teams games."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Type, Optional, Tuple, List
|
||||
|
||||
|
||||
class PlaylistCustomizeBrowserWindow(ba.OldWindow):
|
||||
class PlaylistCustomizeBrowserWindow(ba.Window):
|
||||
"""Window for viewing a playlist."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from bastd.ui.playlist.editcontroller import PlaylistEditController
|
||||
|
||||
|
||||
class PlaylistEditWindow(ba.OldWindow):
|
||||
class PlaylistEditWindow(ba.Window):
|
||||
"""Window for editing an individual game playlist."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from typing import Type, Any, Dict, Callable, Optional, Union
|
||||
|
||||
|
||||
class PlaylistEditGameWindow(ba.OldWindow):
|
||||
class PlaylistEditGameWindow(ba.Window):
|
||||
"""Window for editing a game in a playlist."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Type, Any, Callable, Dict, List, Tuple, Optional
|
||||
|
||||
|
||||
class PlaylistMapSelectWindow(ba.OldWindow):
|
||||
class PlaylistMapSelectWindow(ba.Window):
|
||||
"""Window to select a map."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -79,7 +79,7 @@ class SharePlaylistImportWindow(promocode.PromoCodeWindow):
|
||||
ba.screenmessage(ba.Lstr(resource='importingText'))
|
||||
|
||||
|
||||
class SharePlaylistResultsWindow(ba.OldWindow):
|
||||
class SharePlaylistResultsWindow(ba.Window):
|
||||
"""Window for sharing playlists."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, List, Dict
|
||||
|
||||
|
||||
class ProfileBrowserWindow(ba.OldWindow):
|
||||
class ProfileBrowserWindow(ba.Window):
|
||||
"""Window for browsing player profiles."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
from bastd.ui.colorpicker import ColorPicker
|
||||
|
||||
|
||||
class EditProfileWindow(ba.OldWindow):
|
||||
class EditProfileWindow(ba.Window):
|
||||
"""Window for editing a player profile."""
|
||||
|
||||
# FIXME: WILL NEED TO CHANGE THIS FOR UILOCATION.
|
||||
|
||||
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from bastd.ui.profile.edit import EditProfileWindow
|
||||
|
||||
|
||||
class ProfileUpgradeWindow(ba.OldWindow):
|
||||
class ProfileUpgradeWindow(ba.Window):
|
||||
"""Window for player profile upgrades to global."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Optional, Tuple
|
||||
|
||||
|
||||
class PromoCodeWindow(ba.OldWindow):
|
||||
class PromoCodeWindow(ba.Window):
|
||||
"""Window for entering promo codes."""
|
||||
|
||||
def __init__(self, modal: bool = False, origin_widget: ba.Widget = None):
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
||||
class PurchaseWindow(ba.OldWindow):
|
||||
class PurchaseWindow(ba.Window):
|
||||
"""Window for purchasing one or more items."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -26,7 +26,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
|
||||
class ReportPlayerWindow(ba.OldWindow):
|
||||
class ReportPlayerWindow(ba.Window):
|
||||
"""Player for reporting naughty players."""
|
||||
|
||||
def __init__(self, account_id: str, origin_widget: ba.Widget):
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
|
||||
class ServerDialogWindow(ba.OldWindow):
|
||||
class ServerDialogWindow(ba.Window):
|
||||
"""A dialog window driven by the master-server."""
|
||||
|
||||
def __init__(self, data: Dict[str, Any]):
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Tuple, Any, Optional, List, Dict
|
||||
|
||||
|
||||
class AdvancedSettingsWindow(ba.OldWindow):
|
||||
class AdvancedSettingsWindow(ba.Window):
|
||||
"""Window for editing advanced game settings."""
|
||||
|
||||
def __init__(self,
|
||||
@ -178,7 +178,7 @@ class AdvancedSettingsWindow(ba.OldWindow):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-locals
|
||||
from bastd.ui import config
|
||||
from bastd.ui.config import ConfigCheckBox
|
||||
from ba.internal import show_user_scripts
|
||||
|
||||
# Don't rebuild if the menu is open or if our language and
|
||||
@ -348,7 +348,7 @@ class AdvancedSettingsWindow(ba.OldWindow):
|
||||
|
||||
v -= self._spacing * 3.0
|
||||
|
||||
self._kick_idle_players_check_box = config.ConfigCheckBox(
|
||||
self._kick_idle_players_check_box = ConfigCheckBox(
|
||||
parent=self._subcontainer,
|
||||
position=(50, v),
|
||||
size=(self._sub_width - 100, 30),
|
||||
@ -357,21 +357,19 @@ class AdvancedSettingsWindow(ba.OldWindow):
|
||||
scale=1.0,
|
||||
maxwidth=430)
|
||||
|
||||
self._always_use_internal_keyboard_check_box: Optional[
|
||||
config.ConfigCheckBox]
|
||||
self._always_use_internal_keyboard_check_box: Optional[ConfigCheckBox]
|
||||
if self._show_always_use_internal_keyboard:
|
||||
v -= 42
|
||||
self._always_use_internal_keyboard_check_box = (
|
||||
config.ConfigCheckBox(
|
||||
parent=self._subcontainer,
|
||||
position=(50, v),
|
||||
size=(self._sub_width - 100, 30),
|
||||
configkey="Always Use Internal Keyboard",
|
||||
autoselect=True,
|
||||
displayname=ba.Lstr(resource=self._r +
|
||||
'.alwaysUseInternalKeyboardText'),
|
||||
scale=1.0,
|
||||
maxwidth=430))
|
||||
self._always_use_internal_keyboard_check_box = ConfigCheckBox(
|
||||
parent=self._subcontainer,
|
||||
position=(50, v),
|
||||
size=(self._sub_width - 100, 30),
|
||||
configkey="Always Use Internal Keyboard",
|
||||
autoselect=True,
|
||||
displayname=ba.Lstr(resource=self._r +
|
||||
'.alwaysUseInternalKeyboardText'),
|
||||
scale=1.0,
|
||||
maxwidth=430)
|
||||
ba.textwidget(
|
||||
parent=self._subcontainer,
|
||||
position=(90, v - 10),
|
||||
@ -427,18 +425,13 @@ class AdvancedSettingsWindow(ba.OldWindow):
|
||||
|
||||
v -= self._spacing * 1.8
|
||||
|
||||
def doit(val: Any) -> None:
|
||||
del val # Unused.
|
||||
ba.screenmessage(ba.Lstr(resource=self._r + '.mustRestartText'),
|
||||
color=(1, 1, 0))
|
||||
|
||||
self._enable_package_mods_checkbox = config.ConfigCheckBox(
|
||||
self._enable_package_mods_checkbox = ConfigCheckBox(
|
||||
parent=self._subcontainer,
|
||||
position=(80, v),
|
||||
size=(self._sub_width - 100, 30),
|
||||
configkey="Enable Package Mods",
|
||||
autoselect=True,
|
||||
value_change_call=doit,
|
||||
value_change_call=ba.WeakCall(self._show_restart_needed),
|
||||
displayname=ba.Lstr(resource=self._r + '.enablePackageModsText'),
|
||||
scale=1.0,
|
||||
maxwidth=400)
|
||||
@ -515,6 +508,11 @@ class AdvancedSettingsWindow(ba.OldWindow):
|
||||
|
||||
self._restore_state()
|
||||
|
||||
def _show_restart_needed(self, value: Any) -> None:
|
||||
del value # Unused.
|
||||
ba.screenmessage(ba.Lstr(resource=self._r + '.mustRestartText'),
|
||||
color=(1, 1, 0))
|
||||
|
||||
def _on_lang_inform_value_change(self, val: bool) -> None:
|
||||
_ba.add_transaction({
|
||||
'type': 'SET_MISC_VAL',
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Tuple, Optional, Union
|
||||
|
||||
|
||||
class AllSettingsWindow(ba.OldWindow):
|
||||
class AllSettingsWindow(ba.Window):
|
||||
"""Window for selecting a settings category."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Tuple, Optional
|
||||
|
||||
|
||||
class AudioSettingsWindow(ba.OldWindow):
|
||||
class AudioSettingsWindow(ba.Window):
|
||||
"""Window for editing audio settings."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Tuple, Optional
|
||||
|
||||
|
||||
class ControlsSettingsWindow(ba.OldWindow):
|
||||
class ControlsSettingsWindow(ba.Window):
|
||||
"""Top level control settings window."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Dict, Any, Optional, Union, Tuple, Callable
|
||||
|
||||
|
||||
class GamepadSettingsWindow(ba.OldWindow):
|
||||
class GamepadSettingsWindow(ba.Window):
|
||||
"""Window for configuring a gamepad."""
|
||||
|
||||
def __init__(self,
|
||||
@ -765,7 +765,7 @@ class GamepadSettingsWindow(ba.OldWindow):
|
||||
transition='in_left').get_root_widget())
|
||||
|
||||
|
||||
class AwaitGamepadInputWindow(ba.OldWindow):
|
||||
class AwaitGamepadInputWindow(ba.Window):
|
||||
"""Window for capturing a gamepad button press."""
|
||||
|
||||
def __init__(
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from bastd.ui.settings import gamepad as gpsui
|
||||
|
||||
|
||||
class GamepadAdvancedSettingsWindow(ba.OldWindow):
|
||||
class GamepadAdvancedSettingsWindow(ba.Window):
|
||||
"""Window for advanced gamepad configuration."""
|
||||
|
||||
def __init__(self, parent_window: gpsui.GamepadSettingsWindow):
|
||||
|
||||
@ -84,7 +84,7 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None:
|
||||
on_activate_call=_ok)
|
||||
|
||||
|
||||
class GamepadSelectWindow(ba.OldWindow):
|
||||
class GamepadSelectWindow(ba.Window):
|
||||
"""Window for selecting a gamepad to configure."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Tuple, Optional
|
||||
|
||||
|
||||
class GraphicsSettingsWindow(ba.OldWindow):
|
||||
class GraphicsSettingsWindow(ba.Window):
|
||||
"""Window for graphics settings."""
|
||||
|
||||
def __init__(self,
|
||||
@ -41,7 +41,7 @@ class GraphicsSettingsWindow(ba.OldWindow):
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
from bastd.ui import popup
|
||||
from bastd.ui import config as cfgui
|
||||
from bastd.ui.config import ConfigCheckBox, ConfigNumberEdit
|
||||
# if they provided an origin-widget, scale up from that
|
||||
scale_origin: Optional[Tuple[float, float]]
|
||||
if origin_widget is not None:
|
||||
@ -123,7 +123,7 @@ class GraphicsSettingsWindow(ba.OldWindow):
|
||||
self._fullscreen_checkbox: Optional[ba.Widget]
|
||||
if self._show_fullscreen:
|
||||
v -= fullscreen_spacing_top
|
||||
self._fullscreen_checkbox = cfgui.ConfigCheckBox(
|
||||
self._fullscreen_checkbox = ConfigCheckBox(
|
||||
parent=self._root_widget,
|
||||
position=(100, v),
|
||||
maxwidth=200,
|
||||
@ -140,9 +140,9 @@ class GraphicsSettingsWindow(ba.OldWindow):
|
||||
else:
|
||||
self._fullscreen_checkbox = None
|
||||
|
||||
self._gamma_controls: Optional[cfgui.ConfigNumberEdit]
|
||||
self._gamma_controls: Optional[ConfigNumberEdit]
|
||||
if show_gamma:
|
||||
self._gamma_controls = gmc = cfgui.ConfigNumberEdit(
|
||||
self._gamma_controls = gmc = ConfigNumberEdit(
|
||||
parent=self._root_widget,
|
||||
position=(90, v),
|
||||
configkey="Screen Gamma",
|
||||
@ -325,25 +325,25 @@ class GraphicsSettingsWindow(ba.OldWindow):
|
||||
on_value_change_call=self._set_vsync)
|
||||
|
||||
v -= 90
|
||||
fpsc = cfgui.ConfigCheckBox(parent=self._root_widget,
|
||||
position=(69, v - 6),
|
||||
size=(210, 30),
|
||||
scale=0.86,
|
||||
configkey="Show FPS",
|
||||
displayname=ba.Lstr(resource=self._r +
|
||||
'.showFPSText'),
|
||||
maxwidth=130)
|
||||
fpsc = ConfigCheckBox(parent=self._root_widget,
|
||||
position=(69, v - 6),
|
||||
size=(210, 30),
|
||||
scale=0.86,
|
||||
configkey="Show FPS",
|
||||
displayname=ba.Lstr(resource=self._r +
|
||||
'.showFPSText'),
|
||||
maxwidth=130)
|
||||
|
||||
# (tv mode doesnt apply to vr)
|
||||
if not ba.app.vr_mode:
|
||||
tvc = cfgui.ConfigCheckBox(parent=self._root_widget,
|
||||
position=(240, v - 6),
|
||||
size=(210, 30),
|
||||
scale=0.86,
|
||||
configkey="TV Border",
|
||||
displayname=ba.Lstr(resource=self._r +
|
||||
'.tvBorderText'),
|
||||
maxwidth=130)
|
||||
tvc = ConfigCheckBox(parent=self._root_widget,
|
||||
position=(240, v - 6),
|
||||
size=(210, 30),
|
||||
scale=0.86,
|
||||
configkey="TV Border",
|
||||
displayname=ba.Lstr(resource=self._r +
|
||||
'.tvBorderText'),
|
||||
maxwidth=130)
|
||||
# grumble..
|
||||
ba.widget(edit=fpsc.widget, right_widget=tvc.widget)
|
||||
try:
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Dict, Tuple, Any, Optional
|
||||
|
||||
|
||||
class ConfigKeyboardWindow(ba.OldWindow):
|
||||
class ConfigKeyboardWindow(ba.Window):
|
||||
"""Window for configuring keyboards."""
|
||||
|
||||
def __init__(self, c: ba.InputDevice, transition: str = 'in_right'):
|
||||
@ -258,7 +258,7 @@ class ConfigKeyboardWindow(ba.OldWindow):
|
||||
transition='in_left').get_root_widget())
|
||||
|
||||
|
||||
class AwaitKeyboardInputWindow(ba.OldWindow):
|
||||
class AwaitKeyboardInputWindow(ba.Window):
|
||||
"""Window for capturing a keypress."""
|
||||
|
||||
def __init__(self, button: str, ui: ba.Widget, settings: Dict[str, Any]):
|
||||
|
||||
@ -26,7 +26,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
|
||||
class PS3ControllerSettingsWindow(ba.OldWindow):
|
||||
class PS3ControllerSettingsWindow(ba.Window):
|
||||
"""UI showing info about using PS3 controllers."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -25,7 +25,7 @@ from __future__ import annotations
|
||||
import ba
|
||||
|
||||
|
||||
class RemoteAppSettingsWindow(ba.OldWindow):
|
||||
class RemoteAppSettingsWindow(ba.Window):
|
||||
"""Window showing info/settings related to the remote app."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Dict, List
|
||||
|
||||
|
||||
class TestingWindow(ba.OldWindow):
|
||||
class TestingWindow(ba.Window):
|
||||
"""Window for conveniently testing various settings."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -25,7 +25,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
|
||||
class TouchscreenSettingsWindow(ba.OldWindow):
|
||||
class TouchscreenSettingsWindow(ba.Window):
|
||||
"""Settings window for touchscreens."""
|
||||
|
||||
def __del__(self) -> None:
|
||||
|
||||
@ -25,7 +25,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
|
||||
class WiimoteSettingsWindow(ba.OldWindow):
|
||||
class WiimoteSettingsWindow(ba.Window):
|
||||
"""Window for setting up Wiimotes."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
@ -112,7 +112,7 @@ class WiimoteSettingsWindow(ba.OldWindow):
|
||||
transition='in_left').get_root_widget())
|
||||
|
||||
|
||||
class WiimoteListenWindow(ba.OldWindow):
|
||||
class WiimoteListenWindow(ba.Window):
|
||||
"""Window shown while listening for a wiimote connection."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
@ -181,7 +181,7 @@ class WiimoteListenWindow(ba.OldWindow):
|
||||
_ba.stop_listening_for_wii_remotes()
|
||||
|
||||
|
||||
class WiimoteLicenseWindow(ba.OldWindow):
|
||||
class WiimoteLicenseWindow(ba.Window):
|
||||
"""Window displaying the Darwiinremote software license."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
class XBox360ControllerSettingsWindow(ba.OldWindow):
|
||||
class XBox360ControllerSettingsWindow(ba.Window):
|
||||
"""UI showing info about xbox 360 controllers."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, List, Tuple, Dict
|
||||
|
||||
|
||||
class SoundtrackBrowserWindow(ba.OldWindow):
|
||||
class SoundtrackBrowserWindow(ba.Window):
|
||||
"""Window for browsing soundtracks."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Dict, Union, Optional
|
||||
|
||||
|
||||
class SoundtrackEditWindow(ba.OldWindow):
|
||||
class SoundtrackEditWindow(ba.Window):
|
||||
"""Window for editing a soundtrack."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
|
||||
class SoundtrackEntryTypeSelectWindow(ba.OldWindow):
|
||||
class SoundtrackEntryTypeSelectWindow(ba.Window):
|
||||
"""Window for selecting a soundtrack entry type."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, List, Optional, Callable
|
||||
|
||||
|
||||
class MacMusicAppPlaylistSelectWindow(ba.OldWindow):
|
||||
class MacMusicAppPlaylistSelectWindow(ba.Window):
|
||||
"""Window for selecting an iTunes playlist."""
|
||||
|
||||
def __init__(self, callback: Callable[[Any], Any],
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
|
||||
class SpecialOfferWindow(ba.OldWindow):
|
||||
class SpecialOfferWindow(ba.Window):
|
||||
"""Window for presenting sales/etc."""
|
||||
|
||||
def __init__(self, offer: Dict[str, Any], transition: str = 'in_right'):
|
||||
|
||||
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional, Tuple, Dict, Union, Sequence
|
||||
|
||||
|
||||
class StoreBrowserWindow(ba.OldWindow):
|
||||
class StoreBrowserWindow(ba.Window):
|
||||
"""Window for browsing the store."""
|
||||
|
||||
def _update_get_tickets_button_pos(self) -> None:
|
||||
|
||||
@ -26,7 +26,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
|
||||
class TelnetAccessRequestWindow(ba.OldWindow):
|
||||
class TelnetAccessRequestWindow(ba.Window):
|
||||
"""Window asking the user whether to allow a telnet connection."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@ -26,7 +26,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
|
||||
class ShowURLWindow(ba.OldWindow):
|
||||
class ShowURLWindow(ba.Window):
|
||||
"""A window presenting a URL to the user visually."""
|
||||
|
||||
def __init__(self, address: str):
|
||||
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Tuple, Dict
|
||||
|
||||
|
||||
class WatchWindow(ba.OldWindow):
|
||||
class WatchWindow(ba.Window):
|
||||
"""Window for watching replays."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||
<h4><em>last updated on 2020-04-04 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||
<h4><em>last updated on 2020-04-05 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||
<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>
|
||||
<hr>
|
||||
@ -138,13 +138,13 @@
|
||||
</ul>
|
||||
<h4><a name="class_category_User_Interface_Classes">User Interface Classes</a></h4>
|
||||
<ul>
|
||||
<li><a href="#class_ba_OldWindow">ba.OldWindow</a></li>
|
||||
<li><a href="#class_ba_UIController">ba.UIController</a></li>
|
||||
<li><a href="#class_ba_UILocation">ba.UILocation</a></li>
|
||||
<ul>
|
||||
<li><a href="#class_ba_UILocationWindow">ba.UILocationWindow</a></li>
|
||||
</ul>
|
||||
<li><a href="#class_ba_Widget">ba.Widget</a></li>
|
||||
<li><a href="#class_ba_Window">ba.Window</a></li>
|
||||
</ul>
|
||||
<h4><a name="function_category_User_Interface_Functions">User Interface Functions</a></h4>
|
||||
<ul>
|
||||
@ -3338,29 +3338,6 @@ acting as an alternative to setting node attributes.</p>
|
||||
<h3>Methods:</h3>
|
||||
<p><all methods inherited from <a href="#class_builtins_Exception">builtins.Exception</a>></p>
|
||||
<hr>
|
||||
<h2><strong><a name="class_ba_OldWindow">ba.OldWindow</a></strong></h3>
|
||||
<p><em><top level class></em>
|
||||
</p>
|
||||
<p>Temp for transitioning windows over to UILocationWindows.</p>
|
||||
|
||||
<p>Category: <a href="#class_category_User_Interface_Classes">User Interface Classes</a>
|
||||
</p>
|
||||
|
||||
<h3>Methods:</h3>
|
||||
<h5><a href="#method_ba_OldWindow____init__"><constructor></a>, <a href="#method_ba_OldWindow__get_root_widget">get_root_widget()</a></h5>
|
||||
<dl>
|
||||
<dt><h4><a name="method_ba_OldWindow____init__"><constructor></a></dt></h4><dd>
|
||||
<p><span>ba.OldWindow(root_widget: <a href="#class_ba_Widget">ba.Widget</a>)</span></p>
|
||||
|
||||
</dd>
|
||||
<dt><h4><a name="method_ba_OldWindow__get_root_widget">get_root_widget()</a></dt></h4><dd>
|
||||
<p><span>get_root_widget(self) -> <a href="#class_ba_Widget">ba.Widget</a></span></p>
|
||||
|
||||
<p>Return the root widget.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<h2><strong><a name="class_ba_OutOfBoundsMessage">ba.OutOfBoundsMessage</a></strong></h3>
|
||||
<p><em><top level class></em>
|
||||
</p>
|
||||
@ -4999,6 +4976,29 @@ widgets.</p>
|
||||
<h3>Methods:</h3>
|
||||
<p><all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>></p>
|
||||
<hr>
|
||||
<h2><strong><a name="class_ba_Window">ba.Window</a></strong></h3>
|
||||
<p><em><top level class></em>
|
||||
</p>
|
||||
<p>A basic window.</p>
|
||||
|
||||
<p>Category: <a href="#class_category_User_Interface_Classes">User Interface Classes</a>
|
||||
</p>
|
||||
|
||||
<h3>Methods:</h3>
|
||||
<h5><a href="#method_ba_Window____init__"><constructor></a>, <a href="#method_ba_Window__get_root_widget">get_root_widget()</a></h5>
|
||||
<dl>
|
||||
<dt><h4><a name="method_ba_Window____init__"><constructor></a></dt></h4><dd>
|
||||
<p><span>ba.Window(root_widget: <a href="#class_ba_Widget">ba.Widget</a>)</span></p>
|
||||
|
||||
</dd>
|
||||
<dt><h4><a name="method_ba_Window__get_root_widget">get_root_widget()</a></dt></h4><dd>
|
||||
<p><span>get_root_widget(self) -> <a href="#class_ba_Widget">ba.Widget</a></span></p>
|
||||
|
||||
<p>Return the root widget.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<h2><strong><a name="function_ba_animate">ba.animate()</a></strong></h3>
|
||||
<p><span>animate(node: <a href="#class_ba_Node">ba.Node</a>, attr: str, keys: Dict[float, float], loop: bool = False, offset: float = 0, timetype: <a href="#class_ba_TimeType">ba.TimeType</a> = <TimeType.SIM: 0>, timeformat: <a href="#class_ba_TimeFormat">ba.TimeFormat</a> = <TimeFormat.SECONDS: 0>, suppress_format_warning: bool = False) -> <a href="#class_ba_Node">ba.Node</a></span></p>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user