bastd.ui.account

UI functionality related to accounts.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""UI functionality related to accounts."""
 4
 5from __future__ import annotations
 6
 7import _ba
 8import ba
 9
10
11def show_sign_in_prompt(account_type: str | None = None) -> None:
12    """Bring up a prompt telling the user they must sign in."""
13    from bastd.ui.confirm import ConfirmWindow
14    from bastd.ui.account import settings
15    if account_type == 'Google Play':
16        ConfirmWindow(
17            ba.Lstr(resource='notSignedInGooglePlayErrorText'),
18            lambda: _ba.sign_in_v1('Google Play'),
19            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
20            width=460,
21            height=130)
22    else:
23        ConfirmWindow(
24            ba.Lstr(resource='notSignedInErrorText'),
25            lambda: settings.AccountSettingsWindow(modal=True,
26                                                   close_once_signed_in=True),
27            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
28            width=460,
29            height=130)
def show_sign_in_prompt(account_type: str | None = None) -> None:
12def show_sign_in_prompt(account_type: str | None = None) -> None:
13    """Bring up a prompt telling the user they must sign in."""
14    from bastd.ui.confirm import ConfirmWindow
15    from bastd.ui.account import settings
16    if account_type == 'Google Play':
17        ConfirmWindow(
18            ba.Lstr(resource='notSignedInGooglePlayErrorText'),
19            lambda: _ba.sign_in_v1('Google Play'),
20            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
21            width=460,
22            height=130)
23    else:
24        ConfirmWindow(
25            ba.Lstr(resource='notSignedInErrorText'),
26            lambda: settings.AccountSettingsWindow(modal=True,
27                                                   close_once_signed_in=True),
28            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
29            width=460,
30            height=130)

Bring up a prompt telling the user they must sign in.