python3.9,removed windows build,kick vote,ban mute commands , rjcd

This commit is contained in:
imayushsaini 2021-11-10 17:26:07 +05:30
parent 94bdfb531a
commit dbe040a017
2453 changed files with 3797 additions and 437553 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -12,14 +12,14 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Tuple, Optional, Dict
from typing import Any, Optional
class AccountLinkWindow(ba.Window):
"""Window for linking accounts."""
def __init__(self, origin_widget: ba.Widget = None):
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
@ -111,7 +111,7 @@ class AccountLinkWindow(ba.Window):
class AccountLinkCodeWindow(ba.Window):
"""Window showing code for account-linking."""
def __init__(self, data: Dict[str, Any]):
def __init__(self, data: dict[str, Any]):
self._width = 350
self._height = 200
uiscale = ba.app.ui.uiscale

View file

@ -12,7 +12,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Optional, Tuple, List, Union
from typing import Optional, Union
class AccountSettingsWindow(ba.Window):
@ -29,7 +29,7 @@ class AccountSettingsWindow(ba.Window):
ba.set_analytics_screen('Account Window')
# If they provided an origin-widget, scale up from that.
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
@ -74,7 +74,7 @@ class AccountSettingsWindow(ba.Window):
self._sub_width = self._scroll_width - 20
# Determine which sign-in/sign-out buttons we should show.
self._show_sign_in_buttons: List[str] = []
self._show_sign_in_buttons: list[str] = []
if app.platform == 'android' and app.subplatform == 'google':
self._show_sign_in_buttons.append('Google Play')

View file

@ -11,14 +11,14 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Optional, Tuple, Dict
from typing import Any, Optional
class AccountUnlinkWindow(ba.Window):
"""A window to kick off account unlinks."""
def __init__(self, origin_widget: ba.Widget = None):
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
@ -104,7 +104,7 @@ class AccountUnlinkWindow(ba.Window):
if i == 0:
ba.widget(edit=txt, up_widget=self._cancel_button)
def _on_entry_selected(self, entry: Dict[str, Any]) -> None:
def _on_entry_selected(self, entry: dict[str, Any]) -> None:
ba.screenmessage(ba.Lstr(resource='pleaseWaitText',
fallback_resource='requestingText'),
color=(0, 1, 0))

View file

@ -11,7 +11,7 @@ import ba
from bastd.ui import popup
if TYPE_CHECKING:
from typing import Any, Tuple, Dict, Optional
from typing import Any, Optional
class AccountViewerWindow(popup.PopupWindow):
@ -20,9 +20,9 @@ class AccountViewerWindow(popup.PopupWindow):
def __init__(self,
account_id: str,
profile_id: str = None,
position: Tuple[float, float] = (0.0, 0.0),
position: tuple[float, float] = (0.0, 0.0),
scale: float = None,
offset: Tuple[float, float] = (0.0, 0.0)):
offset: tuple[float, float] = (0.0, 0.0)):
from ba.internal import is_browser_likely_available, master_server_get
self._account_id = account_id
@ -169,7 +169,7 @@ class AccountViewerWindow(popup.PopupWindow):
ba.open_url(_ba.get_master_server_address() + '/highscores?profile=' +
self._account_id)
def _on_query_response(self, data: Optional[Dict[str, Any]]) -> None:
def _on_query_response(self, data: Optional[dict[str, Any]]) -> None:
# FIXME: Tidy this up.
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches

View file

@ -10,13 +10,13 @@ import ba
from bastd.ui import popup
if TYPE_CHECKING:
from typing import Tuple
pass
class AchievementsWindow(popup.PopupWindow):
"""Popup window to view achievements."""
def __init__(self, position: Tuple[float, float], scale: float = None):
def __init__(self, position: tuple[float, float], scale: float = None):
# pylint: disable=too-many-locals
uiscale = ba.app.ui.uiscale
if scale is None:

View file

@ -12,7 +12,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Optional, Dict, Union
from typing import Any, Optional, Union
class AppInviteWindow(ba.Window):
@ -20,7 +20,7 @@ class AppInviteWindow(ba.Window):
def __init__(self) -> None:
ba.set_analytics_screen('AppInviteWindow')
self._data: Optional[Dict[str, Any]] = None
self._data: Optional[dict[str, Any]] = None
self._width = 650
self._height = 400
@ -114,7 +114,7 @@ class AppInviteWindow(ba.Window):
callback=ba.WeakCall(self._on_code_result))
_ba.run_transactions()
def _on_code_result(self, result: Optional[Dict[str, Any]]) -> None:
def _on_code_result(self, result: Optional[dict[str, Any]]) -> None:
if result is not None:
self._data = result
@ -151,7 +151,7 @@ class AppInviteWindow(ba.Window):
class ShowFriendCodeWindow(ba.Window):
"""Window showing a code for sharing with friends."""
def __init__(self, data: Dict[str, Any]):
def __init__(self, data: dict[str, Any]):
from ba.internal import is_browser_likely_available
ba.set_analytics_screen('Friend Promo Code')
self._width = 650
@ -317,7 +317,7 @@ def handle_app_invites_press(force_code: bool = False) -> None:
ba.Lstr(resource='gatherWindow.requestingAPromoCodeText'),
color=(0, 1, 0))
def handle_result(result: Optional[Dict[str, Any]]) -> None:
def handle_result(result: Optional[dict[str, Any]]) -> None:
with ba.Context('ui'):
if result is None:
ba.screenmessage(ba.Lstr(resource='errorText'),

View file

@ -12,7 +12,7 @@ import ba
from bastd.ui import popup
if TYPE_CHECKING:
from typing import Any, Tuple, Sequence
from typing import Any, Sequence
class CharacterPicker(popup.PopupWindow):
@ -20,10 +20,10 @@ class CharacterPicker(popup.PopupWindow):
def __init__(self,
parent: ba.Widget,
position: Tuple[float, float] = (0.0, 0.0),
position: tuple[float, float] = (0.0, 0.0),
delegate: Any = None,
scale: float = None,
offset: Tuple[float, float] = (0.0, 0.0),
offset: tuple[float, float] = (0.0, 0.0),
tint_color: Sequence[float] = (1.0, 1.0, 1.0),
tint2_color: Sequence[float] = (1.0, 1.0, 1.0),
selected_character: str = None):

View file

@ -10,7 +10,7 @@ import ba
from bastd.ui.popup import PopupWindow
if TYPE_CHECKING:
from typing import Any, Tuple, Sequence, List, Optional
from typing import Any, Sequence, Optional
class ColorPicker(PopupWindow):
@ -21,11 +21,11 @@ class ColorPicker(PopupWindow):
def __init__(self,
parent: ba.Widget,
position: Tuple[float, float],
position: tuple[float, float],
initial_color: Sequence[float] = (1.0, 1.0, 1.0),
delegate: Any = None,
scale: float = None,
offset: Tuple[float, float] = (0.0, 0.0),
offset: tuple[float, float] = (0.0, 0.0),
tag: Any = ''):
# pylint: disable=too-many-locals
from ba.internal import get_player_colors
@ -56,11 +56,11 @@ class ColorPicker(PopupWindow):
focus_size=(190, 220),
bg_color=(0.5, 0.5, 0.5),
offset=offset)
rows: List[List[ba.Widget]] = []
rows: list[list[ba.Widget]] = []
closest_dist = 9999.0
closest = (0, 0)
for y in range(4):
row: List[ba.Widget] = []
row: list[ba.Widget] = []
rows.append(row)
for x in range(4):
color = self.colors[y][x]
@ -159,11 +159,11 @@ class ColorPickerExact(PopupWindow):
def __init__(self,
parent: ba.Widget,
position: Tuple[float, float],
position: tuple[float, float],
initial_color: Sequence[float] = (1.0, 1.0, 1.0),
delegate: Any = None,
scale: float = None,
offset: Tuple[float, float] = (0.0, 0.0),
offset: tuple[float, float] = (0.0, 0.0),
tag: Any = ''):
# pylint: disable=too-many-locals
del parent # Unused var.

View file

@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
import ba
if TYPE_CHECKING:
from typing import Any, Tuple, Union, Callable
from typing import Any, Union, Callable
class ConfigCheckBox:
@ -27,8 +27,8 @@ class ConfigCheckBox:
def __init__(self,
parent: ba.Widget,
configkey: str,
position: Tuple[float, float],
size: Tuple[float, float],
position: tuple[float, float],
size: tuple[float, float],
displayname: Union[str, ba.Lstr] = None,
scale: float = None,
maxwidth: float = None,
@ -84,7 +84,7 @@ class ConfigNumberEdit:
def __init__(self,
parent: ba.Widget,
configkey: str,
position: Tuple[float, float],
position: tuple[float, float],
minval: float = 0.0,
maxval: float = 100.0,
increment: float = 1.0,

View file

@ -10,7 +10,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Union, Callable, Tuple, Optional
from typing import Any, Union, Callable, Optional
class ConfirmWindow:
@ -23,7 +23,7 @@ class ConfirmWindow:
height: float = 100.0,
cancel_button: bool = True,
cancel_is_selected: bool = False,
color: Tuple[float, float, float] = (1, 1, 1),
color: tuple[float, float, float] = (1, 1, 1),
text_scale: float = 1.0,
ok_text: Union[str, ba.Lstr] = None,
cancel_text: Union[str, ba.Lstr] = None,
@ -39,7 +39,7 @@ class ConfirmWindow:
# if they provided an origin-widget, scale up from that
self._transition_out: Optional[str]
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()

View file

@ -16,7 +16,7 @@ from bastd.ui.league.rankbutton import LeagueRankButton
from bastd.ui.store.browser import StoreBrowserWindow
if TYPE_CHECKING:
from typing import Any, Optional, Tuple, Dict, List, Union
from typing import Any, Optional, Union
class CoopBrowserWindow(ba.Window):
@ -62,7 +62,7 @@ class CoopBrowserWindow(ba.Window):
timetype=ba.TimeType.REAL)
# If they provided an origin-widget, scale up from that.
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
@ -361,7 +361,7 @@ class CoopBrowserWindow(ba.Window):
except Exception:
ba.print_exception('Error updating campaign lock.')
def _update_for_data(self, data: Optional[List[Dict[str, Any]]]) -> None:
def _update_for_data(self, data: Optional[list[dict[str, Any]]]) -> None:
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
@ -380,7 +380,7 @@ class CoopBrowserWindow(ba.Window):
# Update all of our tourney buttons based on whats in data.
for i, tbtn in enumerate(self._tournament_buttons):
assert data is not None
entry: Dict[str, Any] = data[i]
entry: dict[str, Any] = data[i]
prize_y_offs = (34 if 'prizeRange3' in entry else
20 if 'prizeRange2' in entry else 12)
x_offs = 90
@ -589,7 +589,7 @@ class CoopBrowserWindow(ba.Window):
('' + str(free_tries_remaining))),
color=(0.6, 0.6, 0.6, 1))
def _on_tournament_query_response(self, data: Optional[Dict[str,
def _on_tournament_query_response(self, data: Optional[dict[str,
Any]]) -> None:
accounts = ba.app.accounts
if data is not None:
@ -835,7 +835,7 @@ class CoopBrowserWindow(ba.Window):
# Tournaments
self._tournament_buttons: List[Dict[str, Any]] = []
self._tournament_buttons: list[dict[str, Any]] = []
v -= 53
# FIXME shouldn't use hard-coded strings here.
@ -976,7 +976,7 @@ class CoopBrowserWindow(ba.Window):
30 + 200 * len(items)), 200),
background=False)
h_spacing = 200
self._custom_buttons: List[GameButton] = []
self._custom_buttons: list[GameButton] = []
h = 0
v2 = -2
for item in items:
@ -1034,10 +1034,10 @@ class CoopBrowserWindow(ba.Window):
self._do_selection_callbacks = True
def _tournament_button(self, parent: ba.Widget, x: float, y: float,
select: bool) -> Dict[str, Any]:
select: bool) -> dict[str, Any]:
sclx = 300
scly = 195.0
data: Dict[str, Any] = {
data: dict[str, Any] = {
'tournament_id': None,
'time_remaining': 0,
'has_time_remaining': False,
@ -1374,7 +1374,7 @@ class CoopBrowserWindow(ba.Window):
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
from bastd.ui.account.viewer import AccountViewerWindow
tournament_id = tournament_button['tournament_id']
@ -1392,7 +1392,7 @@ class CoopBrowserWindow(ba.Window):
position=tournament_button['current_leader_name_text'].
get_screen_space_center())
def _show_scores(self, tournament_button: Dict[str, Any]) -> None:
def _show_scores(self, tournament_button: dict[str, Any]) -> None:
# pylint: disable=cyclic-import
from bastd.ui.tournamentscores import TournamentScoresWindow
tournament_id = tournament_button['tournament_id']
@ -1411,7 +1411,7 @@ class CoopBrowserWindow(ba.Window):
def run(self,
game: Optional[str],
tournament_button: Dict[str, Any] = None) -> None:
tournament_button: dict[str, Any] = None) -> None:
"""Run the provided game."""
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
@ -1421,7 +1421,7 @@ class CoopBrowserWindow(ba.Window):
from bastd.ui.tournamententry import TournamentEntryWindow
from bastd.ui.purchase import PurchaseWindow
from bastd.ui.account import show_sign_in_prompt
args: Dict[str, Any] = {}
args: dict[str, Any] = {}
# Do a bit of pre-flight for tournament options.
if tournament_button is not None:

View file

@ -11,7 +11,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Optional, List, Tuple
from typing import Optional
from bastd.ui.coop.browser import CoopBrowserWindow
@ -98,7 +98,7 @@ class GameButton:
starscale = 35.0 if self._achievements else 45.0
self._star_widgets: List[ba.Widget] = []
self._star_widgets: list[ba.Widget] = []
for _i in range(stars):
imw = ba.imagewidget(parent=parent,
draw_controller=btn,
@ -120,7 +120,7 @@ class GameButton:
xach = x + 69
yach = y + scly - 168
a_scale = 30.0
self._achievement_widgets: List[Tuple[ba.Widget, ba.Widget]] = []
self._achievement_widgets: list[tuple[ba.Widget, ba.Widget]] = []
for ach in self._achievements:
a_complete = ach.complete
imw = ba.imagewidget(

View file

@ -10,7 +10,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Tuple, Optional, Sequence
from typing import Optional, Sequence
class CreditsListWindow(ba.Window):
@ -23,7 +23,7 @@ class CreditsListWindow(ba.Window):
ba.set_analytics_screen('Credits Window')
# if they provided an origin-widget, scale up from that
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()

View file

@ -13,7 +13,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Callable, Sequence, List, Optional
from typing import Any, Callable, Sequence, Optional
class FileSelectorWindow(ba.Window):
@ -34,7 +34,7 @@ class FileSelectorWindow(ba.Window):
self._callback = callback
self._base_path = path
self._path: Optional[str] = None
self._recent_paths: List[str] = []
self._recent_paths: list[str] = []
self._show_base_path = show_base_path
self._valid_file_extensions = [
'.' + ext for ext in valid_file_extensions
@ -173,7 +173,7 @@ class FileSelectorWindow(ba.Window):
class _RefreshThread(threading.Thread):
def __init__(self, path: str,
callback: Callable[[List[str], Optional[str]], Any]):
callback: Callable[[list[str], Optional[str]], Any]):
super().__init__()
self._callback = callback
self._path = path
@ -195,7 +195,7 @@ class FileSelectorWindow(ba.Window):
# Ignore permission-denied.
if 'Errno 13' not in str(exc):
ba.print_exception()
nofiles: List[str] = []
nofiles: list[str] = []
ba.pushcall(ba.Call(self._callback, nofiles, str(exc)),
from_other_thread=True)
@ -205,7 +205,7 @@ class FileSelectorWindow(ba.Window):
self._recent_paths.append(path)
self._RefreshThread(path, self._refresh).start()
def _refresh(self, file_names: List[str], error: Optional[str]) -> None:
def _refresh(self, file_names: list[str], error: Optional[str]) -> None:
# pylint: disable=too-many-statements
# pylint: disable=too-many-branches
# pylint: disable=too-many-locals

View file

@ -13,8 +13,7 @@ import ba
from bastd.ui.tabs import TabRow
if TYPE_CHECKING:
from typing import (Any, Optional, Tuple, Dict, List, Union, Callable,
Type)
from typing import Optional
class GatherTab:
@ -80,7 +79,7 @@ class GatherWindow(ba.Window):
from bastd.ui.gather.nearbytab import NearbyGatherTab
ba.set_analytics_screen('Gather Window')
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
@ -149,7 +148,7 @@ class GatherWindow(ba.Window):
tab_buffer_h = ((320 if condensed else 250) + 2 * x_offs)
# Build up the set of tabs we want.
tabdefs: List[Tuple[GatherWindow.TabID, ba.Lstr]] = [
tabdefs: list[tuple[GatherWindow.TabID, ba.Lstr]] = [
(self.TabID.ABOUT, ba.Lstr(resource=self._r + '.aboutText'))
]
if _ba.get_account_misc_read_val('enablePublicParties', True):
@ -173,14 +172,14 @@ class GatherWindow(ba.Window):
on_select_call=ba.WeakCall(self._set_tab))
# Now instantiate handlers for these tabs.
tabtypes: Dict[GatherWindow.TabID, Type[GatherTab]] = {
tabtypes: dict[GatherWindow.TabID, type[GatherTab]] = {
self.TabID.ABOUT: AboutGatherTab,
self.TabID.MANUAL: ManualGatherTab,
self.TabID.PRIVATE: PrivateGatherTab,
self.TabID.INTERNET: PublicGatherTab,
self.TabID.NEARBY: NearbyGatherTab
}
self._tabs: Dict[GatherWindow.TabID, GatherTab] = {}
self._tabs: dict[GatherWindow.TabID, GatherTab] = {}
for tab_id in self._tab_row.tabs:
tabtype = tabtypes.get(tab_id)
if tabtype is not None:

View file

@ -15,7 +15,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Optional, Dict, List, Tuple, Type, Union, Callable
from typing import Any, Optional, Union, Callable
from bastd.ui.gather import GatherWindow
from bastd.ui.confirm import ConfirmWindow
@ -850,7 +850,7 @@ class ManualGatherTab(GatherTab):
callback=ba.WeakCall(
self._on_accessible_response))
def _on_accessible_response(self, data: Optional[Dict[str, Any]]) -> None:
def _on_accessible_response(self, data: Optional[dict[str, Any]]) -> None:
t_addr = self._t_addr
t_accessible = self._t_accessible
t_accessible_extra = self._t_accessible_extra

View file

@ -12,7 +12,7 @@ import _ba
from bastd.ui.gather import GatherTab
if TYPE_CHECKING:
from typing import Optional, Dict, Any
from typing import Optional, Any
from bastd.ui.gather import GatherWindow
@ -30,7 +30,7 @@ class NetScanner:
left_border=10)
ba.widget(edit=self._columnwidget, up_widget=tab_button)
self._width = width
self._last_selected_host: Optional[Dict[str, Any]] = None
self._last_selected_host: Optional[dict[str, Any]] = None
self._update_timer = ba.Timer(1.0,
ba.WeakCall(self.update),
@ -44,10 +44,10 @@ class NetScanner:
def __del__(self) -> None:
_ba.end_host_scanning()
def _on_select(self, host: Dict[str, Any]) -> None:
def _on_select(self, host: dict[str, Any]) -> None:
self._last_selected_host = host
def _on_activate(self, host: Dict[str, Any]) -> None:
def _on_activate(self, host: dict[str, Any]) -> None:
_ba.connect_to_party(host['address'])
def update(self) -> None:

View file

@ -20,7 +20,7 @@ from bastd.ui.gather import GatherTab
from bastd.ui import getcurrency
if TYPE_CHECKING:
from typing import Optional, Dict, Any, List, Type
from typing import Optional, Any
from bastd.ui.gather import GatherWindow
# Print a bit of info about queries, etc.
@ -160,7 +160,7 @@ class PrivateGatherTab(GatherTab):
raise RuntimeError(f'Invalid sessiontype {sessiontypestr}')
hcfg.session_type = sessiontypestr
sessiontype: Type[ba.Session]
sessiontype: type[ba.Session]
if hcfg.session_type == 'ffa':
sessiontype = ba.FreeForAllSession
elif hcfg.session_type == 'teams':
@ -177,7 +177,7 @@ class PrivateGatherTab(GatherTab):
if playlist_name == '__default__' else
playlist_name)
playlist: Optional[List[Dict[str, Any]]] = None
playlist: Optional[list[dict[str, Any]]] = None
if playlist_name != '__default__':
playlist = (cfg.get(f'{pvars.config_name} Playlists',
{}).get(playlist_name))
@ -197,7 +197,7 @@ class PrivateGatherTab(GatherTab):
hcfg.tutorial = tutorial
if hcfg.session_type == 'teams':
ctn: Optional[List[str]] = cfg.get('Custom Team Names')
ctn: Optional[list[str]] = cfg.get('Custom Team Names')
if ctn is not None:
if (isinstance(ctn, (list, tuple)) and len(ctn) == 2
and all(isinstance(x, str) for x in ctn)):
@ -205,7 +205,7 @@ class PrivateGatherTab(GatherTab):
else:
print(f'Found invalid custom-team-names data: {ctn}')
ctc: Optional[List[List[float]]] = cfg.get('Custom Team Colors')
ctc: Optional[list[list[float]]] = cfg.get('Custom Team Colors')
if ctc is not None:
if (isinstance(ctc, (list, tuple)) and len(ctc) == 2
and all(isinstance(x, (list, tuple)) for x in ctc)
@ -269,7 +269,7 @@ class PrivateGatherTab(GatherTab):
self._last_hosting_state_query_time = now
def _hosting_state_idle_response(self,
result: Optional[Dict[str, Any]]) -> None:
result: Optional[dict[str, Any]]) -> None:
# This simply passes through to our standard response handler.
# The one exception is if we've recently sent an action to the
@ -284,7 +284,7 @@ class PrivateGatherTab(GatherTab):
return
self._hosting_state_response(result)
def _hosting_state_response(self, result: Optional[Dict[str,
def _hosting_state_response(self, result: Optional[dict[str,
Any]]) -> None:
# Its possible for this to come back to us after our UI is dead;
@ -344,7 +344,7 @@ class PrivateGatherTab(GatherTab):
# Kick off an update to get any needed messages sent/etc.
ba.pushcall(self._update)
def _selwidgets(self) -> List[Optional[ba.Widget]]:
def _selwidgets(self) -> list[Optional[ba.Widget]]:
"""An indexed list of widgets we can use for saving/restoring sel."""
return [
self._host_playlist_button, self._host_copy_button,
@ -844,7 +844,7 @@ class PrivateGatherTab(GatherTab):
self._connect_to_party_code(code)
def _connect_response(self, result: Optional[Dict[str, Any]]) -> None:
def _connect_response(self, result: Optional[dict[str, Any]]) -> None:
try:
self._connect_press_time = None
if result is None:

View file

@ -17,7 +17,7 @@ import ba
from bastd.ui.gather import GatherTab
if TYPE_CHECKING:
from typing import Callable, Any, Optional, Dict, Union, Tuple, List
from typing import Callable, Any, Optional, Union
from bastd.ui.gather import GatherWindow
# Print a bit of info about pings, queries, etc.
@ -182,7 +182,7 @@ class UIRow:
class State:
"""State saved/restored only while the app is running."""
sub_tab: SubTabType = SubTabType.JOIN
parties: Optional[List[Tuple[str, PartyEntry]]] = None
parties: Optional[list[tuple[str, PartyEntry]]] = None
next_entry_index: int = 0
filter_value: str = ''
have_server_list_response: bool = False
@ -312,26 +312,26 @@ class PublicGatherTab(GatherTab):
self._host_max_party_size_plus_button: (Optional[ba.Widget]) = None
self._host_status_text: Optional[ba.Widget] = None
self._signed_in = False
self._ui_rows: List[UIRow] = []
self._ui_rows: list[UIRow] = []
self._refresh_ui_row = 0
self._have_user_selected_row = False
self._first_valid_server_list_time: Optional[float] = None
# Parties indexed by id:
self._parties: Dict[str, PartyEntry] = {}
self._parties: dict[str, PartyEntry] = {}
# Parties sorted in display order:
self._parties_sorted: List[Tuple[str, PartyEntry]] = []
self._parties_sorted: list[tuple[str, PartyEntry]] = []
self._party_lists_dirty = True
# Sorted parties with filter applied:
self._parties_displayed: Dict[str, PartyEntry] = {}
self._parties_displayed: dict[str, PartyEntry] = {}
self._next_entry_index = 0
self._have_server_list_response = False
self._have_valid_server_list = False
self._filter_value = ''
self._pending_party_infos: List[Dict[str, Any]] = []
self._pending_party_infos: list[dict[str, Any]] = []
self._last_sub_scroll_height = 0.0
def on_activate(
@ -715,7 +715,7 @@ class PublicGatherTab(GatherTab):
self._do_status_check()
def _on_public_party_query_result(
self, result: Optional[Dict[str, Any]]) -> None:
self, result: Optional[dict[str, Any]]) -> None:
starttime = time.time()
self._have_server_list_response = True
@ -1100,7 +1100,7 @@ class PublicGatherTab(GatherTab):
self._local_address = str(val)
def _on_public_party_accessible_response(
self, data: Optional[Dict[str, Any]]) -> None:
self, data: Optional[dict[str, Any]]) -> None:
# If we've got status text widgets, update them.
text = self._host_status_text

View file

@ -10,7 +10,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Optional, Tuple, Union, Dict
from typing import Any, Optional, Union
class GetCurrencyWindow(ba.Window):
@ -38,7 +38,7 @@ class GetCurrencyWindow(ba.Window):
self._ad_time_text = None
# If they provided an origin-widget, scale up from that.
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()
@ -102,8 +102,8 @@ class GetCurrencyWindow(ba.Window):
self._ad_button = None
def _add_button(item: str,
position: Tuple[float, float],
size: Tuple[float, float],
position: tuple[float, float],
size: tuple[float, float],
label: ba.Lstr,
price: str = None,
tex_name: str = None,
@ -528,7 +528,7 @@ class GetCurrencyWindow(ba.Window):
item))
def _purchase_check_result(self, item: str,
result: Optional[Dict[str, Any]]) -> None:
result: Optional[dict[str, Any]]) -> None:
if result is None:
ba.playsound(ba.getsound('error'))
ba.screenmessage(

View file

@ -10,7 +10,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Optional, Tuple
from typing import Optional
class HelpWindow(ba.Window):
@ -25,7 +25,7 @@ class HelpWindow(ba.Window):
ba.set_analytics_screen('Help Window')
# If they provided an origin-widget, scale up from that.
scale_origin: Optional[Tuple[float, float]]
scale_origin: Optional[tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center()

View file

@ -12,7 +12,7 @@ import ba
from bastd.ui import popup
if TYPE_CHECKING:
from typing import Any, Tuple, Sequence
from typing import Any, Sequence
class IconPicker(popup.PopupWindow):
@ -20,10 +20,10 @@ class IconPicker(popup.PopupWindow):
def __init__(self,
parent: ba.Widget,
position: Tuple[float, float] = (0.0, 0.0),
position: tuple[float, float] = (0.0, 0.0),
delegate: Any = None,
scale: float = None,
offset: Tuple[float, float] = (0.0, 0.0),
offset: tuple[float, float] = (0.0, 0.0),
tint_color: Sequence[float] = (1.0, 1.0, 1.0),
tint2_color: Sequence[float] = (1.0, 1.0, 1.0),
selected_icon: str = None):

View file

@ -10,7 +10,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Tuple, Optional, Callable, Dict, Union
from typing import Any, Optional, Callable, Union
class LeagueRankButton:
@ -18,13 +18,13 @@ class LeagueRankButton:
def __init__(self,
parent: ba.Widget,
position: Tuple[float, float],
size: Tuple[float, float],
position: tuple[float, float],
size: tuple[float, float],
scale: float,
on_activate_call: Callable[[], Any] = None,
transition_delay: float = None,
color: Tuple[float, float, float] = None,
textcolor: Tuple[float, float, float] = None,
color: tuple[float, float, float] = None,
textcolor: tuple[float, float, float] = None,
smooth_update_delay: float = None):
if on_activate_call is None:
on_activate_call = ba.WeakCall(self._default_on_activate_call)
@ -42,7 +42,7 @@ class LeagueRankButton:
self._textcolor = textcolor
self._header_color = (0.8, 0.8, 2.0)
self._parent = parent
self._position: Tuple[float, float] = (0.0, 0.0)
self._position: tuple[float, float] = (0.0, 0.0)
self._button = ba.buttonwidget(parent=parent,
size=size,
@ -211,7 +211,7 @@ class LeagueRankButton:
ba.print_exception('Error doing smooth update.')
self._smooth_update_timer = None
def _update_for_league_rank_data(self, data: Optional[Dict[str,
def _update_for_league_rank_data(self, data: Optional[dict[str,
Any]]) -> None:
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
@ -325,7 +325,7 @@ class LeagueRankButton:
ba.textwidget(edit=self._value_text, text=status_text)
def _on_power_ranking_query_response(
self, data: Optional[Dict[str, Any]]) -> None:
self, data: Optional[dict[str, Any]]) -> None:
self._doing_power_ranking_query = False
ba.app.accounts.cache_league_rank_data(data)
self._update_for_league_rank_data(data)
@ -357,7 +357,7 @@ class LeagueRankButton:
from bastd.ui.league.rankwindow import LeagueRankWindow
LeagueRankWindow(modal=True, origin_widget=self._button)
def set_position(self, position: Tuple[float, float]) -> None:
def set_position(self, position: tuple[float, float]) -> None:
"""Set the button's position."""
self._position = position
if not self._button:

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