Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
svartkanin committed Sep 30, 2024
1 parent 882dc2a commit fbfa833
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 61 deletions.
7 changes: 6 additions & 1 deletion archinstall/lib/disk/disk_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ def _prev_disk_layouts(self, item: MenuItem) -> Optional[str]:
if not item.value:
return None

disk_layout_conf: DiskLayoutConfiguration = item.value
disk_layout_conf: DiskLayoutConfiguration = item.get_value()

if disk_layout_conf.config_type == DiskLayoutType.Pre_mount:
msg = str(_('Configuration type: {}')).format(disk_layout_conf.config_type.display_msg()) + '\n'
msg += str(_('Mountpoint')) + ': ' + str(disk_layout_conf.mountpoint)
return msg

device_mods: List[DeviceModification] = \
list(filter(lambda x: len(x.partitions) > 0, disk_layout_conf.device_modifications))
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/disk/encryption_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
MenuItemGroup, MenuItem, SelectMenu,
FrameProperties, Alignment, ResultType
)
from archinstall.tui.table_menu import MenuHelper
from archinstall.lib.menu.menu_helper import MenuHelper


if TYPE_CHECKING:
Expand Down
7 changes: 5 additions & 2 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,13 @@ def _prev_disk_config(self, item: MenuItem) -> Optional[str]:
disk_layout_conf: Optional[disk.DiskLayoutConfiguration] = item.value

if disk_layout_conf:
output = str(_('Configuration type: {}')).format(disk_layout_conf.config_type.display_msg())
output = str(_('Configuration type: {}')).format(disk_layout_conf.config_type.display_msg()) + '\n'

if disk_layout_conf.config_type == disk.DiskLayoutType.Pre_mount:
output += str(_('Mountpoint')) + ': ' + str(disk_layout_conf.mountpoint)

if disk_layout_conf.lvm_config:
output += '\n{}: {}'.format(str(_('LVM configuration type')), disk_layout_conf.lvm_config.config_type.display_msg())
output += '{}: {}'.format(str(_('LVM configuration type')), disk_layout_conf.lvm_config.config_type.display_msg())

return output

Expand Down
20 changes: 15 additions & 5 deletions archinstall/lib/interactions/disk_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
from ..utils.util import prompt_dir
from ..storage import storage

from archinstall.lib.menu.menu_helper import MenuHelper
from archinstall.tui import (
MenuItemGroup, MenuItem, SelectMenu,
FrameProperties, Alignment, ResultType,
MenuHelper, Orientation
Orientation
)

if TYPE_CHECKING:
Expand Down Expand Up @@ -268,7 +269,7 @@ def select_mount_options() -> List[str]:

match result.type_:
case ResultType.Selection:
return result.get_value()
return [result.get_value()]
case _:
raise ValueError('Unhandled result type')

Expand Down Expand Up @@ -544,12 +545,21 @@ def suggest_lvm_layout(
filesystem_type = select_main_filesystem_format()

if filesystem_type == disk.FilesystemType.Btrfs:
prompt = str(_('Would you like to use BTRFS subvolumes with a default structure?'))
prompt = str(_('Would you like to use BTRFS subvolumes with a default structure?')) + '\n'
group = MenuItemGroup.yes_no()
result = SelectMenu(group, header=prompt, search_enabled=False, allow_skip=False).single()
group.set_focus_by_value(MenuItem.yes().value)

using_subvolumes = MenuItem.yes() == result.item()
result = SelectMenu(
group,
header=prompt,
search_enabled=False,
allow_skip=False,
orientation=Orientation.HORIZONTAL,
columns=2,
alignment=Alignment.CENTER,
).single()

using_subvolumes = MenuItem.yes() == result.item()
mount_options = select_mount_options()

if using_subvolumes:
Expand Down
4 changes: 2 additions & 2 deletions archinstall/lib/menu/list_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def run(self) -> List[Any]:
elif value in self._terminate_actions:
break
else: # an entry of the existing selection was chosen
selected_entry = data_formatted[value]
selected_entry = result.get_value()
self._run_actions_on_entry(selected_entry)

self._last_choice = value
Expand Down Expand Up @@ -151,7 +151,7 @@ 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}
display_data: Dict[str, Optional[Any]] = {f'{rows[0]}': None, f'{rows[1]}': None}

for row, entry in zip(rows[2:], data):
display_data[row] = entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from archinstall.lib.output import FormattedOutput

from . import (
from archinstall.tui import (
MenuItemGroup, MenuItem
)

Expand Down
2 changes: 0 additions & 2 deletions archinstall/tui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@
PreviewStyle, FrameProperties, FrameStyle, Alignment,
Result, ResultType, ItemType, Chars, Orientation
)

from .table_menu import MenuHelper
Loading

0 comments on commit fbfa833

Please sign in to comment.