diff --git a/vanilla_installer/defaults/conn_check.py b/vanilla_installer/defaults/conn_check.py index 0dbc4563..af561b85 100644 --- a/vanilla_installer/defaults/conn_check.py +++ b/vanilla_installer/defaults/conn_check.py @@ -42,6 +42,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__key = key self.__step = step self.__step_num = step["num"] + self.delta = False self.__ignore_callback = False diff --git a/vanilla_installer/defaults/disk.py b/vanilla_installer/defaults/disk.py index dbf5d75a..8b4ed2fc 100644 --- a/vanilla_installer/defaults/disk.py +++ b/vanilla_installer/defaults/disk.py @@ -671,6 +671,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False self.__registry_disks = [] self.__selected_disks = [] self.__disks = DisksManager() diff --git a/vanilla_installer/defaults/encryption.py b/vanilla_installer/defaults/encryption.py index 9e45030d..855fff2c 100644 --- a/vanilla_installer/defaults/encryption.py +++ b/vanilla_installer/defaults/encryption.py @@ -37,6 +37,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False self.btn_next.connect("clicked", self.__window.next) self.use_encryption_switch.connect( diff --git a/vanilla_installer/defaults/image.py b/vanilla_installer/defaults/image.py index 2cd35ff1..ea58828d 100644 --- a/vanilla_installer/defaults/image.py +++ b/vanilla_installer/defaults/image.py @@ -31,6 +31,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False self.btn_next.connect("clicked", self.__window.next) self.image_url_entry.connect( diff --git a/vanilla_installer/defaults/keyboard.py b/vanilla_installer/defaults/keyboard.py index dca9a31e..c151743c 100644 --- a/vanilla_installer/defaults/keyboard.py +++ b/vanilla_installer/defaults/keyboard.py @@ -78,11 +78,14 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = True self.__keymaps = KeyMaps() - self.__keyboard_rows = self.__generate_keyboard_list_widgets( self.selected_keyboard ) + + + def gen_deltas(self): for i, widget in enumerate(self.__keyboard_rows): self.all_keyboards_group.append(widget) @@ -103,6 +106,11 @@ def __init__(self, window, distro_info, key, step, **kwargs): if "VANILLA_NO_APPLY_XKB" not in os.environ: self.test_focus_controller.connect("enter", self.__apply_layout) + + def del_deltas(self): + self.all_keyboards_group.remove_all() + + def __keyboard_verify(self, *args): if self.selected_keyboard != []: self.btn_next.set_sensitive(True) @@ -192,7 +200,7 @@ def __set_keyboard_layout(self, selected_keyboard): self.__create_keyboard_layout_array(selected_keyboard) ), ) - + def __create_keyboard_layout_array(self, selected_keyboard): keyboard_layout_array = [] for i in selected_keyboard: diff --git a/vanilla_installer/defaults/language.py b/vanilla_installer/defaults/language.py index 09cd3979..61f0f934 100644 --- a/vanilla_installer/defaults/language.py +++ b/vanilla_installer/defaults/language.py @@ -60,10 +60,8 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__key = key self.__step = step self.__language_rows = [] - + self.delta = True self.__generate_language_list_widgets() - for widget in self.__language_rows: - self.all_languages_group.append(widget) # signals self.btn_next.connect("clicked", self.__window.next) @@ -77,6 +75,15 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.search_controller.connect("key-released", self.__on_search_key_pressed) self.entry_search_language.add_controller(self.search_controller) + + def gen_deltas(self): + for widget in self.__language_rows: + self.all_languages_group.append(widget) + + + def del_deltas(self): + self.all_languages_group.remove_all() + def __language_verify(self, *args): if self.selected_language["language_subtitle"] is not None: self.btn_next.set_sensitive(True) diff --git a/vanilla_installer/defaults/network.py b/vanilla_installer/defaults/network.py index 75c1d8c9..be2393ca 100644 --- a/vanilla_installer/defaults/network.py +++ b/vanilla_installer/defaults/network.py @@ -256,6 +256,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__step = step self.__nm_client = NM.Client.new() self.__step_num = step["num"] + self.delta = False self.__devices = [] self.__wired_children = [] diff --git a/vanilla_installer/defaults/nvidia.py b/vanilla_installer/defaults/nvidia.py index 065209b9..c783cf95 100644 --- a/vanilla_installer/defaults/nvidia.py +++ b/vanilla_installer/defaults/nvidia.py @@ -34,6 +34,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False self.btn_yes.connect("clicked", self.use_proprietary_drivers) self.btn_no.connect("clicked", self.use_open_drivers) diff --git a/vanilla_installer/defaults/theme.py b/vanilla_installer/defaults/theme.py index 75280c30..3a17a6e4 100644 --- a/vanilla_installer/defaults/theme.py +++ b/vanilla_installer/defaults/theme.py @@ -31,6 +31,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False self.__build_ui() diff --git a/vanilla_installer/defaults/timezone.py b/vanilla_installer/defaults/timezone.py index b8210944..53a22574 100644 --- a/vanilla_installer/defaults/timezone.py +++ b/vanilla_installer/defaults/timezone.py @@ -86,10 +86,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__key = key self.__step = step self.__step_num = step["num"] - - self.__expanders = [] - self.__tz_entries = [] - self.__generate_timezone_list_widgets() + self.delta = True # signals self.btn_next.connect("clicked", self.__window.next) @@ -98,6 +95,20 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.search_controller.connect("key-released", self.__on_search_key_pressed) self.entry_search_timezone.add_controller(self.search_controller) + + def gen_deltas(self): + self.__expanders = [] + self.__tz_entries = [] + self.__generate_timezone_list_widgets() + + + def del_deltas(self): + self.__tz_entries = [] + for i in self.__expanders: + self.all_timezones_group.remove(i) + self.__expanders = [] + + def timezone_verify(self, carousel=None, idx=None): if idx is not None and idx != self.__step_num: return diff --git a/vanilla_installer/defaults/vm.py b/vanilla_installer/defaults/vm.py index 33818d6f..b4234761 100644 --- a/vanilla_installer/defaults/vm.py +++ b/vanilla_installer/defaults/vm.py @@ -33,6 +33,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False self.btn_yes.connect("clicked", self.use_vm_tools_fn) self.btn_no.connect("clicked", self.skip_vm_tools_fn) diff --git a/vanilla_installer/defaults/welcome.py b/vanilla_installer/defaults/welcome.py index f5c1c929..011a1be9 100644 --- a/vanilla_installer/defaults/welcome.py +++ b/vanilla_installer/defaults/welcome.py @@ -36,6 +36,7 @@ def __init__(self, window, distro_info, key, step, **kwargs): self.__distro_info = distro_info self.__key = key self.__step = step + self.delta = False distro_name = self.__distro_info.get("name", "Vanilla OS") distro_logo = self.__distro_info.get("logo", "org.vanillaos.Installer-flower") diff --git a/vanilla_installer/views/confirm.py b/vanilla_installer/views/confirm.py index 27ec785c..256947f6 100644 --- a/vanilla_installer/views/confirm.py +++ b/vanilla_installer/views/confirm.py @@ -58,6 +58,7 @@ class VanillaConfirm(Adw.Bin): def __init__(self, window, **kwargs): super().__init__(**kwargs) + self.delta = False def update(self, finals): try: diff --git a/vanilla_installer/views/done.py b/vanilla_installer/views/done.py index 44775faf..d0556bdb 100644 --- a/vanilla_installer/views/done.py +++ b/vanilla_installer/views/done.py @@ -35,6 +35,7 @@ def __init__(self, window, **kwargs): super().__init__(**kwargs) self.__window = window self.__log = None + self.delta = False self.status_page.set_description( _("Restart your device to enjoy your {} experience.").format( diff --git a/vanilla_installer/views/progress.py b/vanilla_installer/views/progress.py index b018116c..9b905aac 100644 --- a/vanilla_installer/views/progress.py +++ b/vanilla_installer/views/progress.py @@ -48,6 +48,7 @@ def __init__(self, window, tour: dict, **kwargs): self.__font.set_weight(Pango.Weight.NORMAL) self.__font.set_stretch(Pango.Stretch.NORMAL) self.style_manager = Adw.StyleManager().get_default() + self.delta = False self.__build_ui() self.__on_setup_terminal_colors() diff --git a/vanilla_installer/windows/main_window.py b/vanilla_installer/windows/main_window.py index 49c1301e..2abb6580 100644 --- a/vanilla_installer/windows/main_window.py +++ b/vanilla_installer/windows/main_window.py @@ -145,6 +145,10 @@ def next(self, widget=None, fn=None, *args): logger.info("Going to next page") cur_index = self.carousel.get_position() + page = self.carousel.get_nth_page(cur_index) + if page.delta: + logger.info(f"Removing deltas of page {int(cur_index)}") + page.del_deltas() logger.info(f"Next page is {int(cur_index + 1)}") if fn is not None: @@ -154,15 +158,23 @@ def next(self, widget=None, fn=None, *args): page = self.carousel.get_nth_page(cur_index + 1) self.carousel.scroll_to(page, True) + if page.delta: + logger.info(f"Generating deltas of page {int(cur_index + 1)}") + page.gen_deltas() def back(self, *args): logger.info("Going to previous page") cur_index = self.carousel.get_position() + page = self.carousel.get_nth_page(cur_index) + if page.delta: + page.del_deltas() logger.info(f"Previous page is {int(cur_index - 1)}") page = self.carousel.get_nth_page(cur_index - 1) self.carousel.scroll_to(page, True) + if page.delta: + page.gen_deltas() def toast(self, message, timeout=3): toast = Adw.Toast.new(message)