From 37d6da7e4eb8897dfb80797f28db85ccdd09d376 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 3 Feb 2022 00:26:09 +1100 Subject: Migrate old input to new menu (#874) * Migrate old input to new menu * Fix imports * Remove imports * Update * Fixed import by changing 'import archinstall', to 'from ..menu import Menu' and use Menu() directly * Converted archinstall. to from ..where import . This enables us to use archinstall as a module, a git repository in testing and other things without having to install archinstall as an actual module. Co-authored-by: Daniel Girtler Co-authored-by: Anton Hvornum --- archinstall/lib/disk/user_guides.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'archinstall/lib/disk/user_guides.py') diff --git a/archinstall/lib/disk/user_guides.py b/archinstall/lib/disk/user_guides.py index 25db14ea..8acb8cd2 100644 --- a/archinstall/lib/disk/user_guides.py +++ b/archinstall/lib/disk/user_guides.py @@ -1,6 +1,7 @@ from __future__ import annotations import logging from typing import Optional, Dict, Any, List, TYPE_CHECKING + # https://stackoverflow.com/a/39757388/929999 if TYPE_CHECKING: from .blockdevice import BlockDevice @@ -8,6 +9,7 @@ if TYPE_CHECKING: from .helpers import sort_block_devices_based_on_performance, select_largest_device, select_disk_larger_than_or_close_to from ..hardware import has_uefi from ..output import log +from ..menu import Menu def suggest_single_disk_layout(block_device :BlockDevice, default_filesystem :Optional[str] = None, @@ -22,7 +24,9 @@ def suggest_single_disk_layout(block_device :BlockDevice, using_home_partition = False if default_filesystem == 'btrfs': - using_subvolumes = input('Would you like to use BTRFS subvolumes with a default structure? (Y/n): ').strip().lower() in ('', 'y', 'yes') + prompt = 'Would you like to use BTRFS subvolumes with a default structure?' + choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run() + using_subvolumes = choice == 'yes' layout = { block_device.path : { @@ -76,7 +80,9 @@ def suggest_single_disk_layout(block_device :BlockDevice, layout[block_device.path]['partitions'][-1]['start'] = '513MiB' if not using_subvolumes and block_device.size >= MIN_SIZE_TO_ALLOW_HOME_PART: - using_home_partition = input('Would you like to create a separate partition for /home? (Y/n): ').strip().lower() in ('', 'y', 'yes') + prompt = 'Would you like to create a separate partition for /home?' + choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run() + using_home_partition = choice == 'yes' # Set a size for / (/root) if using_subvolumes or block_device.size < MIN_SIZE_TO_ALLOW_HOME_PART or not using_home_partition: -- cgit v1.2.3-54-g00ecf