bauiv1lib.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 bauiv1 as bui 8 9 10def show_sign_in_prompt(account_type: str | None = None) -> None: 11 """Bring up a prompt telling the user they must sign in.""" 12 from bauiv1lib.confirm import ConfirmWindow 13 from bauiv1lib.account import settings 14 15 if account_type == 'Google Play': 16 17 def _do_sign_in() -> None: 18 plus = bui.app.plus 19 assert plus is not None 20 plus.sign_in_v1('Google Play') 21 22 ConfirmWindow( 23 bui.Lstr(resource='notSignedInGooglePlayErrorText'), 24 _do_sign_in, 25 ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'), 26 width=460, 27 height=130, 28 ) 29 else: 30 ConfirmWindow( 31 bui.Lstr(resource='notSignedInErrorText'), 32 lambda: settings.AccountSettingsWindow( 33 modal=True, close_once_signed_in=True 34 ), 35 ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'), 36 width=460, 37 height=130, 38 )
def
show_sign_in_prompt(account_type: str | None = None) -> None:
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 bauiv1lib.confirm import ConfirmWindow 14 from bauiv1lib.account import settings 15 16 if account_type == 'Google Play': 17 18 def _do_sign_in() -> None: 19 plus = bui.app.plus 20 assert plus is not None 21 plus.sign_in_v1('Google Play') 22 23 ConfirmWindow( 24 bui.Lstr(resource='notSignedInGooglePlayErrorText'), 25 _do_sign_in, 26 ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'), 27 width=460, 28 height=130, 29 ) 30 else: 31 ConfirmWindow( 32 bui.Lstr(resource='notSignedInErrorText'), 33 lambda: settings.AccountSettingsWindow( 34 modal=True, close_once_signed_in=True 35 ), 36 ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'), 37 width=460, 38 height=130, 39 )
Bring up a prompt telling the user they must sign in.