Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction/locale_conf.py
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-05-09 20:02:48 +1000
committerGitHub <noreply@github.com>2022-05-09 12:02:48 +0200
commit0fa52a5424e28ed62ef84bdc92868bbfc434e015 (patch)
tree4b88e7799319aa9489f7e16beedf5517b6feba34 /archinstall/lib/user_interaction/locale_conf.py
parent20ffebac50478554a7582de5e5c1d8b4504ea8be (diff)
Introduce ctrl+c and other bug fixes (#1152)
* Intergrate ctrl+c * stash * Update * Fix profile reset * flake8 Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/user_interaction/locale_conf.py')
-rw-r--r--archinstall/lib/user_interaction/locale_conf.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/archinstall/lib/user_interaction/locale_conf.py b/archinstall/lib/user_interaction/locale_conf.py
index d48018cf..15720064 100644
--- a/archinstall/lib/user_interaction/locale_conf.py
+++ b/archinstall/lib/user_interaction/locale_conf.py
@@ -4,32 +4,39 @@ from typing import Any, TYPE_CHECKING
from ..locale_helpers import list_locales
from ..menu import Menu
+from ..menu.menu import MenuSelectionType
if TYPE_CHECKING:
_: Any
-def select_locale_lang(default: str, preset: str = None) -> str:
+def select_locale_lang(preset: str = None) -> str:
locales = list_locales()
locale_lang = set([locale.split()[0] for locale in locales])
- selected_locale = Menu(_('Choose which locale language to use'),
- locale_lang,
- sort=True,
- preset_values=preset,
- default_option=default).run()
+ selected_locale = Menu(
+ _('Choose which locale language to use'),
+ list(locale_lang),
+ sort=True,
+ preset_values=preset
+ ).run()
- return selected_locale
+ match selected_locale.type_:
+ case MenuSelectionType.Selection: return selected_locale.value
+ case MenuSelectionType.Esc: return preset
-def select_locale_enc(default: str, preset: str = None) -> str:
+def select_locale_enc(preset: str = None) -> str:
locales = list_locales()
locale_enc = set([locale.split()[1] for locale in locales])
- selected_locale = Menu(_('Choose which locale encoding to use'),
- locale_enc,
- sort=True,
- preset_values=preset,
- default_option=default).run()
+ selected_locale = Menu(
+ _('Choose which locale encoding to use'),
+ list(locale_enc),
+ sort=True,
+ preset_values=preset
+ ).run()
- return selected_locale
+ match selected_locale.type_:
+ case MenuSelectionType.Selection: return selected_locale.value
+ case MenuSelectionType.Esc: return preset