Skip to content

Commit

Permalink
Revert "Added restart button on final page"
Browse files Browse the repository at this point in the history
This reverts commit 13c3500.
  • Loading branch information
MagicLike committed Mar 23, 2023
1 parent 475cfa3 commit f24ed79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 38 deletions.
24 changes: 6 additions & 18 deletions openandroidinstaller/openandroidinstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self, state: AppState):
self.view = Column(expand=True, width=1200)

# create default starter views
self.welcome_view = WelcomeView(
welcome_view = WelcomeView(
on_confirm=self.to_next_view,
state=self.state,
)
Expand All @@ -103,10 +103,7 @@ def __init__(self, state: AppState):
)

# create the final success view
self.success_view = SuccessView(
on_confirm=self.restart,
state=self.state,
)
self.final_view = SuccessView(state=self.state)

# initialize the addon view
self.select_addon_view = AddonsView(
Expand All @@ -123,7 +120,7 @@ def __init__(self, state: AppState):
select_files_view,
requirements_view,
start_view,
self.welcome_view,
welcome_view,
]
)
self.state.add_addon_views(
Expand All @@ -135,7 +132,7 @@ def __init__(self, state: AppState):
# final default views, ordered to allow to pop
self.state.add_final_default_views(
views=[
self.success_view,
self.final_view,
self.install_view,
]
)
Expand Down Expand Up @@ -181,19 +178,10 @@ def to_next_view(self, e):

# else:
# # display the final view
# self.view.controls.append(self.success_view)
# self.view.controls.append(self.final_view)
logger.info("Confirmed and moved to next step.")
self.view.update()

def restart(self, e):
"""Method to display the first view."""
self.welcome_view.init_visuals()
# clear the current view
self.view.controls = []
# retrieve the new view and update
self.view.controls.append(self.welcome_view)
logger.info("Restart.")
self.view.update()


def configure(page: Page):
"""Configure the application."""
Expand Down
21 changes: 1 addition & 20 deletions openandroidinstaller/views/success_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
# If not, see <https://www.gnu.org/licenses/>."""
# Author: Tobias Sterbak

from typing import Callable

import webbrowser
from loguru import logger
from flet import (
ElevatedButton,
Row,
Text,
Markdown,
icons,
)

from views import BaseView
Expand All @@ -31,13 +28,8 @@


class SuccessView(BaseView):
def __init__(
self,
state: AppState,
on_confirm: Callable,
):
def __init__(self, state: AppState):
super().__init__(state=state, image="success.png")
self.on_confirm = on_confirm

def build(
self,
Expand Down Expand Up @@ -77,16 +69,5 @@ def close_window(e):
)
]
),
Row(
[
ElevatedButton(
"Flash new device",
on_click=self.on_confirm,
icon=icons.RESTART_ALT,
disabled=False,
expand=True,
)
]
),
]
return self.view

0 comments on commit f24ed79

Please sign in to comment.