* Fixes #1127 * flake8 Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
This commit is contained in:
parent
6bf5949842
commit
4e39bfb563
|
|
@ -7,7 +7,6 @@ from ..disk import BlockDevice
|
||||||
from ..exceptions import DiskError
|
from ..exceptions import DiskError
|
||||||
from ..menu import Menu
|
from ..menu import Menu
|
||||||
from ..menu.menu import MenuSelectionType
|
from ..menu.menu import MenuSelectionType
|
||||||
from ..output import log
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
_: Any
|
_: Any
|
||||||
|
|
@ -60,7 +59,7 @@ def select_disk_layout(preset: Optional[Dict[str, Any]], block_devices: list, ad
|
||||||
return select_individual_blockdevice_usage(block_devices)
|
return select_individual_blockdevice_usage(block_devices)
|
||||||
|
|
||||||
|
|
||||||
def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> BlockDevice:
|
def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> Optional[BlockDevice]:
|
||||||
"""
|
"""
|
||||||
Asks the user to select a harddrive from the `dict_o_disks` selection.
|
Asks the user to select a harddrive from the `dict_o_disks` selection.
|
||||||
Usually this is combined with :ref:`archinstall.list_drives`.
|
Usually this is combined with :ref:`archinstall.list_drives`.
|
||||||
|
|
@ -73,19 +72,15 @@ def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> BlockDevice:
|
||||||
"""
|
"""
|
||||||
drives = sorted(list(dict_o_disks.keys()))
|
drives = sorted(list(dict_o_disks.keys()))
|
||||||
if len(drives) >= 1:
|
if len(drives) >= 1:
|
||||||
for index, drive in enumerate(drives):
|
title = str(_('You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)')) + '\n'
|
||||||
print(
|
title += str(_('Select one of the disks or skip and use /mnt as default'))
|
||||||
f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})"
|
|
||||||
)
|
|
||||||
|
|
||||||
log("You can skip selecting a drive and partitioning and use whatever drive-setup is mounted at /mnt (experimental)",
|
choice = Menu(title, drives).run()
|
||||||
fg="yellow")
|
|
||||||
|
|
||||||
drive = Menu('Select one of the disks or skip and use "/mnt" as default"', drives).run()
|
if choice.type_ == MenuSelectionType.Esc:
|
||||||
if not drive:
|
return None
|
||||||
return drive
|
|
||||||
|
|
||||||
drive = dict_o_disks[drive]
|
drive = dict_o_disks[choice.value]
|
||||||
return drive
|
return drive
|
||||||
|
|
||||||
raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')
|
raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue