Skip to content
Snippets Groups Projects
Commit f59f142d authored by Mateusz Żebrak's avatar Mateusz Żebrak
Browse files

Remove dead code related to skipping screens

parent f75968cf
No related branches found
No related tags found
2 merge requests!600v1.27.5.21 Release,!558Remove welcome profile from TUIWorld, set TUIWorld profile during CreateProfile wizard instead
......@@ -31,12 +31,3 @@ class CreateProfileForm(Form[CreateProfileContext]):
def _rebuild_context(self) -> None:
profile = Profile.create(WELCOME_PROFILE_NAME)
self.__context = CreateProfileContext(profile, Node(profile))
def _skip_during_push_screen(self) -> list[ScreenBuilder[CreateProfileContext]]:
screens_to_skip: list[ScreenBuilder[CreateProfileContext]] = []
# skip NewKeyAliasForm if there is no working account set
if not self.context.profile.accounts.has_working_account:
screens_to_skip.append(NewKeyAliasFormScreen)
return screens_to_skip
......@@ -21,7 +21,6 @@ class Form(Contextual[ContextT], CliveScreen[None]):
def __init__(self) -> None:
self._current_screen_index = 0
self._screens: list[ScreenBuilder[ContextT]] = [*list(self.register_screen_builders())]
self._skipped_screens: set[ScreenBuilder[ContextT]] = set()
assert len(self._screens) >= self.MINIMUM_SCREEN_COUNT, "Form must have at least 2 screens"
self._rebuild_context()
self._post_actions = Queue[PostAction]()
......@@ -40,20 +39,12 @@ class Form(Contextual[ContextT], CliveScreen[None]):
assert self._current_screen_index == 0
self._push_current_screen()
def _skip_during_push_screen(self) -> list[ScreenBuilder[ContextT]]:
return []
def next_screen(self) -> None:
if not self._check_valid_range(self._current_screen_index + 1):
return
self._current_screen_index += 1
if self._is_current_screen_to_skip():
self._skipped_screens.add(self.current_screen)
self.next_screen()
return
self._push_current_screen()
def previous_screen(self) -> None:
......@@ -62,20 +53,9 @@ class Form(Contextual[ContextT], CliveScreen[None]):
self._current_screen_index -= 1
if self._is_current_screen_skipped():
self._skipped_screens.discard(self.current_screen)
self.previous_screen()
return
# self.dismiss() won't work here because self is Form and not FormScreen
self.app.pop_screen()
def _is_current_screen_to_skip(self) -> bool:
return self.current_screen in self._skip_during_push_screen()
def _is_current_screen_skipped(self) -> bool:
return self.current_screen in self._skipped_screens
def _push_current_screen(self) -> None:
self.app.push_screen(self.current_screen(self))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment