diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index 49f69155..5614e925 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -40,6 +40,7 @@ def __init__( # placeholders self.advanced = False self.install_addons = False + self.addon_paths = None self.config = None self.image_path = None self.recovery_path = None diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py index 110c9f91..f9c1f9e2 100644 --- a/openandroidinstaller/views/install_addons_view.py +++ b/openandroidinstaller/views/install_addons_view.py @@ -33,7 +33,7 @@ from views import BaseView from app_state import AppState -from tooling import adb_twrp_install_addons +from tooling import adb_twrp_install_addons, adb_reboot from widgets import ( confirm_button, get_title, @@ -158,16 +158,22 @@ def run_install_addons(self, e): self.right_view.update() # run the install script - for line in adb_twrp_install_addons( - addons=self.state.addon_paths, - bin_path=self.state.bin_path, - is_ab=self.state.config.is_ab, - ): - # write the line to advanced output terminal - self.terminal_box.write_line(line) - # in case the install command is run, we want to update the progress bar - self.progress_indicator.display_progress_bar(line) - self.progress_indicator.update() + if self.state.addon_paths: + for line in adb_twrp_install_addons( + addons=self.state.addon_paths, + bin_path=self.state.bin_path, + is_ab=self.state.config.is_ab, + ): + # write the line to advanced output terminal + self.terminal_box.write_line(line) + # in case the install command is run, we want to update the progress bar + self.progress_indicator.display_progress_bar(line) + self.progress_indicator.update() + else: + logger.info("No addons selected. Rebooting to OS.") + for line in adb_reboot(bin_path=self.state.bin_path): + # write the line to advanced output terminal + self.terminal_box.write_line(line) success = line # the last element of the iterable is a boolean encoding success/failure # update the view accordingly @@ -177,7 +183,7 @@ def run_install_addons(self, e): # also remove the last error text if it happened self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly." else: - sleep(5) # wait to make sure everything is fine + sleep(4) # wait to make sure everything is fine logger.success("Installation process was successful. Allow to continue.") # enable the confirm button and disable the call button self.confirm_button.disabled = False