Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu/list_manager.py
diff options
context:
space:
mode:
authorDaniel Girtler <girtler.daniel@gmail.com>2024-04-15 18:49:00 +1000
committerGitHub <noreply@github.com>2024-04-15 18:49:00 +1000
commitb470b16ec923260cfd9c5b9f2b88e0a39611b463 (patch)
tree25a32fd904f739e181a62a62451637bcf7cd6588 /archinstall/lib/menu/list_manager.py
parent7d9e9d8ba0bcba888ec46554f87dfc414c73f9c4 (diff)
LVM support (#2104)
* Submenu for disk configuration * Update * Add LVM manual config * PV selection * LVM volume menu * Update * Fix mypy * Update * Update * Update * Update * Update * Update * Update * Update * Update LVM * Update * Update * Btrfs support * Refactor * LVM on Luks * Luks on LVM * Update * LVM on Luks * Update * Update * mypy * Update * Fix bug with LuksOnLvm and Btrfs * Update * Update * Info -> Debug output
Diffstat (limited to 'archinstall/lib/menu/list_manager.py')
-rw-r--r--archinstall/lib/menu/list_manager.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/archinstall/lib/menu/list_manager.py b/archinstall/lib/menu/list_manager.py
index 54fb6a1b..de18791c 100644
--- a/archinstall/lib/menu/list_manager.py
+++ b/archinstall/lib/menu/list_manager.py
@@ -3,6 +3,7 @@ from os import system
from typing import Any, TYPE_CHECKING, Dict, Optional, Tuple, List
from .menu import Menu
+from ..output import FormattedOutput
if TYPE_CHECKING:
_: Any
@@ -127,18 +128,29 @@ class ListManager:
if choice.value and choice.value != self._cancel_action:
self._data = self.handle_action(choice.value, entry, self._data)
- def selected_action_display(self, selection: Any) -> str:
+ def reformat(self, data: List[Any]) -> Dict[str, Optional[Any]]:
"""
- this will return the value to be displayed in the
- "Select an action for '{}'" string
+ Default implementation of the table to be displayed.
+ Override if any custom formatting is needed
"""
- raise NotImplementedError('Please implement me in the child class')
+ table = FormattedOutput.as_table(data)
+ rows = table.split('\n')
- def reformat(self, data: List[Any]) -> Dict[str, Optional[Any]]:
+ # these are the header rows of the table and do not map to any User obviously
+ # we're adding 2 spaces as prefix because the menu selector '> ' will be put before
+ # the selectable rows so the header has to be aligned
+ display_data: Dict[str, Optional[Any]] = {f' {rows[0]}': None, f' {rows[1]}': None}
+
+ for row, entry in zip(rows[2:], data):
+ row = row.replace('|', '\\|')
+ display_data[row] = entry
+
+ return display_data
+
+ def selected_action_display(self, selection: Any) -> str:
"""
- this should return a dictionary of display string to actual data entry
- mapping; if the value for a given display string is None it will be used
- in the header value (useful when displaying tables)
+ this will return the value to be displayed in the
+ "Select an action for '{}'" string
"""
raise NotImplementedError('Please implement me in the child class')