index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | SecondThundeR <awayfromgalaxy@gmail.com> | 2021-04-22 14:54:35 +0300 |
---|---|---|
committer | SecondThundeR <awayfromgalaxy@gmail.com> | 2021-04-22 14:54:35 +0300 |
commit | d1560d98ec566e2951841f193b79d107cca8daeb (patch) | |
tree | 0da116f72216e64613598a80753fc4bf8b776f78 /archinstall/lib/user_interaction.py | |
parent | 4209074137e5c7ee820fe3811ada3a53afdf7c93 (diff) |
-rw-r--r-- | archinstall/lib/user_interaction.py | 23 |
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index fc62f44c..77b3d771 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -2,7 +2,7 @@ import getpass, pathlib, os, shutil, re import sys, time, signal, ipaddress from .exceptions import * from .profiles import Profile -from .locale_helpers import search_keyboard_layout +from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, search_keyboard_layout from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces @@ -360,10 +360,13 @@ def select_language(options, show_only_country_codes=True): """ Asks the user to select a language from the `options` dictionary parameter. Usually this is combined with :ref:`archinstall.list_keyboard_languages`. - :param options: A `dict` where keys are the language name, value should be a dict containing language information. - :type options: dict + + :param options: A `generator` or `list` where keys are the language name, value should be a dict containing language information. + :type options: generator or list + :param show_only_country_codes: Filters out languages that are not len(lang) == 2. This to limit the number of results from stuff like dvorak and x-latin1 alternatives. :type show_only_country_codes: bool + :return: The language/dictionary key of the selected language :rtype: str """ @@ -387,11 +390,17 @@ def select_language(options, show_only_country_codes=True): return DEFAULT_KEYBOARD_LANGUAGE elif selected_language.lower() in ('?', 'help'): while True: - filter_string = input('Search for layout containing (example: "sv-"): ') + filter_string = input("Search for layout containing (example: \"sv-\") or enter 'exit' to exit from search: ") + + if filter_string.lower() == 'exit': + return select_language(list_keyboard_languages()) + new_options = list(search_keyboard_layout(filter_string)) + if len(new_options) <= 0: - log(f"Search string '{filter_string}' yielded no results, please try another search or Ctrl+D to abort.", fg='yellow') + log(f"Search string '{filter_string}' yielded no results, please try another search.", fg='yellow') continue + return select_language(new_options, show_only_country_codes=False) elif selected_language.isnumeric(): selected_language = int(selected_language) @@ -399,11 +408,13 @@ def select_language(options, show_only_country_codes=True): log(' * Selected option is out of range * ', fg='red') continue return languages[selected_language] - elif search_keyboard_layout(selected_language): + elif verify_keyboard_layout(selected_language): return selected_language else: log(" * Given language wasn't found * ", fg='red') + raise RequirementError("Selecting languages require a least one language to be given as an option.") + def select_mirror_regions(mirrors, show_top_mirrors=True): """ Asks the user to select a mirror or region from the `mirrors` dictionary parameter. |