parent
a3fc658c90
commit
bae0e29e18
|
|
@ -23,7 +23,7 @@ from .interactions.manage_users_conf import ask_for_additional_users
|
|||
from .interactions.network_menu import ask_to_configure_network
|
||||
from .interactions.system_conf import ask_for_bootloader, ask_for_swap, ask_for_uki, select_kernel
|
||||
from .locale.locale_menu import LocaleMenu
|
||||
from .menu.abstract_menu import AbstractMenu
|
||||
from .menu.abstract_menu import CONFIG_KEY, AbstractMenu
|
||||
from .mirrors import MirrorMenu
|
||||
from .models.audio_configuration import AudioConfiguration
|
||||
from .models.bootloader import Bootloader
|
||||
|
|
@ -194,17 +194,17 @@ class GlobalMenu(AbstractMenu):
|
|||
MenuItem(
|
||||
text=str(_('Save configuration')),
|
||||
action=lambda x: self._safe_config(),
|
||||
key='__config__'
|
||||
key=f'{CONFIG_KEY}_save'
|
||||
),
|
||||
MenuItem(
|
||||
text=str(_('Install')),
|
||||
preview_action=self._prev_install_invalid_config,
|
||||
key='__config__'
|
||||
key=f'{CONFIG_KEY}_install'
|
||||
),
|
||||
MenuItem(
|
||||
text=str(_('Abort')),
|
||||
action=lambda x: exit(1),
|
||||
key='__config__'
|
||||
key=f'{CONFIG_KEY}_abort'
|
||||
)
|
||||
]
|
||||
|
||||
|
|
@ -259,11 +259,11 @@ class GlobalMenu(AbstractMenu):
|
|||
language = select_archinstall_language(translation_handler.translated_languages, preset)
|
||||
translation_handler.activate(language)
|
||||
|
||||
self._upate_lang_text()
|
||||
self._update_lang_text()
|
||||
|
||||
return language
|
||||
|
||||
def _upate_lang_text(self) -> None:
|
||||
def _update_lang_text(self) -> None:
|
||||
"""
|
||||
The options for the global menu are generated with a static text;
|
||||
each entry of the menu needs to be updated with the new translation
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class AbstractMenu:
|
|||
|
||||
def _sync_from_config(self) -> None:
|
||||
for item in self._menu_item_group.menu_items:
|
||||
if item.key is not None and item.key != CONFIG_KEY:
|
||||
if item.key is not None and not item.key.startswith(CONFIG_KEY):
|
||||
config_value = getattr(self._config, item.key)
|
||||
if config_value is not None:
|
||||
item.value = config_value
|
||||
|
|
@ -64,7 +64,7 @@ class AbstractMenu:
|
|||
setattr(self._config, item.key, item.value)
|
||||
|
||||
def _sync(self, item: MenuItem) -> None:
|
||||
if not item.key or item.key == CONFIG_KEY:
|
||||
if not item.key or item.key.startswith(CONFIG_KEY):
|
||||
return
|
||||
|
||||
config_value = getattr(self._config, item.key)
|
||||
|
|
@ -77,10 +77,14 @@ class AbstractMenu:
|
|||
def set_enabled(self, key: str, enabled: bool) -> None:
|
||||
# the __config__ is associated with multiple items
|
||||
found = False
|
||||
|
||||
is_config_key = key == CONFIG_KEY
|
||||
|
||||
for item in self._menu_item_group.items:
|
||||
if item.key == key:
|
||||
item.enabled = enabled
|
||||
found = True
|
||||
if item.key:
|
||||
if item.key == key or (is_config_key and item.key.startswith(CONFIG_KEY)):
|
||||
item.enabled = enabled
|
||||
found = True
|
||||
|
||||
if not found:
|
||||
raise ValueError(f'No selector found: {key}')
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@ def ask_user_questions() -> None:
|
|||
global_menu = GlobalMenu(arch_config_handler.config)
|
||||
global_menu.disable_all()
|
||||
|
||||
global_menu.set_enabled('archinstall-language', True)
|
||||
global_menu.set_enabled('_disk_config', True)
|
||||
global_menu.set_enabled('_disk_encryption', True)
|
||||
global_menu.set_enabled('archinstall_language', True)
|
||||
global_menu.set_enabled('disk_config', True)
|
||||
global_menu.set_enabled('disk_encryption', True)
|
||||
global_menu.set_enabled('swap', True)
|
||||
global_menu.set_enabled('save_config', True)
|
||||
global_menu.set_enabled('install', True)
|
||||
global_menu.set_enabled('abort', True)
|
||||
global_menu.set_enabled('__config__', True)
|
||||
|
||||
global_menu.run()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue