Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2022-03-28 13:55:15 +0200
committerGitHub <noreply@github.com>2022-03-28 13:55:15 +0200
commit4b4473632df0fbc92e85f6e32f6e940ad4fb6fa7 (patch)
treec7fff6b42db3c2cadb19051b14c566d40c5a93bf /archinstall/lib/menu
parent3dc0d957e838c34b48a0782d2540341e33b24070 (diff)
Subvolume User Interface (#1032)
* Deflate the user interactions file * Fix flake8 * GlobalMenu split from selection_menu.py * Upgrades to ListManager: Can now show an empty list if there is no null action. More information to the user at the header * Put only_hd.py and swiss.py to use new config printing mechanism Solved a couple of bugs at ListManager adding a str and a DeferredTranslation ManageUser was missing an self argument in _check ... * Create list and menus to manage subvolumes in btrfs partitions Needed to modify manage_new_and_existing_partitions Added a new parameter filter to select_partition, to allow filtering there * Update internationalization strings Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/menu')
-rw-r--r--archinstall/lib/menu/__init__.py3
-rw-r--r--archinstall/lib/menu/list_manager.py11
-rw-r--r--archinstall/lib/menu/selection_menu.py38
3 files changed, 17 insertions, 35 deletions
diff --git a/archinstall/lib/menu/__init__.py b/archinstall/lib/menu/__init__.py
index 6e28c8a2..fd83ee01 100644
--- a/archinstall/lib/menu/__init__.py
+++ b/archinstall/lib/menu/__init__.py
@@ -1 +1,2 @@
-from .menu import Menu
+from .menu import Menu as Menu
+from .selection_menu import GlobalMenu as GlobalMenu \ No newline at end of file
diff --git a/archinstall/lib/menu/list_manager.py b/archinstall/lib/menu/list_manager.py
index bacfc60e..4ca33db2 100644
--- a/archinstall/lib/menu/list_manager.py
+++ b/archinstall/lib/menu/list_manager.py
@@ -87,7 +87,6 @@ The contents in the base class of this methods serve for a very basic usage, and
from .text_input import TextInput
from .menu import Menu
-from ..general import RequirementError
from os import system
from copy import copy
from typing import Union
@@ -115,11 +114,11 @@ class ListManager:
type param: string or list
"""
- if not null_action and len(base_list) == 0:
- raise RequirementError('Data list for ListManager can not be empty if there is no null_action')
+ explainer = str(_('\n Choose an object from the list, and select one of the available actions for it to execute'))
+ self.prompt = prompt + explainer if prompt else explainer
+
+ self.null_action = str(null_action) if null_action else None
- self.prompt = prompt if prompt else _('Choose an object from the list')
- self.null_action = str(null_action)
if not default_action:
self.default_action = [self.null_action,]
elif isinstance(default_action,(list,tuple)):
@@ -140,7 +139,7 @@ class ListManager:
# default values for the null case
self.target = None
self.action = self.null_action
- if len(self.data) == 0:
+ if len(self.data) == 0 and self.null_action:
self.exec_action()
def run(self):
diff --git a/archinstall/lib/menu/selection_menu.py b/archinstall/lib/menu/selection_menu.py
index af896d58..a6c408b7 100644
--- a/archinstall/lib/menu/selection_menu.py
+++ b/archinstall/lib/menu/selection_menu.py
@@ -5,36 +5,18 @@ import logging
from typing import Callable, Any, List, Iterator, Tuple, Optional
from .menu import Menu
-from ..general import SysCommand, secret
-from ..hardware import has_uefi
-from ..storage import storage
-from ..output import log
-from ..profiles import is_desktop_profile
-from ..disk import encrypted_partitions
from ..locale_helpers import set_keyboard_language
-from ..user_interaction import get_password, ask_for_a_timezone, save_config
-from ..user_interaction import ask_ntp
-from ..user_interaction import ask_for_swap
-from ..user_interaction import ask_for_bootloader
-from ..user_interaction import ask_hostname
-from ..user_interaction import ask_for_audio_selection
-from ..user_interaction import ask_additional_packages_to_install
-from ..user_interaction import ask_to_configure_network
-from ..user_interaction import ask_for_superuser_account
-from ..user_interaction import ask_for_additional_users
-from ..user_interaction import select_language
-from ..user_interaction import select_mirror_regions
-from ..user_interaction import select_locale_lang
-from ..user_interaction import select_locale_enc
-from ..user_interaction import select_disk_layout
-from ..user_interaction import select_kernel
-from ..user_interaction import select_encrypted_partitions
-from ..user_interaction import select_harddrives
-from ..user_interaction import select_profile
-from ..user_interaction import select_archinstall_language
-from ..user_interaction import select_additional_repositories
+from ..output import log
from ..translation import Translation
+def select_archinstall_language(default='English'):
+ """
+ copied from user_interaction/general_conf.py as a temporary measure
+ """
+ languages = Translation.get_all_names()
+ language = Menu(_('Select Archinstall language'), languages, default_option=default).run()
+ return language
+
class Selector:
def __init__(
self,
@@ -693,4 +675,4 @@ class GlobalMenu(GeneralMenu):
def _users_resynch(self):
self.synch('!superusers')
self.synch('!users')
- return False
+ return False \ No newline at end of file