Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyboard layout and timezone menus #2153

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions archinstall/lib/interactions/general_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def ask_for_a_timezone(preset: Optional[str] = None) -> Optional[str]:

choice = Menu(
_('Select a timezone'),
list(timezones),
timezones,
preset_values=preset,
default_option=default
).run()
Expand Down Expand Up @@ -95,7 +95,7 @@ def select_language(preset: Optional[str] = None) -> Optional[str]:
"""
kb_lang = list_keyboard_languages()
# sort alphabetically and then by length
sorted_kb_lang = sorted(sorted(list(kb_lang)), key=len)
sorted_kb_lang = sorted(kb_lang, key=lambda x: (len(x), x))

choice = Menu(
_('Select keyboard layout'),
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/locale/locale_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def select_kb_layout(preset: Optional[str] = None) -> Optional[str]:
"""
kb_lang = list_keyboard_languages()
# sort alphabetically and then by length
sorted_kb_lang = sorted(sorted(list(kb_lang)), key=len)
sorted_kb_lang = sorted(kb_lang, key=lambda x: (len(x), x))

choice = Menu(
_('Select keyboard layout'),
Expand Down
23 changes: 10 additions & 13 deletions archinstall/lib/locale/utils.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
from typing import Iterator, List
from typing import List

from ..exceptions import ServiceException, SysCallError
from ..general import SysCommand
from ..output import error


def list_keyboard_languages() -> Iterator[str]:
for line in SysCommand(
def list_keyboard_languages() -> List[str]:
return SysCommand(
"localectl --no-pager list-keymaps",
environment_vars={'SYSTEMD_COLORS': '0'}
).decode():
yield line
).decode().splitlines()


def list_locales() -> List[str]:
Expand All @@ -24,12 +23,11 @@ def list_locales() -> List[str]:
return locales


def list_x11_keyboard_languages() -> Iterator[str]:
for line in SysCommand(
def list_x11_keyboard_languages() -> List[str]:
return SysCommand(
"localectl --no-pager list-x11-keymap-layouts",
environment_vars={'SYSTEMD_COLORS': '0'}
).decode():
yield line
).decode().splitlines()


def verify_keyboard_layout(layout :str) -> bool:
Expand Down Expand Up @@ -62,9 +60,8 @@ def set_kb_layout(locale :str) -> bool:
return False


def list_timezones() -> Iterator[str]:
for line in SysCommand(
def list_timezones() -> List[str]:
return SysCommand(
"timedatectl --no-pager list-timezones",
environment_vars={'SYSTEMD_COLORS': '0'}
).decode():
yield line
).decode().splitlines()