Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu/selection_menu.py
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2022-04-12 19:46:55 +1000
committerGitHub <noreply@github.com>2022-04-12 11:46:55 +0200
commit4f899e3866d81d0e7fec5d496578a0fe81617e72 (patch)
treea643ac193e4ea03ccc3bdcc06ffc4add80a38d9a /archinstall/lib/menu/selection_menu.py
parentf644022e0cbcb13069ea8caff4d5791db3925911 (diff)
Downstream new simple menu feature (#1055)
* Downstream new simple menu feature * Fix flake8 * Update * Fix flake8 Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/menu/selection_menu.py')
-rw-r--r--archinstall/lib/menu/selection_menu.py18
1 files changed, 11 insertions, 7 deletions
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