Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2022-12-01 20:27:13 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2022-12-01 20:27:13 +0100
commit26f2ccf943675505b003c12dd308dff347303362 (patch)
tree1ee556558efd3565d45c6666faa152c24e3c4d47 /archinstall/lib/user_interaction
parentb855d44b65a63e457e4d9d91fec98c092169b706 (diff)
parent126f56169d6faacd492b0b0f10c18762cf42a2ba (diff)
Merge branch 'upstreamMaster'
Diffstat (limited to 'archinstall/lib/user_interaction')
-rw-r--r--archinstall/lib/user_interaction/__init__.py2
-rw-r--r--archinstall/lib/user_interaction/disk_conf.py10
-rw-r--r--archinstall/lib/user_interaction/general_conf.py61
-rw-r--r--archinstall/lib/user_interaction/locale_conf.py4
-rw-r--r--archinstall/lib/user_interaction/network_conf.py10
-rw-r--r--archinstall/lib/user_interaction/partitioning_conf.py42
-rw-r--r--archinstall/lib/user_interaction/save_conf.py2
-rw-r--r--archinstall/lib/user_interaction/system_conf.py22
8 files changed, 50 insertions, 103 deletions
diff --git a/archinstall/lib/user_interaction/__init__.py b/archinstall/lib/user_interaction/__init__.py
index a1ca2652..2bc46759 100644
--- a/archinstall/lib/user_interaction/__init__.py
+++ b/archinstall/lib/user_interaction/__init__.py
@@ -4,7 +4,7 @@ from .backwards_compatible_conf import generic_select, generic_multi_select
from .locale_conf import select_locale_lang, select_locale_enc
from .system_conf import select_kernel, select_harddrives, select_driver, ask_for_bootloader, ask_for_swap
from .network_conf import ask_to_configure_network
-from .partitioning_conf import select_partition, select_encrypted_partitions
+from .partitioning_conf import select_partition
from .general_conf import (ask_ntp, ask_for_a_timezone, ask_for_audio_selection, select_language, select_mirror_regions,
select_profile, select_archinstall_language, ask_additional_packages_to_install,
select_additional_repositories, ask_hostname, add_number_of_parrallel_downloads)
diff --git a/archinstall/lib/user_interaction/disk_conf.py b/archinstall/lib/user_interaction/disk_conf.py
index b5ed6967..554d13ef 100644
--- a/archinstall/lib/user_interaction/disk_conf.py
+++ b/archinstall/lib/user_interaction/disk_conf.py
@@ -45,13 +45,13 @@ def select_disk_layout(preset: Optional[Dict[str, Any]], block_devices: list, ad
choice = Menu(
_('Select what you wish to do with the selected block devices'),
modes,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return None
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return None
case MenuSelectionType.Selection:
if choice.value == wipe_mode:
return get_default_partition_layout(block_devices, advanced_options)
@@ -77,7 +77,7 @@ def select_disk(dict_o_disks: Dict[str, BlockDevice]) -> Optional[BlockDevice]:
choice = Menu(title, drives).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return None
drive = dict_o_disks[choice.value]
diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py
index 6365014d..76631a98 100644
--- a/archinstall/lib/user_interaction/general_conf.py
+++ b/archinstall/lib/user_interaction/general_conf.py
@@ -4,19 +4,16 @@ import logging
import pathlib
from typing import List, Any, Optional, Dict, TYPE_CHECKING
-from ..menu.menu import MenuSelectionType
-from ..menu.text_input import TextInput
-
from ..locale_helpers import list_keyboard_languages, list_timezones
from ..menu import Menu
-from ..output import log
-from ..profiles import Profile, list_profiles
+from ..menu.menu import MenuSelectionType
+from ..menu.text_input import TextInput
from ..mirrors import list_mirrors
-
-from ..translationhandler import Language, TranslationHandler
+from ..output import log
from ..packages.packages import validate_package_list
-
+from ..profiles import Profile, list_profiles
from ..storage import storage
+from ..translationhandler import Language
if TYPE_CHECKING:
_: Any
@@ -51,7 +48,7 @@ def ask_for_a_timezone(preset: str = None) -> str:
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return choice.value
@@ -63,7 +60,7 @@ def ask_for_audio_selection(desktop: bool = True, preset: str = None) -> str:
choice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return choice.value
@@ -110,12 +107,12 @@ def select_mirror_regions(preset_values: Dict[str, Any] = {}) -> Dict[str, Any]:
list(mirrors.keys()),
preset_values=preselected,
multi=True,
- raise_error_on_interrupt=True
+ allow_reset=True
).run()
match selected_mirror.type_:
- case MenuSelectionType.Ctrl_c: return {}
- case MenuSelectionType.Esc: return preset_values
+ case MenuSelectionType.Reset: return {}
+ case MenuSelectionType.Skip: return preset_values
case _: return {selected: mirrors[selected] for selected in selected_mirror.value}
@@ -125,34 +122,22 @@ def select_archinstall_language(languages: List[Language], preset_value: Languag
# name of the language in its own language
options = {lang.display_name: lang for lang in languages}
- def dependency_preview(current_selection: str) -> Optional[str]:
- current_lang = options[current_selection]
-
- if current_lang.external_dep and not TranslationHandler.is_custom_font_enabled():
- font_file = TranslationHandler.custom_font_path()
- text = str(_('To be able to use this translation, please install a font manually that supports the language.')) + '\n'
- text += str(_('The font should be stored as {}')).format(font_file)
- return text
- return None
+ title = 'NOTE: If a language can not displayed properly, a proper font must be set manually in the console.\n'
+ title += 'All available fonts can be found in "/usr/share/kbd/consolefonts"\n'
+ title += 'e.g. setfont LatGrkCyr-8x16 (to display latin/greek/cyrillic characters)\n'
choice = Menu(
- _('Archinstall language'),
+ title,
list(options.keys()),
default_option=preset_value.display_name,
- preview_command=lambda x: dependency_preview(x),
preview_size=0.5
).run()
match choice.type_:
- case MenuSelectionType.Esc:
+ case MenuSelectionType.Skip:
return preset_value
case MenuSelectionType.Selection:
- language: Language = options[choice.value]
- # we have to make sure that the proper AUR dependency is
- # present to be able to use this language
- if not language.external_dep or TranslationHandler.is_custom_font_enabled():
- return language
- return select_archinstall_language(languages, preset_value)
+ return options[choice.value]
def select_profile(preset) -> Optional[Profile]:
@@ -178,21 +163,21 @@ def select_profile(preset) -> Optional[Profile]:
selection = Menu(
title=title,
p_options=list(options.keys()),
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match selection.type_:
case MenuSelectionType.Selection:
return options[selection.value] if selection.value is not None else None
- case MenuSelectionType.Ctrl_c:
+ case MenuSelectionType.Reset:
storage['profile_minimal'] = False
storage['_selected_servers'] = []
storage['_desktop_profile'] = None
storage['arguments']['desktop-environment'] = None
storage['arguments']['gfx_driver_packages'] = None
return None
- case MenuSelectionType.Esc:
+ case MenuSelectionType.Skip:
return None
@@ -274,10 +259,10 @@ def select_additional_repositories(preset: List[str]) -> List[str]:
sort=False,
multi=True,
preset_values=preset,
- raise_error_on_interrupt=True
+ allow_reset=True
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return []
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return []
case MenuSelectionType.Selection: return choice.value
diff --git a/archinstall/lib/user_interaction/locale_conf.py b/archinstall/lib/user_interaction/locale_conf.py
index 15720064..bbbe070b 100644
--- a/archinstall/lib/user_interaction/locale_conf.py
+++ b/archinstall/lib/user_interaction/locale_conf.py
@@ -23,7 +23,7 @@ def select_locale_lang(preset: str = None) -> str:
match selected_locale.type_:
case MenuSelectionType.Selection: return selected_locale.value
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
def select_locale_enc(preset: str = None) -> str:
@@ -39,4 +39,4 @@ def select_locale_enc(preset: str = None) -> str:
match selected_locale.type_:
case MenuSelectionType.Selection: return selected_locale.value
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
diff --git a/archinstall/lib/user_interaction/network_conf.py b/archinstall/lib/user_interaction/network_conf.py
index 557e8ed8..5e637f23 100644
--- a/archinstall/lib/user_interaction/network_conf.py
+++ b/archinstall/lib/user_interaction/network_conf.py
@@ -71,7 +71,7 @@ class ManualNetworkConfig(ListManager):
available = set(all_ifaces) - set(existing_ifaces)
choice = Menu(str(_('Select interface to add')), list(available), skip=True).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return None
return choice.value
@@ -154,13 +154,13 @@ def ask_to_configure_network(
list(network_options.values()),
cursor_index=cursor_idx,
sort=False,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return None
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return None
if choice.value == network_options['none']:
return None
diff --git a/archinstall/lib/user_interaction/partitioning_conf.py b/archinstall/lib/user_interaction/partitioning_conf.py
index f2e6b881..cff76dc2 100644
--- a/archinstall/lib/user_interaction/partitioning_conf.py
+++ b/archinstall/lib/user_interaction/partitioning_conf.py
@@ -119,7 +119,7 @@ def select_partition(
choice = Menu(title, partition_indexes, multi=multiple).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return None
if isinstance(choice.value, list):
@@ -150,7 +150,6 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
delete_all_partitions = str(_('Clear/Delete all partitions'))
assign_mount_point = str(_('Assign mount-point for a partition'))
mark_formatted = str(_('Mark/Unmark a partition to be formatted (wipes data)'))
- mark_encrypted = str(_('Mark/Unmark a partition as encrypted'))
mark_compressed = str(_('Mark/Unmark a partition as compressed (btrfs only)'))
mark_bootable = str(_('Mark/Unmark a partition as bootable (automatic for /boot)'))
set_filesystem_partition = str(_('Set desired filesystem for a partition'))
@@ -167,7 +166,6 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
delete_all_partitions,
assign_mount_point,
mark_formatted,
- mark_encrypted,
mark_bootable,
mark_compressed,
set_filesystem_partition,
@@ -207,7 +205,7 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
fs_choice = Menu(_('Enter a desired filesystem type for the partition'), fs_types()).run()
- if fs_choice.type_ == MenuSelectionType.Esc:
+ if fs_choice.type_ == MenuSelectionType.Skip:
continue
prompt = str(_('Enter the start sector (percentage or block number, default: {}): ')).format(
@@ -322,15 +320,6 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
# Negate the current wipe marking
block_device_struct["partitions"][partition]['wipe'] = not block_device_struct["partitions"][partition].get('wipe', False)
- elif task == mark_encrypted:
- title = _('{}\n\nSelect which partition to mark as encrypted').format(current_layout)
- partition = select_partition(title, block_device_struct["partitions"])
-
- if partition is not None:
- # Negate the current encryption marking
- block_device_struct["partitions"][partition]['encrypted'] = \
- not block_device_struct["partitions"][partition].get('encrypted', False)
-
elif task == mark_bootable:
title = _('{}\n\nSelect which partition to mark as bootable').format(current_layout)
partition = select_partition(title, block_device_struct["partitions"])
@@ -371,30 +360,3 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
block_device_struct["partitions"][partition]['btrfs']['subvolumes'] = result
return block_device_struct
-
-
-def select_encrypted_partitions(
- title :str,
- partitions :List[Partition],
- multiple :bool = True,
- filter_ :Callable = None
-) -> Optional[int, List[int]]:
- partition_indexes = _get_partitions(partitions, filter_)
-
- if len(partition_indexes) == 0:
- return None
-
- # show current partition layout:
- if len(partitions):
- title += current_partition_layout(partitions, with_idx=True) + '\n'
-
- choice = Menu(title, partition_indexes, multi=multiple).run()
-
- if choice.type_ == MenuSelectionType.Esc:
- return None
-
- if isinstance(choice.value, list):
- for partition_index in choice.value:
- yield int(partition_index)
- else:
- yield (partition_index)
diff --git a/archinstall/lib/user_interaction/save_conf.py b/archinstall/lib/user_interaction/save_conf.py
index f542bc9b..d60ef995 100644
--- a/archinstall/lib/user_interaction/save_conf.py
+++ b/archinstall/lib/user_interaction/save_conf.py
@@ -55,7 +55,7 @@ def save_config(config: Dict):
preview_command=preview
).run()
- if choice.type_ == MenuSelectionType.Esc:
+ if choice.type_ == MenuSelectionType.Skip:
return
while True:
diff --git a/archinstall/lib/user_interaction/system_conf.py b/archinstall/lib/user_interaction/system_conf.py
index 44402a69..8454a3da 100644
--- a/archinstall/lib/user_interaction/system_conf.py
+++ b/archinstall/lib/user_interaction/system_conf.py
@@ -32,13 +32,13 @@ def select_kernel(preset: List[str] = None) -> List[str]:
sort=True,
multi=True,
preset_values=preset,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
- case MenuSelectionType.Ctrl_c: return []
+ case MenuSelectionType.Skip: return preset
+ case MenuSelectionType.Reset: return []
case MenuSelectionType.Selection: return choice.value
@@ -62,13 +62,13 @@ def select_harddrives(preset: List[str] = []) -> List[str]:
list(options.keys()),
preset_values=preset,
multi=True,
- raise_error_on_interrupt=True,
- raise_error_warning_msg=warning
+ allow_reset=True,
+ allow_reset_warning_msg=warning
).run()
match selected_harddrive.type_:
- case MenuSelectionType.Ctrl_c: return []
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Reset: return []
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return [options[i] for i in selected_harddrive.value]
@@ -132,7 +132,7 @@ def ask_for_bootloader(advanced_options: bool = False, preset: str = None) -> st
).run()
match selection.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: bootloader = 'grub-install' if selection.value == Menu.yes() else bootloader
else:
# We use the common names for the bootloader as the selection, and map it back to the expected values.
@@ -141,7 +141,7 @@ def ask_for_bootloader(advanced_options: bool = False, preset: str = None) -> st
value = ''
match selection.type_:
- case MenuSelectionType.Esc: value = preset_val
+ case MenuSelectionType.Skip: value = preset_val
case MenuSelectionType.Selection: value = selection.value
if value != "":
@@ -165,5 +165,5 @@ def ask_for_swap(preset: bool = True) -> bool:
choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes(), preset_values=preset_val).run()
match choice.type_:
- case MenuSelectionType.Esc: return preset
+ case MenuSelectionType.Skip: return preset
case MenuSelectionType.Selection: return False if choice.value == Menu.no() else True