diff --git a/contact/localisations/en.ini b/contact/localisations/en.ini index 4e524e2..01a4e59 100644 --- a/contact/localisations/en.ini +++ b/contact/localisations/en.ini @@ -28,59 +28,7 @@ COLOR_CONFIG_DARK, "Theme colors (dark)", "" COLOR_CONFIG_LIGHT, "Theme colors (light)", "" COLOR_CONFIG_GREEN, "Theme colors (green)", "" -[app_settings.COLOR_CONFIG_DARK] -default, "Default", "" -background, "Background", "" -splash_logo, "Splash logo", "" -splash_text, "Splash text", "" -input, "Input", "" -node_list, "Node list", "" -channel_list, "Channel list", "" -channel_selected, "Channel selected", "" -rx_messages, "Received messages", "" -tx_messages, "Sent messages", "" -timestamps, "Timestamps", "" -commands, "Commands", "" -window_frame, "Window frame", "" -window_frame_selected, "Window frame selected", "" -log_header, "Log header", "" -log, "Log", "" -settings_default, "Settings default", "" -settings_sensitive, "Settings sensitive", "" -settings_save, "Settings save", "" -settings_breadcrumbs, "Settings breadcrumbs", "" -settings_warning, "Settings warning", "" -settings_note, "Settings note", "" -node_favorite, "Node favorite", "" -node_ignored, "Node ignored", "" - -[app_settings.COLOR_CONFIG_LIGHT] -default, "Default", "" -background, "Background", "" -splash_logo, "Splash logo", "" -splash_text, "Splash text", "" -input, "Input", "" -node_list, "Node list", "" -channel_list, "Channel list", "" -channel_selected, "Channel selected", "" -rx_messages, "Received messages", "" -tx_messages, "Sent messages", "" -timestamps, "Timestamps", "" -commands, "Commands", "" -window_frame, "Window frame", "" -window_frame_selected, "Window frame selected", "" -log_header, "Log header", "" -log, "Log", "" -settings_default, "Settings default", "" -settings_sensitive, "Settings sensitive", "" -settings_save, "Settings save", "" -settings_breadcrumbs, "Settings breadcrumbs", "" -settings_warning, "Settings warning", "" -settings_note, "Settings note", "" -node_favorite, "Node favorite", "" -node_ignored, "Node ignored", "" - -[app_settings.COLOR_CONFIG_GREEN] +[app_settings.color_config] default, "Default", "" background, "Background", "" splash_logo, "Splash logo", "" diff --git a/contact/localisations/ru.ini b/contact/localisations/ru.ini index 1314fac..236c72b 100644 --- a/contact/localisations/ru.ini +++ b/contact/localisations/ru.ini @@ -28,59 +28,7 @@ COLOR_CONFIG_DARK, "Цвета темы (темная)", "" COLOR_CONFIG_LIGHT, "Цвета темы (светлая)", "" COLOR_CONFIG_GREEN, "Цвета темы (зеленая)", "" -[app_settings.COLOR_CONFIG_DARK] -default, "По умолчанию", "" -background, "Фон", "" -splash_logo, "Логотип заставки", "" -splash_text, "Текст заставки", "" -input, "Ввод", "" -node_list, "Список нод", "" -channel_list, "Список каналов", "" -channel_selected, "Выбранный канал", "" -rx_messages, "Входящие сообщения", "" -tx_messages, "Отправленные сообщения", "" -timestamps, "Временные метки", "" -commands, "Команды", "" -window_frame, "Рамка окна", "" -window_frame_selected, "Выбранная рамка окна", "" -log_header, "Заголовок лога", "" -log, "Лог", "" -settings_default, "Настройки по умолчанию", "" -settings_sensitive, "Чувствительные настройки", "" -settings_save, "Сохранение настроек", "" -settings_breadcrumbs, "Хлебные крошки", "" -settings_warning, "Предупреждения настроек", "" -settings_note, "Примечания настроек", "" -node_favorite, "Избранная нода", "" -node_ignored, "Игнорируемая нода", "" - -[app_settings.COLOR_CONFIG_LIGHT] -default, "По умолчанию", "" -background, "Фон", "" -splash_logo, "Логотип заставки", "" -splash_text, "Текст заставки", "" -input, "Ввод", "" -node_list, "Список нод", "" -channel_list, "Список каналов", "" -channel_selected, "Выбранный канал", "" -rx_messages, "Входящие сообщения", "" -tx_messages, "Отправленные сообщения", "" -timestamps, "Временные метки", "" -commands, "Команды", "" -window_frame, "Рамка окна", "" -window_frame_selected, "Выбранная рамка окна", "" -log_header, "Заголовок лога", "" -log, "Лог", "" -settings_default, "Настройки по умолчанию", "" -settings_sensitive, "Чувствительные настройки", "" -settings_save, "Сохранение настроек", "" -settings_breadcrumbs, "Хлебные крошки", "" -settings_warning, "Предупреждения настроек", "" -settings_note, "Примечания настроек", "" -node_favorite, "Избранная нода", "" -node_ignored, "Игнорируемая нода", "" - -[app_settings.COLOR_CONFIG_GREEN] +[app_settings.color_config] default, "По умолчанию", "" background, "Фон", "" splash_logo, "Логотип заставки", "" diff --git a/contact/ui/user_config.py b/contact/ui/user_config.py index ebd9d93..3e19d73 100644 --- a/contact/ui/user_config.py +++ b/contact/ui/user_config.py @@ -47,7 +47,21 @@ def get_app_settings_path_parts(menu_path: List[str]) -> List[str]: def lookup_app_settings_label(full_key: str, fallback: str) -> str: - return field_mapping.get(full_key, fallback) + label = field_mapping.get(full_key) + if label: + return label + parts = full_key.split(".") + if len(parts) >= 2 and parts[1].startswith("COLOR_CONFIG_"): + unified_key = ".".join([parts[0], "color_config"] + parts[2:]) + return field_mapping.get(unified_key, fallback) + return fallback + + +def get_app_settings_help_path_parts(menu_path: List[str]) -> List[str]: + parts = get_app_settings_path_parts(menu_path) + if parts and parts[-1] in ("COLOR_CONFIG_DARK", "COLOR_CONFIG_LIGHT", "COLOR_CONFIG_GREEN"): + parts[-1] = "color_config" + return parts # Compute an effective width that fits the current terminal @@ -275,8 +289,10 @@ def display_menu() -> tuple[Any, Any, List[str]]: global max_help_lines remaining_space = curses.LINES - (start_y + menu_height + 2) max_help_lines = max(remaining_space, 1) - transformed_path = get_app_settings_path_parts(menu_state.menu_path) - selected_option = options[menu_state.selected_index] if options else None + transformed_path = get_app_settings_help_path_parts(menu_state.menu_path) + selected_option = ( + options[min(menu_state.selected_index, len(options) - 1)] if options and menu_state.selected_index >= 0 else None + ) help_y = menu_win.getbegyx()[0] + menu_win.getmaxyx()[0] menu_state.help_win = update_help_window( menu_state.help_win, @@ -293,7 +309,7 @@ def display_menu() -> tuple[Any, Any, List[str]]: def update_app_settings_help(menu_win: curses.window, options: List[str]) -> None: - transformed_path = get_app_settings_path_parts(menu_state.menu_path) + transformed_path = get_app_settings_help_path_parts(menu_state.menu_path) selected_option = options[menu_state.selected_index] if menu_state.selected_index < len(options) else None help_y = menu_win.getbegyx()[0] + menu_win.getmaxyx()[0] menu_state.help_win = update_help_window(