Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction/subvolume_config.py
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-06-09 22:54:12 +1000
committerGitHub <noreply@github.com>2022-06-09 14:54:12 +0200
commit0bdb46f3081aaed095f87e35b18b3714d8782ed1 (patch)
tree894ef3050fdfae1b455fea5ad06aac980c9e26a5 /archinstall/lib/user_interaction/subvolume_config.py
parentaec86eb04e96f4c178cf89f7e72a257d12019fdc (diff)
Fancy user interface (#1320)
* Display submenus as tables * Update * Update * Update * Update Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/user_interaction/subvolume_config.py')
-rw-r--r--archinstall/lib/user_interaction/subvolume_config.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/archinstall/lib/user_interaction/subvolume_config.py b/archinstall/lib/user_interaction/subvolume_config.py
index a54ec891..e2797bba 100644
--- a/archinstall/lib/user_interaction/subvolume_config.py
+++ b/archinstall/lib/user_interaction/subvolume_config.py
@@ -5,6 +5,7 @@ from ..menu.menu import MenuSelectionType
from ..menu.text_input import TextInput
from ..menu import Menu
from ..models.subvolume import Subvolume
+from ... import FormattedOutput
if TYPE_CHECKING:
_: Any
@@ -19,16 +20,23 @@ class SubvolumeList(ListManager):
]
super().__init__(prompt, current_volumes, self._actions, self._actions[0])
- def reformat(self, data: List[Subvolume]) -> Dict[str, Subvolume]:
- return {e.display(): e for e in data}
+ def reformat(self, data: List[Subvolume]) -> Dict[str, Optional[Subvolume]]:
+ table = FormattedOutput.as_table(data)
+ rows = table.split('\n')
- def action_list(self):
- active_user = self.target if self.target else None
+ # 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[Subvolume]] = {f' {rows[0]}': None, f' {rows[1]}': None}
- if active_user is None:
- return [self._actions[0]]
- else:
- return self._actions[1:]
+ for row, subvol in zip(rows[2:], data):
+ row = row.replace('|', '\\|')
+ display_data[row] = subvol
+
+ return display_data
+
+ def selected_action_display(self, subvolume: Subvolume) -> str:
+ return subvolume.name
def _prompt_options(self, editing: Optional[Subvolume] = None) -> List[str]:
preset_options = []