|
25 | 25 | from .interactions.system_conf import ask_for_swap, select_kernel |
26 | 26 | from .locale.locale_menu import LocaleMenu |
27 | 27 | from .menu.abstract_menu import CONFIG_KEY, AbstractMenu |
28 | | -from .mirrors import MirrorMenu |
| 28 | +from .mirrors import MirrorListHandler, MirrorMenu |
29 | 29 | from .models.bootloader import Bootloader, BootloaderConfiguration |
30 | 30 | from .models.locale import LocaleConfiguration |
31 | 31 | from .models.mirrors import MirrorConfiguration |
|
38 | 38 |
|
39 | 39 |
|
40 | 40 | class GlobalMenu(AbstractMenu[None]): |
41 | | - def __init__(self, arch_config: ArchConfig, title: str | None = None) -> None: |
| 41 | + def __init__( |
| 42 | + self, |
| 43 | + arch_config: ArchConfig, |
| 44 | + mirror_list_handler: MirrorListHandler | None = None, |
| 45 | + title: str | None = None, |
| 46 | + ) -> None: |
42 | 47 | self._arch_config = arch_config |
| 48 | + self._mirror_list_handler = mirror_list_handler |
43 | 49 | menu_options = self._get_menu_options() |
44 | 50 |
|
45 | 51 | self._item_group = MenuItemGroup( |
@@ -550,7 +556,12 @@ def _select_additional_packages(self, preset: list[str]) -> list[str]: |
550 | 556 | return packages |
551 | 557 |
|
552 | 558 | def _mirror_configuration(self, preset: MirrorConfiguration | None = None) -> MirrorConfiguration | None: |
553 | | - mirror_configuration = MirrorMenu(preset=preset).run() |
| 559 | + if self._mirror_list_handler is not None: |
| 560 | + mirror_list_handler = self._mirror_list_handler |
| 561 | + else: |
| 562 | + mirror_list_handler = MirrorListHandler() |
| 563 | + |
| 564 | + mirror_configuration = MirrorMenu(mirror_list_handler, preset=preset).run() |
554 | 565 |
|
555 | 566 | if mirror_configuration and mirror_configuration.optional_repositories: |
556 | 567 | # reset the package list cache in case the repository selection has changed |
|
0 commit comments