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:
authorWerner Llácer <wllacer@gmail.com>2022-08-01 09:44:26 +0200
committerGitHub <noreply@github.com>2022-08-01 09:44:26 +0200
commit3bc39225458b32fcd43b8a5b76dbb6797723a86c (patch)
tree28d33463384af8298374540c447fc0677d1b4ee9 /archinstall/lib/menu/selection_menu.py
parentd2f58362c9035be57670784584a666eea8c09e60 (diff)
Enhacements to list_manager: (#1346)
* Enhacements to list_manager: method filter_option. To filter options based on selected entry attrib. last_choice. Which is the last action executed before exiting the loop * last_choice is now a calculated attribute, therefore readonly * Added last_choice to selection_menu * bug at selection_menu handling. Translations can be a problem
Diffstat (limited to 'archinstall/lib/menu/selection_menu.py')
-rw-r--r--archinstall/lib/menu/selection_menu.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/archinstall/lib/menu/selection_menu.py b/archinstall/lib/menu/selection_menu.py
index 8dd6fcce..c6ac5852 100644
--- a/archinstall/lib/menu/selection_menu.py
+++ b/archinstall/lib/menu/selection_menu.py
@@ -188,6 +188,11 @@ class GeneralMenu:
self._menu_options: Dict[str, Selector] = {}
self._setup_selection_menu_options()
self.preview_size = preview_size
+ self._last_choice = None
+
+ @property
+ def last_choice(self):
+ return self._last_choice
def __enter__(self, *args :Any, **kwargs :Any) -> GeneralMenu:
self.is_context_mgr = True
@@ -325,6 +330,10 @@ class GeneralMenu:
if not self._process_selection(value):
break
+ # we get the last action key
+ actions = {str(v.description):k for k,v in self._menu_options.items()}
+ self._last_choice = actions[selection.value.strip()]
+
if not self.is_context_mgr:
self.__exit__()