diff --git a/clive/__private/core/profile.py b/clive/__private/core/profile.py index f134efc82..053015ea9 100644 --- a/clive/__private/core/profile.py +++ b/clive/__private/core/profile.py @@ -109,9 +109,9 @@ def is_newly_created(self) -> bool: """Determine if the profile is newly created (has not been saved yet).""" return self._is_newly_created - @property - def is_any_profile_saved(self) -> bool: - return bool(self.list_profiles()) + @classmethod + def is_any_profile_saved(cls) -> bool: + return bool(cls.list_profiles()) @classmethod def is_only_one_profile_saved(cls) -> bool: diff --git a/clive/__private/ui/app.py b/clive/__private/ui/app.py index 593469d39..5e908d067 100644 --- a/clive/__private/ui/app.py +++ b/clive/__private/ui/app.py @@ -14,6 +14,7 @@ from textual.reactive import var from clive.__private.core.constants.terminal import TERMINAL_HEIGHT, TERMINAL_WIDTH +from clive.__private.core.profile import Profile from clive.__private.core.world import TUIWorld from clive.__private.logger import logger from clive.__private.settings import safe_settings @@ -170,7 +171,7 @@ def on_mount(self) -> None: debug_loop_period_secs = safe_settings.dev.debug_loop_period_secs self.set_interval(debug_loop_period_secs, self.__debug_log) - if self.world.profile.is_any_profile_saved: + if Profile.is_any_profile_saved(): self.switch_mode("unlock") else: self.switch_mode("create_profile") diff --git a/clive/__private/ui/forms/create_profile/welcome_form_screen.py b/clive/__private/ui/forms/create_profile/welcome_form_screen.py index 27906068e..46ae63521 100644 --- a/clive/__private/ui/forms/create_profile/welcome_form_screen.py +++ b/clive/__private/ui/forms/create_profile/welcome_form_screen.py @@ -7,6 +7,7 @@ from textual.widgets import Static from clive.__private.core.constants.tui.messages import PRESS_HELP_MESSAGE +from clive.__private.core.profile import Profile from clive.__private.ui.forms.create_profile.context import CreateProfileContext from clive.__private.ui.forms.form_screen import FirstFormScreen from clive.__private.ui.get_css import get_relative_css_path @@ -39,7 +40,7 @@ def create_main_panel(self) -> ComposeResult: yield CliveButton("Start!", id_="welcome-button-start") def on_mount(self) -> None: - if self.profile.is_any_profile_saved: + if Profile.is_any_profile_saved(): # If the user requested profile creation from a `Unlock` screen, it is possible to back to the `Unlock` # screen otherwise, during first time profile creation there is NO screen to go back to self.bind(Binding("escape", "back", "Back"))