# Released under the MIT License. See LICENSE for details.#"""UI functionality related to accounts."""from__future__importannotationsimportbauiv1asbui
[docs]defshow_sign_in_prompt()->None:"""Bring up a prompt telling the user they must sign in."""frombauiv1lib.confirmimportConfirmWindowConfirmWindow(bui.Lstr(resource='notSignedInErrorText'),_show_account_settings,ok_text=bui.Lstr(resource='accountSettingsWindow.signInText'),width=460,height=130,)
def_show_account_settings()->None:frombauiv1lib.account.settingsimportAccountSettingsWindow# NOTE TO USERS: The code below is not the proper way to do things;# whenever possible one should use a MainWindow's# main_window_replace() or main_window_back() methods. We just need# to do things a bit more manually in this case.prev_main_window=bui.app.ui_v1.get_main_window()# Special-case: If it seems we're already in the account window, do# nothing.ifisinstance(prev_main_window,AccountSettingsWindow):return# Set our new main window.bui.app.ui_v1.set_main_window(AccountSettingsWindow(close_once_signed_in=True,origin_widget=bui.get_special_widget('account_button'),),from_window=False,is_auxiliary=True,suppress_warning=True,)# Transition out any previous main window.ifprev_main_windowisnotNone:prev_main_window.main_window_close()