Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 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
welcome_view = WelcomeView(
self.welcome_view = WelcomeView(
on_confirm=self.to_next_view,
state=self.state,
)
Expand All @@ -97,10 +97,16 @@ def __init__(self, state: AppState):
)

# create the install view
self.install_view = InstallView(on_confirm=self.to_next_view, state=self.state)
self.install_view = InstallView(
on_confirm=self.to_next_view,
state=self.state,
)

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

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

# else:
# # display the final view
# self.view.controls.append(self.final_view)
# self.view.controls.append(self.success_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 Expand Up @@ -247,6 +262,17 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
padding=15,
tooltip="Frequently asked questions and encountered issues.",
),
Container(
content=ElevatedButton(
icon=icons.FEEDBACK_OUTLINED,
text="Give feedback",
on_click=lambda _: webbrowser.open(
"https://openandroidinstaller.org/feedback.html"
),
),
padding=15,
tooltip="Give feedback about your experience with OpenAndroidInstaller",
),
Container(
content=ElevatedButton(
icon=icons.BUG_REPORT_OUTLINED,
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/views/start_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def build(self):
FilledButton(
"Search for device",
on_click=self.search_devices,
icon=icons.PHONE_ANDROID,
icon=icons.DEVICES_OTHER_OUTLINED,
expand=True,
tooltip="Search for a connected device.",
),
Expand Down
27 changes: 20 additions & 7 deletions openandroidinstaller/views/success_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
# 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 @@ -28,17 +31,19 @@


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

def build(
self,
):
def close_window(e):
logger.success("Success! Close the window.")
# open the feedback page
feedback_url = "https://openandroidinstaller.org/feedback.html"
webbrowser.open(feedback_url)
# close the window
self.page.window_close()

Expand All @@ -47,7 +52,7 @@ def close_window(e):
get_title("Installation completed successfully!"),
]
# right view main part
contribute_link = "https://github.com/openandroidinstaller-dev/openandroidinstaller#contributing"
contribute_link = "https://openandroidinstaller.org/#contribute"
self.right_view.controls = [
Text(
"Now your devices boots into the new OS. Have fun with it!",
Expand All @@ -66,11 +71,19 @@ def close_window(e):
Row(
[
ElevatedButton(
"Finish and close",
"Flash new device",
on_click=self.on_confirm,
icon=icons.RESTART_ALT,
disabled=False,
expand=True,
),
ElevatedButton(
"Finish and close",
on_click=close_window,
icon=icons.EXIT_TO_APP_OUTLINED,
expand=True,
)
]
),
)
]
return self.view