Skip to content

Commit bae0e29

Browse files
authored
Fix #3330 (#3360)
* Fix #3330 * Update
1 parent a3fc658 commit bae0e29

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

archinstall/lib/global_menu.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from .interactions.network_menu import ask_to_configure_network
2424
from .interactions.system_conf import ask_for_bootloader, ask_for_swap, ask_for_uki, select_kernel
2525
from .locale.locale_menu import LocaleMenu
26-
from .menu.abstract_menu import AbstractMenu
26+
from .menu.abstract_menu import CONFIG_KEY, AbstractMenu
2727
from .mirrors import MirrorMenu
2828
from .models.audio_configuration import AudioConfiguration
2929
from .models.bootloader import Bootloader
@@ -194,17 +194,17 @@ def _get_menu_options(self) -> list[MenuItem]:
194194
MenuItem(
195195
text=str(_('Save configuration')),
196196
action=lambda x: self._safe_config(),
197-
key='__config__'
197+
key=f'{CONFIG_KEY}_save'
198198
),
199199
MenuItem(
200200
text=str(_('Install')),
201201
preview_action=self._prev_install_invalid_config,
202-
key='__config__'
202+
key=f'{CONFIG_KEY}_install'
203203
),
204204
MenuItem(
205205
text=str(_('Abort')),
206206
action=lambda x: exit(1),
207-
key='__config__'
207+
key=f'{CONFIG_KEY}_abort'
208208
)
209209
]
210210

@@ -259,11 +259,11 @@ def _select_archinstall_language(self, preset: Language) -> Language:
259259
language = select_archinstall_language(translation_handler.translated_languages, preset)
260260
translation_handler.activate(language)
261261

262-
self._upate_lang_text()
262+
self._update_lang_text()
263263

264264
return language
265265

266-
def _upate_lang_text(self) -> None:
266+
def _update_lang_text(self) -> None:
267267
"""
268268
The options for the global menu are generated with a static text;
269269
each entry of the menu needs to be updated with the new translation

archinstall/lib/menu/abstract_menu.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
5353

5454
def _sync_from_config(self) -> None:
5555
for item in self._menu_item_group.menu_items:
56-
if item.key is not None and item.key != CONFIG_KEY:
56+
if item.key is not None and not item.key.startswith(CONFIG_KEY):
5757
config_value = getattr(self._config, item.key)
5858
if config_value is not None:
5959
item.value = config_value
@@ -64,7 +64,7 @@ def sync_all_to_config(self) -> None:
6464
setattr(self._config, item.key, item.value)
6565

6666
def _sync(self, item: MenuItem) -> None:
67-
if not item.key or item.key == CONFIG_KEY:
67+
if not item.key or item.key.startswith(CONFIG_KEY):
6868
return
6969

7070
config_value = getattr(self._config, item.key)
@@ -77,10 +77,14 @@ def _sync(self, item: MenuItem) -> None:
7777
def set_enabled(self, key: str, enabled: bool) -> None:
7878
# the __config__ is associated with multiple items
7979
found = False
80+
81+
is_config_key = key == CONFIG_KEY
82+
8083
for item in self._menu_item_group.items:
81-
if item.key == key:
82-
item.enabled = enabled
83-
found = True
84+
if item.key:
85+
if item.key == key or (is_config_key and item.key.startswith(CONFIG_KEY)):
86+
item.enabled = enabled
87+
found = True
8488

8589
if not found:
8690
raise ValueError(f'No selector found: {key}')

examples/only_hd_installation.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ def ask_user_questions() -> None:
1616
global_menu = GlobalMenu(arch_config_handler.config)
1717
global_menu.disable_all()
1818

19-
global_menu.set_enabled('archinstall-language', True)
20-
global_menu.set_enabled('_disk_config', True)
21-
global_menu.set_enabled('_disk_encryption', True)
19+
global_menu.set_enabled('archinstall_language', True)
20+
global_menu.set_enabled('disk_config', True)
21+
global_menu.set_enabled('disk_encryption', True)
2222
global_menu.set_enabled('swap', True)
23-
global_menu.set_enabled('save_config', True)
24-
global_menu.set_enabled('install', True)
25-
global_menu.set_enabled('abort', True)
23+
global_menu.set_enabled('__config__', True)
2624

2725
global_menu.run()
2826

0 commit comments

Comments
 (0)