bauiv1lib.account.signin
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() -> None: 11 """Bring up a prompt telling the user they must sign in.""" 12 from bauiv1lib.confirm import ConfirmWindow 13 14 ConfirmWindow( 15 bui.Lstr(resource='notSignedInErrorText'), 16 _show_account_settings, 17 ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'), 18 width=460, 19 height=130, 20 ) 21 22 23def _show_account_settings() -> None: 24 from bauiv1lib.account.settings import AccountSettingsWindow 25 26 # NOTE TO USERS: The code below is not the proper way to do things; 27 # whenever possible one should use a MainWindow's 28 # main_window_replace() or main_window_back() methods. We just need 29 # to do things a bit more manually in this case. 30 31 prev_main_window = bui.app.ui_v1.get_main_window() 32 33 # Special-case: If it seems we're already in the account window, do 34 # nothing. 35 if isinstance(prev_main_window, AccountSettingsWindow): 36 return 37 38 # Set our new main window. 39 bui.app.ui_v1.set_main_window( 40 AccountSettingsWindow( 41 close_once_signed_in=True, 42 origin_widget=bui.get_special_widget('account_button'), 43 ), 44 from_window=False, 45 is_auxiliary=True, 46 suppress_warning=True, 47 ) 48 49 # Transition out any previous main window. 50 if prev_main_window is not None: 51 prev_main_window.main_window_close()
def
show_sign_in_prompt() -> None:
11def show_sign_in_prompt() -> None: 12 """Bring up a prompt telling the user they must sign in.""" 13 from bauiv1lib.confirm import ConfirmWindow 14 15 ConfirmWindow( 16 bui.Lstr(resource='notSignedInErrorText'), 17 _show_account_settings, 18 ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'), 19 width=460, 20 height=130, 21 )
Bring up a prompt telling the user they must sign in.