Rename ask* functions to select* (#4191)

This commit is contained in:
Daniel Girtler 2026-01-31 08:17:11 +11:00 committed by GitHub
parent e2ba6cbc54
commit 449c1bfb36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 50 additions and 56 deletions

View File

@ -45,7 +45,7 @@ class HyprlandProfile(XorgProfile):
return [pref]
return []
def _ask_seat_access(self) -> None:
def _select_seat_access(self) -> None:
# need to activate seat service and add to seat group
header = tr('Hyprland needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)')
header += '\n' + tr('Choose an option to give Hyprland access to your hardware') + '\n'
@ -67,4 +67,4 @@ class HyprlandProfile(XorgProfile):
@override
def do_on_select(self) -> None:
self._ask_seat_access()
self._select_seat_access()

View File

@ -42,7 +42,7 @@ class LabwcProfile(XorgProfile):
return [pref]
return []
def _ask_seat_access(self) -> None:
def _select_seat_access(self) -> None:
# need to activate seat service and add to seat group
header = tr('labwc needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)')
header += '\n' + tr('Choose an option to give labwc access to your hardware') + '\n'
@ -64,4 +64,4 @@ class LabwcProfile(XorgProfile):
@override
def do_on_select(self) -> None:
self._ask_seat_access()
self._select_seat_access()

View File

@ -50,7 +50,7 @@ class NiriProfile(XorgProfile):
return [pref]
return []
def _ask_seat_access(self) -> None:
def _select_seat_access(self) -> None:
# need to activate seat service and add to seat group
header = tr('niri needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)')
header += '\n' + tr('Choose an option to give niri access to your hardware') + '\n'
@ -72,4 +72,4 @@ class NiriProfile(XorgProfile):
@override
def do_on_select(self) -> None:
self._ask_seat_access()
self._select_seat_access()

View File

@ -52,7 +52,7 @@ class SwayProfile(XorgProfile):
return [pref]
return []
def _ask_seat_access(self) -> None:
def _select_seat_access(self) -> None:
# need to activate seat service and add to seat group
header = tr('Sway needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)')
header += '\n' + tr('Choose an option to give Sway access to your hardware') + '\n'
@ -74,4 +74,4 @@ class SwayProfile(XorgProfile):
@override
def do_on_select(self) -> None:
self._ask_seat_access()
self._select_seat_access()

View File

@ -7,7 +7,7 @@ from archinstall.lib.models.authentication import AuthenticationConfiguration, U
from archinstall.lib.models.users import Password, User
from archinstall.lib.output import FormattedOutput
from archinstall.lib.translationhandler import tr
from archinstall.lib.user.user_menu import ask_for_additional_users
from archinstall.lib.user.user_menu import select_users
from archinstall.lib.utils.util import get_password
from archinstall.tui.ui.menu_item import MenuItem, MenuItemGroup
from archinstall.tui.ui.result import ResultType
@ -58,7 +58,7 @@ class AuthenticationMenu(AbstractSubMenu[AuthenticationConfiguration]):
def _create_user_account(self, preset: list[User] | None = None) -> list[User]:
preset = [] if preset is None else preset
users = ask_for_additional_users(preset=preset)
users = select_users(preset=preset)
return users
def _prev_users(self, item: MenuItem) -> str | None:

View File

@ -91,7 +91,7 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]):
return self._bootloader_conf
def _select_bootloader(self, preset: Bootloader | None) -> Bootloader | None:
bootloader = ask_for_bootloader(preset)
bootloader = select_bootloader(preset)
if bootloader:
# Update UKI option based on bootloader
@ -177,7 +177,7 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]):
raise ValueError('Unhandled result type')
def ask_for_bootloader(preset: Bootloader | None) -> Bootloader | None:
def select_bootloader(preset: Bootloader | None) -> Bootloader | None:
options = []
hidden_options = []
default = None

View File

@ -4,7 +4,7 @@ from pathlib import Path
from archinstall.lib.translationhandler import tr
from ..interactions.general_conf import ask_abort
from ..interactions.general_conf import confirm_abort
from ..luks import Luks2
from ..models.device import (
DiskEncryption,
@ -335,6 +335,6 @@ class FilesystemHandler:
print(c, end='', flush=True)
time.sleep(0.25)
except KeyboardInterrupt:
ask_abort()
confirm_abort()
return True

View File

@ -5,8 +5,8 @@ from archinstall.lib.disk.disk_menu import DiskLayoutConfigurationMenu
from archinstall.lib.models.application import ApplicationConfiguration, ZramConfiguration
from archinstall.lib.models.authentication import AuthenticationConfiguration
from archinstall.lib.models.device import DiskLayoutConfiguration, DiskLayoutType, FilesystemType, PartitionModification
from archinstall.lib.network.network_menu import ask_to_configure_network
from archinstall.lib.packages.packages import ask_additional_packages_to_install, list_available_packages
from archinstall.lib.network.network_menu import select_network
from archinstall.lib.packages.packages import list_available_packages, select_additional_packages
from archinstall.tui.ui.menu_item import MenuItem, MenuItemGroup
from .applications.application_menu import ApplicationMenu
@ -17,11 +17,11 @@ from .configuration import save_config
from .hardware import SysInfo
from .interactions.general_conf import (
add_number_of_parallel_downloads,
ask_for_a_timezone,
ask_hostname,
ask_ntp,
select_hostname,
select_ntp,
select_timezone,
)
from .interactions.system_conf import ask_for_swap, select_kernel
from .interactions.system_conf import select_kernel, select_swap
from .locale.locale_menu import LocaleMenu
from .menu.abstract_menu import CONFIG_KEY, AbstractMenu
from .mirrors import MirrorListHandler, MirrorMenu
@ -86,7 +86,7 @@ class GlobalMenu(AbstractMenu[None]):
MenuItem(
text=tr('Swap'),
value=ZramConfiguration(enabled=True),
action=ask_for_swap,
action=select_swap,
preview_action=self._prev_swap,
key='swap',
),
@ -108,7 +108,7 @@ class GlobalMenu(AbstractMenu[None]):
MenuItem(
text=tr('Hostname'),
value='archlinux',
action=ask_hostname,
action=select_hostname,
preview_action=self._prev_hostname,
key='hostname',
),
@ -133,7 +133,7 @@ class GlobalMenu(AbstractMenu[None]):
),
MenuItem(
text=tr('Network configuration'),
action=ask_to_configure_network,
action=select_network,
value={},
preview_action=self._prev_network_config,
key='network_config',
@ -154,14 +154,14 @@ class GlobalMenu(AbstractMenu[None]):
),
MenuItem(
text=tr('Timezone'),
action=ask_for_a_timezone,
action=select_timezone,
value='UTC',
preview_action=self._prev_tz,
key='timezone',
),
MenuItem(
text=tr('Automatic time sync (NTP)'),
action=ask_ntp,
action=select_ntp,
value=True,
preview_action=self._prev_ntp,
key='ntp',
@ -547,7 +547,7 @@ class GlobalMenu(AbstractMenu[None]):
if config:
repositories = set(config.optional_repositories)
packages = ask_additional_packages_to_install(
packages = select_additional_packages(
preset,
repositories=repositories,
)

View File

@ -8,26 +8,26 @@ from .disk_conf import (
)
from .general_conf import (
add_number_of_parallel_downloads,
ask_for_a_timezone,
ask_hostname,
ask_ntp,
select_archinstall_language,
select_hostname,
select_ntp,
select_timezone,
)
from .system_conf import ask_for_swap, select_driver, select_kernel
from .system_conf import select_driver, select_kernel, select_swap
__all__ = [
'add_number_of_parallel_downloads',
'ask_for_a_timezone',
'ask_for_swap',
'ask_hostname',
'ask_ntp',
'get_default_partition_layout',
'select_archinstall_language',
'select_devices',
'select_disk_config',
'select_driver',
'select_hostname',
'select_kernel',
'select_main_filesystem_format',
'select_ntp',
'select_swap',
'select_timezone',
'suggest_multi_disk_layout',
'suggest_single_disk_layout',
]

View File

@ -18,7 +18,7 @@ class PostInstallationAction(Enum):
CHROOT = tr('chroot into installation for post-installation configurations')
def ask_ntp(preset: bool = True) -> bool:
def select_ntp(preset: bool = True) -> bool:
header = tr('Would you like to use automatic time synchronization (NTP) with the default time servers?\n') + '\n'
header += (
tr(
@ -42,7 +42,7 @@ def ask_ntp(preset: bool = True) -> bool:
raise ValueError('Unhandled return type')
def ask_hostname(preset: str | None = None) -> str | None:
def select_hostname(preset: str | None = None) -> str | None:
result = Input(
header=tr('Enter a hostname'),
allow_skip=True,
@ -61,7 +61,7 @@ def ask_hostname(preset: str | None = None) -> str | None:
raise ValueError('Unhandled result type')
def ask_for_a_timezone(preset: str | None = None) -> str | None:
def select_timezone(preset: str | None = None) -> str | None:
default = 'UTC'
timezones = list_timezones()
@ -179,7 +179,7 @@ def add_number_of_parallel_downloads(preset: int = 1) -> int | None:
return downloads
def ask_post_installation(elapsed_time: float | None = None) -> PostInstallationAction:
def select_post_installation(elapsed_time: float | None = None) -> PostInstallationAction:
header = 'Installation completed'
if elapsed_time is not None:
minutes = int(elapsed_time // 60)
@ -203,7 +203,7 @@ def ask_post_installation(elapsed_time: float | None = None) -> PostInstallation
raise ValueError('Post installation action not handled')
def ask_abort() -> None:
def confirm_abort() -> None:
prompt = tr('Do you really want to abort?') + '\n'
result = Confirmation(

View File

@ -43,7 +43,7 @@ def select_kernel(preset: list[str] = []) -> list[str]:
return result.get_values()
def ask_for_uki(preset: bool = True) -> bool:
def select_uki(preset: bool = True) -> bool:
prompt = tr('Would you like to use unified kernel images?') + '\n'
result = Confirmation(header=prompt, allow_skip=True, preset=preset).show()
@ -108,7 +108,7 @@ def select_driver(options: list[GfxDriver] = [], preset: GfxDriver | None = None
return result.get_value()
def ask_for_swap(preset: ZramConfiguration = ZramConfiguration(enabled=True)) -> ZramConfiguration:
def select_swap(preset: ZramConfiguration = ZramConfiguration(enabled=True)) -> ZramConfiguration:
prompt = tr('Would you like to use swap on zram?') + '\n'
group = MenuItemGroup.yes_no()

View File

@ -166,7 +166,7 @@ class ManualNetworkConfig(ListManager[Nic]):
return Nic(iface=iface_name)
def ask_to_configure_network(preset: NetworkConfiguration | None) -> NetworkConfiguration | None:
def select_network(preset: NetworkConfiguration | None) -> NetworkConfiguration | None:
"""
Configure the network on the newly installed system
"""

View File

@ -85,7 +85,7 @@ def _parse_package_output[PackageType: (AvailablePackage, LocalPackage)](
return cls.model_validate(package)
def ask_additional_packages_to_install(
def select_additional_packages(
preset: list[str] = [],
repositories: set[Repository] = set(),
) -> list[str]:

View File

@ -109,7 +109,7 @@ class UserList(ListManager[User]):
return User(username, password, sudo)
def ask_for_additional_users(prompt: str = '', preset: list[User] = []) -> list[User]:
def select_users(prompt: str = '', preset: list[User] = []) -> list[User]:
users = UserList(prompt, preset).show()
if users is None:

View File

@ -12,7 +12,7 @@ from archinstall.lib.general import check_version_upgrade
from archinstall.lib.global_menu import GlobalMenu
from archinstall.lib.hardware import SysInfo
from archinstall.lib.installer import Installer, accessibility_tools_in_use, run_custom_user_commands
from archinstall.lib.interactions.general_conf import PostInstallationAction, ask_post_installation
from archinstall.lib.interactions.general_conf import PostInstallationAction, select_post_installation
from archinstall.lib.mirrors import MirrorListHandler
from archinstall.lib.models import Bootloader
from archinstall.lib.models.device import (
@ -26,13 +26,7 @@ from archinstall.lib.profile.profiles_handler import profile_handler
from archinstall.lib.translationhandler import tr
def ask_user_questions(mirror_list_handler: MirrorListHandler) -> None:
"""
First, we'll ask the user for a bunch of user input.
Not until we're satisfied with what we want to install
will we continue with the actual installation steps.
"""
def show_menu(mirror_list_handler: MirrorListHandler) -> None:
upgrade = check_version_upgrade()
title_text = 'Archlinux'
@ -176,7 +170,7 @@ def perform_installation(
if not arch_config_handler.args.silent:
elapsed_time = time.time() - start_time
action = ask_post_installation(elapsed_time)
action = select_post_installation(elapsed_time)
match action:
case PostInstallationAction.EXIT:
@ -197,7 +191,7 @@ def main() -> None:
)
if not arch_config_handler.args.silent:
ask_user_questions(mirror_list_handler)
show_menu(mirror_list_handler)
config = ConfigurationOutput(arch_config_handler.config)
config.write_debug()

View File

@ -9,7 +9,7 @@ from archinstall.lib.installer import Installer
from archinstall.lib.output import debug, error
def ask_user_questions() -> None:
def show_menu() -> None:
global_menu = GlobalMenu(arch_config_handler.config)
global_menu.disable_all()
@ -56,7 +56,7 @@ def perform_installation(mountpoint: Path) -> None:
def main() -> None:
if not arch_config_handler.args.silent:
ask_user_questions()
show_menu()
config = ConfigurationOutput(arch_config_handler.config)
config.write_debug()