[ci] auto-format

This commit is contained in:
Loup-Garou911XD 2025-09-06 14:13:58 +00:00 committed by github-actions[bot]
parent 3f29ae3a50
commit f62ed2a786

View file

@ -33,9 +33,11 @@ ACCOUNTS_DIR = path.join(USER_DIR, 'account_switcher_profiles')
if not path.exists(ACCOUNTS_DIR): if not path.exists(ACCOUNTS_DIR):
mkdir(ACCOUNTS_DIR) mkdir(ACCOUNTS_DIR)
def print_msg(text: str, color=(0.3, 1, 0.3)): def print_msg(text: str, color=(0.3, 1, 0.3)):
bui.screenmessage(text, color=color) bui.screenmessage(text, color=color)
class AccountSwitcherUI(bui.Window): class AccountSwitcherUI(bui.Window):
def __init__(self): def __init__(self):
# Base dimensions; the final size is controlled by the scale property. # Base dimensions; the final size is controlled by the scale property.
@ -164,7 +166,8 @@ class AccountSwitcherUI(bui.Window):
) )
self._profile_widgets.append(text_widget) self._profile_widgets.append(text_widget)
bui.textwidget( bui.textwidget(
edit=text_widget, on_activate_call=babase.Call(self.on_select_profile, prof, text_widget) edit=text_widget, on_activate_call=babase.Call(
self.on_select_profile, prof, text_widget)
) )
def on_select_profile(self, profile_name: str, selected_widget: bui.Widget): def on_select_profile(self, profile_name: str, selected_widget: bui.Widget):
@ -194,7 +197,7 @@ class AccountSwitcherUI(bui.Window):
try: try:
copy(src, path.join(account_folder, fname)) copy(src, path.join(account_folder, fname))
except IOError as e: except IOError as e:
print_msg(f"Error saving {fname}: {e}", color=(1,0,0)) print_msg(f"Error saving {fname}: {e}", color=(1, 0, 0))
print_msg(f"Saved current account as '{name}'") print_msg(f"Saved current account as '{name}'")
self._refresh_account_list() self._refresh_account_list()
@ -261,10 +264,12 @@ class AccountSwitcherUI(bui.Window):
cancel_is_selected=True, cancel_is_selected=True,
) )
# --- Monkey-Patching --- # --- Monkey-Patching ---
_original_account_settings_init = AccountSettingsWindow.__init__ _original_account_settings_init = AccountSettingsWindow.__init__
_original_on_adapter_sign_in_result = AccountSettingsWindow._on_adapter_sign_in_result _original_on_adapter_sign_in_result = AccountSettingsWindow._on_adapter_sign_in_result
def new_account_settings_init(self, *args, **kwargs): def new_account_settings_init(self, *args, **kwargs):
_original_account_settings_init(self, *args, **kwargs) _original_account_settings_init(self, *args, **kwargs)
button_width = 350 button_width = 350
@ -276,6 +281,8 @@ def new_account_settings_init(self, *args, **kwargs):
label='Switch Accounts...', label='Switch Accounts...',
on_activate_call=lambda: AccountSwitcherUI() on_activate_call=lambda: AccountSwitcherUI()
) )
def new_on_adapter_sign_in_result(self, result: str) -> None: def new_on_adapter_sign_in_result(self, result: str) -> None:
# First, call the original method to ensure default behavior runs. # First, call the original method to ensure default behavior runs.
_original_on_adapter_sign_in_result(self, result) _original_on_adapter_sign_in_result(self, result)
@ -288,6 +295,8 @@ def new_on_adapter_sign_in_result(self, result: str) -> None:
print_msg(f'Sign-in failed: {result}', color=(1, 0, 0)) print_msg(f'Sign-in failed: {result}', color=(1, 0, 0))
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class EntryPoint(babase.Plugin): class EntryPoint(babase.Plugin):
def on_app_running(self): def on_app_running(self):
# Apply both monkey-patches when the app runs. # Apply both monkey-patches when the app runs.