From 4f899e3866d81d0e7fec5d496578a0fe81617e72 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 12 Apr 2022 19:46:55 +1000 Subject: Downstream new simple menu feature (#1055) * Downstream new simple menu feature * Fix flake8 * Update * Fix flake8 Co-authored-by: Daniel Girtler --- archinstall/lib/menu/selection_menu.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'archinstall/lib/menu/selection_menu.py') diff --git a/archinstall/lib/menu/selection_menu.py b/archinstall/lib/menu/selection_menu.py index 18313360..cbcb2583 100644 --- a/archinstall/lib/menu/selection_menu.py +++ b/archinstall/lib/menu/selection_menu.py @@ -116,6 +116,9 @@ class Selector: self._description = description def menu_text(self) -> str: + if self._description == '': # special menu option for __separator__ + return '' + current = '' if self._display_func: @@ -273,21 +276,22 @@ class GeneralMenu: # This will just help the user with the next following questions. self._set_kb_language() enabled_menus = self._menus_to_enable() - menu_text = [m.text for m in enabled_menus.values()] + menu_options = [m.text for m in enabled_menus.values()] selection = Menu( _('Set/Modify the below options'), - menu_text, + menu_options, sort=False, cursor_index=cursor_pos, preview_command=self._preview_display, - preview_size=self.preview_size + preview_size=self.preview_size, + skip_empty_entries=True ).run() if selection and self.auto_cursor: - cursor_pos = menu_text.index(selection) + 1 # before the strip otherwise fails - if cursor_pos >= len(menu_text): - cursor_pos = len(menu_text) - 1 + cursor_pos = menu_options.index(selection) + 1 # before the strip otherwise fails + if cursor_pos >= len(menu_options): + cursor_pos = len(menu_options) - 1 selection = selection.strip() if selection: # if this calls returns false, we exit the menu. We allow for an callback for special processing on realeasing control @@ -416,4 +420,4 @@ class GeneralMenu: def _select_archinstall_language(self, default_lang): language = select_archinstall_language(default_lang) self._translation.activate(language) - return language \ No newline at end of file + return language -- cgit v1.2.3-54-g00ecf