diff --git a/archinstall/default_profiles/desktop.py b/archinstall/default_profiles/desktop.py index 9e2d4c933..9099c17bd 100644 --- a/archinstall/default_profiles/desktop.py +++ b/archinstall/default_profiles/desktop.py @@ -70,12 +70,13 @@ def do_on_select(self) -> Optional[SelectResult]: result = SelectMenu( group, + multi=True, allow_reset=True, allow_skip=True, preview_style=PreviewStyle.RIGHT, preview_size='auto', preview_frame=FrameProperties.max('Info') - ).multi() + ).run() match result.type_: case ResultType.Selection: diff --git a/archinstall/default_profiles/profile.py b/archinstall/default_profiles/profile.py index ce492639d..2b52602ea 100644 --- a/archinstall/default_profiles/profile.py +++ b/archinstall/default_profiles/profile.py @@ -4,7 +4,6 @@ from enum import Enum, auto from typing import List, Optional, Any, Dict, TYPE_CHECKING -from ..lib.utils.util import format_cols from ..lib.storage import storage if TYPE_CHECKING: @@ -187,24 +186,20 @@ def preview_text(self) -> Optional[str]: """ return self.packages_text() - def packages_text(self, include_sub_packages: bool = False) -> Optional[str]: - header = str(_('Installed packages')) - - text = '' - packages = [] + def packages_text(self, include_sub_packages: bool = False) -> str: + packages = set() if self.packages: - packages = self.packages + packages = set(self.packages) if include_sub_packages: - for p in self.current_selection: - if p.packages: - packages += p.packages + for sub_profile in self.current_selection: + if sub_profile.packages: + packages.update(sub_profile.packages) - text += format_cols(sorted(set(packages))) + text = str(_('Installed packages')) + ':\n' - if text: - text = f'{header}: \n{text}' - return text + for pkg in sorted(packages): + text += f'\t- {pkg}\n' - return None + return text diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 963083ab8..e34091462 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -8,7 +8,6 @@ from .general import SysCommand from .networking import list_interfaces, enrich_iface_types from .output import debug -from .utils.util import format_cols if TYPE_CHECKING: _: Any @@ -78,9 +77,12 @@ def is_nvidia(self) -> bool: return False def packages_text(self) -> str: - text = str(_('Installed packages')) + ':\n' pkg_names = [p.value for p in self.gfx_packages()] - text += format_cols(sorted(pkg_names)) + text = str(_('Installed packages')) + ':\n' + + for p in sorted(pkg_names): + text += f'\t- {p}\n' + return text def gfx_packages(self) -> List[GfxPackage]: diff --git a/archinstall/lib/utils/util.py b/archinstall/lib/utils/util.py index 159e5c6c4..354d3e022 100644 --- a/archinstall/lib/utils/util.py +++ b/archinstall/lib/utils/util.py @@ -122,4 +122,6 @@ def format_cols(items: List[str], header: Optional[str] = None) -> str: col = 4 text += FormattedOutput.as_columns(items, col) + # remove whitespaces on each row + text = '\n'.join([t.strip() for t in text.split('\n')]) return text diff --git a/archinstall/tui/curses_menu.py b/archinstall/tui/curses_menu.py index a544ceb9d..2a86b1508 100644 --- a/archinstall/tui/curses_menu.py +++ b/archinstall/tui/curses_menu.py @@ -780,6 +780,7 @@ class SelectMenu(AbstractCurses): def __init__( self, group: MenuItemGroup, + multi: bool = False, orientation: Orientation = Orientation.VERTICAL, alignment: Alignment = Alignment.LEFT, columns: int = 1, @@ -797,9 +798,9 @@ def __init__( ): super().__init__() + self._multi = multi self._cursor_char = f'{cursor_char} ' self._search_enabled = search_enabled - self._multi = False self._allow_skip = allow_skip self._allow_reset = allow_reset self._active_search = False @@ -848,6 +849,11 @@ def _get_header_offset(self) -> int: offset += 3 return offset + def run(self) -> Result: + result = tui.run(self) + self._clear_all() + return result + def single(self) -> Result[MenuItem]: self._multi = False result = tui.run(self) @@ -1020,6 +1026,8 @@ def _determine_prev_size( match self._preview_style: case PreviewStyle.RIGHT: menu_width = self._item_group.max_width + 5 + if self._multi: + menu_width += 5 prev_size = self._max_width - menu_width case PreviewStyle.BOTTOM: menu_height = len(self._item_group.items) + 1 # leave empty line between menu and preview