index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Daniel <blackrabbit256@gmail.com> | 2022-04-22 21:24:43 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 13:24:43 +0200 |
commit | bbedc0bb19a75b937b49001e8845c6b73bccb25b (patch) | |
tree | cbb7fef3be7e45362b11cb1c228a6a8b33c02e90 /archinstall/lib/menu/selection_menu.py | |
parent | 477b5b120e120766d789a691fce60cec843aff43 (diff) |
-rw-r--r-- | archinstall/lib/menu/selection_menu.py | 16 |
diff --git a/archinstall/lib/menu/selection_menu.py b/archinstall/lib/menu/selection_menu.py index ca48fda2..37e54685 100644 --- a/archinstall/lib/menu/selection_menu.py +++ b/archinstall/lib/menu/selection_menu.py @@ -181,6 +181,7 @@ class GeneralMenu: ;type preview_size: float (range 0..1) """ + self._enabled_order = [] self._translation = Translation.load_nationalization() self.is_context_mgr = False self._data_store = data_store if data_store is not None else {} @@ -239,10 +240,15 @@ class GeneralMenu: if arg is not None: self._menu_options[selector_name].set_current_selection(arg) + def _update_enabled_order(self, selector_name: str): + self._enabled_order.append(selector_name) + def enable(self, selector_name :str, omit_if_set :bool = False , mandatory :bool = False): """ activates menu options """ if self._menu_options.get(selector_name, None): self._menu_options[selector_name].set_enabled(True) + self._update_enabled_order(selector_name) + if mandatory: self._menu_options[selector_name].set_mandatory(True) self.synch(selector_name,omit_if_set) @@ -372,7 +378,15 @@ class GeneralMenu: if self._verify_selection_enabled(name): enabled_menus[name] = selection - return enabled_menus + # sort the enabled menu by the order we enabled them in + # we'll add the entries that have been enabled via the selector constructor at the top + enabled_keys = [i for i in enabled_menus.keys() if i not in self._enabled_order] + # and then we add the ones explicitly enabled by the enable function + enabled_keys += [i for i in self._enabled_order if i in enabled_menus.keys()] + + ordered_menus = {k: enabled_menus[k] for k in enabled_keys} + + return ordered_menus def option(self,name :str) -> Selector: # TODO check inexistent name |