Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu/menu.py
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2022-02-28 16:17:10 +0100
committerGitHub <noreply@github.com>2022-02-28 16:17:10 +0100
commitf07704529f411b39756a616995c4a3f7725eb550 (patch)
treeda3a368726902ef5b5676c9de1468a79e6ae17f6 /archinstall/lib/menu/menu.py
parent537b9cab037aecfd18edef156dd3ea55072918e9 (diff)
add new widget ListManager (#1005)
* add new widget ListManager * flake8 complains * Null_action appears now in the main list (to simplify additions to the list) Formatted data are now at the from to the actions submenu * Define a default action in the menu, potentially independent of a null_action Both default and null actions don't have to be part of the element's action list Some cleanup
Diffstat (limited to 'archinstall/lib/menu/menu.py')
-rw-r--r--archinstall/lib/menu/menu.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/archinstall/lib/menu/menu.py b/archinstall/lib/menu/menu.py
index 1d5d497e..d7b1605d 100644
--- a/archinstall/lib/menu/menu.py
+++ b/archinstall/lib/menu/menu.py
@@ -1,6 +1,7 @@
from typing import Dict, List, Union, Any, TYPE_CHECKING
from archinstall.lib.menu.simple_menu import TerminalMenu
+
from ..exceptions import RequirementError
from ..output import log
@@ -22,7 +23,8 @@ class Menu(TerminalMenu):
default_option :str = None,
sort :bool = True,
preset_values :Union[str, List[str]] = None,
- cursor_index :int = None
+ cursor_index :int = None,
+ **kwargs
):
"""
Creates a new menu
@@ -51,6 +53,8 @@ class Menu(TerminalMenu):
:param cursor_index: The position where the cursor will be located. If it is not in range (number of elements of the menu) it goes to the first position
:type cursor_index: int
+
+ :param kwargs : any SimpleTerminal parameter
"""
# we guarantee the inmutability of the options outside the class.
# an unknown number of iterables (.keys(),.values(),generator,...) can't be directly copied, in this case
@@ -103,19 +107,23 @@ class Menu(TerminalMenu):
cursor = "> "
main_menu_cursor_style = ("fg_cyan", "bold")
main_menu_style = ("bg_blue", "fg_gray")
-
+ # defaults that can be changed up the stack
+ kwargs['clear_screen'] = kwargs.get('clear_screen',True)
+ kwargs['show_search_hint'] = kwargs.get('show_search_hint',True)
+ kwargs['cycle_cursor'] = kwargs.get('cycle_cursor',True)
super().__init__(
menu_entries=self.menu_options,
title=menu_title,
menu_cursor=cursor,
menu_cursor_style=main_menu_cursor_style,
menu_highlight_style=main_menu_style,
- cycle_cursor=True,
- clear_screen=True,
+ # cycle_cursor=True,
+ # clear_screen=True,
multi_select=multi,
- show_search_hint=True,
+ # show_search_hint=True,
preselected_entries=self.preset_values,
- cursor_index=self.cursor_index
+ cursor_index=self.cursor_index,
+ **kwargs,
)
def _show(self):