From 3b8a695778295fbe9bc469435349c631145103dd Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Fri, 30 Jan 2026 19:17:51 +1100 Subject: [PATCH] Rename ask* functions to select* --- .../default_profiles/desktops/hyprland.py | 4 ++-- .../default_profiles/desktops/labwc.py | 4 ++-- archinstall/default_profiles/desktops/niri.py | 4 ++-- archinstall/default_profiles/desktops/sway.py | 4 ++-- .../lib/authentication/authentication_menu.py | 4 ++-- archinstall/lib/bootloader/bootloader_menu.py | 4 ++-- archinstall/lib/disk/filesystem.py | 4 ++-- archinstall/lib/global_menu.py | 24 +++++++++---------- archinstall/lib/interactions/__init__.py | 16 ++++++------- archinstall/lib/interactions/general_conf.py | 10 ++++---- archinstall/lib/interactions/system_conf.py | 4 ++-- archinstall/lib/network/network_menu.py | 2 +- archinstall/lib/packages/packages.py | 2 +- archinstall/lib/user/user_menu.py | 2 +- archinstall/scripts/guided.py | 14 ++++------- archinstall/scripts/only_hd.py | 4 ++-- 16 files changed, 50 insertions(+), 56 deletions(-) diff --git a/archinstall/default_profiles/desktops/hyprland.py b/archinstall/default_profiles/desktops/hyprland.py index 91d91ce40f..a4c0ae593a 100644 --- a/archinstall/default_profiles/desktops/hyprland.py +++ b/archinstall/default_profiles/desktops/hyprland.py @@ -45,7 +45,7 @@ def services(self) -> list[str]: 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 @@ def _ask_seat_access(self) -> None: @override def do_on_select(self) -> None: - self._ask_seat_access() + self._select_seat_access() diff --git a/archinstall/default_profiles/desktops/labwc.py b/archinstall/default_profiles/desktops/labwc.py index 3eadb0f94b..fd9558fcb6 100644 --- a/archinstall/default_profiles/desktops/labwc.py +++ b/archinstall/default_profiles/desktops/labwc.py @@ -42,7 +42,7 @@ def services(self) -> list[str]: 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 @@ def _ask_seat_access(self) -> None: @override def do_on_select(self) -> None: - self._ask_seat_access() + self._select_seat_access() diff --git a/archinstall/default_profiles/desktops/niri.py b/archinstall/default_profiles/desktops/niri.py index 5a41745349..4416b8c85d 100644 --- a/archinstall/default_profiles/desktops/niri.py +++ b/archinstall/default_profiles/desktops/niri.py @@ -50,7 +50,7 @@ def services(self) -> list[str]: 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 @@ def _ask_seat_access(self) -> None: @override def do_on_select(self) -> None: - self._ask_seat_access() + self._select_seat_access() diff --git a/archinstall/default_profiles/desktops/sway.py b/archinstall/default_profiles/desktops/sway.py index 83f17191af..f9c9ecb3d0 100644 --- a/archinstall/default_profiles/desktops/sway.py +++ b/archinstall/default_profiles/desktops/sway.py @@ -52,7 +52,7 @@ def services(self) -> list[str]: 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 @@ def _ask_seat_access(self) -> None: @override def do_on_select(self) -> None: - self._ask_seat_access() + self._select_seat_access() diff --git a/archinstall/lib/authentication/authentication_menu.py b/archinstall/lib/authentication/authentication_menu.py index 2eaec82b03..d4810b3d98 100644 --- a/archinstall/lib/authentication/authentication_menu.py +++ b/archinstall/lib/authentication/authentication_menu.py @@ -7,7 +7,7 @@ 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 @@ def _define_menu_options(self) -> list[MenuItem]: 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: diff --git a/archinstall/lib/bootloader/bootloader_menu.py b/archinstall/lib/bootloader/bootloader_menu.py index 8e518192af..629b84366f 100644 --- a/archinstall/lib/bootloader/bootloader_menu.py +++ b/archinstall/lib/bootloader/bootloader_menu.py @@ -91,7 +91,7 @@ def run(self) -> 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 @@ def _select_removable(self, preset: bool) -> bool: 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 diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py index 66420a5a3c..7a19a1a28d 100644 --- a/archinstall/lib/disk/filesystem.py +++ b/archinstall/lib/disk/filesystem.py @@ -4,7 +4,7 @@ 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 @@ def _final_warning(self) -> bool: print(c, end='', flush=True) time.sleep(0.25) except KeyboardInterrupt: - ask_abort() + confirm_abort() return True diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index aaeaf8d437..732c6e6166 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -5,8 +5,8 @@ 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 .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 @@ def _get_menu_options(self) -> list[MenuItem]: 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 @@ def _get_menu_options(self) -> list[MenuItem]: MenuItem( text=tr('Hostname'), value='archlinux', - action=ask_hostname, + action=select_hostname, preview_action=self._prev_hostname, key='hostname', ), @@ -133,7 +133,7 @@ def _get_menu_options(self) -> list[MenuItem]: ), 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 @@ def _get_menu_options(self) -> list[MenuItem]: ), 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 @@ def _select_additional_packages(self, preset: list[str]) -> list[str]: if config: repositories = set(config.optional_repositories) - packages = ask_additional_packages_to_install( + packages = select_additional_packages( preset, repositories=repositories, ) diff --git a/archinstall/lib/interactions/__init__.py b/archinstall/lib/interactions/__init__.py index bec4350adb..6ff63cb3a5 100644 --- a/archinstall/lib/interactions/__init__.py +++ b/archinstall/lib/interactions/__init__.py @@ -8,26 +8,26 @@ ) 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', ] diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py index 39d83e386d..cfbb100cfc 100644 --- a/archinstall/lib/interactions/general_conf.py +++ b/archinstall/lib/interactions/general_conf.py @@ -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 validator(s: str) -> str | 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( diff --git a/archinstall/lib/interactions/system_conf.py b/archinstall/lib/interactions/system_conf.py index e9b6c42c10..540ed35f52 100644 --- a/archinstall/lib/interactions/system_conf.py +++ b/archinstall/lib/interactions/system_conf.py @@ -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() diff --git a/archinstall/lib/network/network_menu.py b/archinstall/lib/network/network_menu.py index f8fd7c560e..c238c2160c 100644 --- a/archinstall/lib/network/network_menu.py +++ b/archinstall/lib/network/network_menu.py @@ -166,7 +166,7 @@ def _edit_iface(self, edit_nic: Nic) -> 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 """ diff --git a/archinstall/lib/packages/packages.py b/archinstall/lib/packages/packages.py index da9d4740f9..8dcc205751 100644 --- a/archinstall/lib/packages/packages.py +++ b/archinstall/lib/packages/packages.py @@ -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]: diff --git a/archinstall/lib/user/user_menu.py b/archinstall/lib/user/user_menu.py index adf933915e..faf3fbb55c 100644 --- a/archinstall/lib/user/user_menu.py +++ b/archinstall/lib/user/user_menu.py @@ -109,7 +109,7 @@ def _add_user(self) -> User | None: 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: diff --git a/archinstall/scripts/guided.py b/archinstall/scripts/guided.py index 68d5492f4f..d8c2faac5e 100644 --- a/archinstall/scripts/guided.py +++ b/archinstall/scripts/guided.py @@ -12,7 +12,7 @@ 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.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() diff --git a/archinstall/scripts/only_hd.py b/archinstall/scripts/only_hd.py index c368ab93f7..c945e57899 100644 --- a/archinstall/scripts/only_hd.py +++ b/archinstall/scripts/only_hd.py @@ -9,7 +9,7 @@ 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()