gui.ui.tab_keyword

File:

EuljiroBible/gui/ui/tab_keyword.py

Author:

Benjamin Jaedon Choi - https://github.com/saintbenjamin

Affiliated Church:

The Eulji-ro Presbyterian Church [대한예수교장로회(통합) 을지로교회]

Address:

The Eulji-ro Presbyterian Church, 24-10, Eulji-ro 20-gil, Jung-gu, Seoul 04549, South Korea

Telephone:

+82-2-2266-3070

E-mail:

euljirochurch [at] G.M.A.I.L. (replace [at] with @ and G.M.A.I.L as you understood.)

License:

MIT License with Attribution Requirement (see LICENSE file for details); Copyright (c) 2025 The Eulji-ro Presbyterian Church.

Implements the gui.ui.tab_keyword.TabKeyword class for EuljiroBible, enabling Bible keyword search, search result rendering, multilingual updates, and verse output handling.

class gui.ui.tab_keyword.TabKeyword(*args, **kwargs)[source]

Bases: QWidget, TabKeywordUI

GUI tab widget for Bible keyword searching.

This tab provides a multilingual keyword search workflow backed by TabKeywordLogic, including result table rendering, summary updates, and exporting the selected verse for overlay usage.

tr

Translation function for UI labels and messages.

Type:

Callable[[str], str]

settings

Application-level settings dictionary.

Type:

dict

current_language

Current UI language code (e.g., “ko”, “en”).

Type:

str

bible_data

Bible data loader instance used by this tab.

Type:

BibleDataLoader

logic

Backend logic handler for search and export actions.

Type:

TabKeywordLogic

Note

The following callables are intentionally not listed under Attributes to avoid duplicate autodoc entries, as they are already documented as class methods:

  • get_polling_status (Callable[[], bool]): Callback returning the current polling state.

  • get_always_show_setting (Callable[[], bool]): Callback returning the current “always show buttons” toggle state.

__init__(version_list, settings, tr, get_polling_status=None, get_always_show_setting=None)[source]

Initialize the TabKeyword UI, logic backend, and Bible data.

Parameters:
  • version_list (List[str]) – Available Bible version list shown in the UI.

  • settings (dict) – Application-level settings.

  • tr (Callable[[str], str]) – Translation function for UI labels.

  • get_polling_status (Callable[[], bool] | None) – Optional callback to retrieve polling state. If not provided, a default stub method is used.

  • get_always_show_setting (Callable[[], bool] | None) – Optional callback to retrieve the “always show buttons” state. If not provided, a default stub method is used.

change_language(lang_code)[source]

Update UI text and placeholder strings according to the selected language.

Parameters:

lang_code (str) – Language code (e.g., “ko”, “en”).

Trigger a keyword search using the logic backend.

save_selected_verse()[source]

Save the currently selected verse to the overlay output file.

This delegates to the logic backend, which writes the selected verse to the configured verse output destination (e.g., verse_output.txt) for overlay usage or exporting.

clear_outputs()[source]

Clear the verse output destination and reset summary/preview fields.

This delegates to the logic backend to clear the output file and reset UI state as needed.

update_table(results)[source]

Update the keyword result table with new entries.

Parameters:

results (List[dict]) – List of result dictionaries produced by the search backend.

update_summary(counts)[source]

Update the summary box with keyword occurrence counts.

Parameters:

counts (Dict[str, int]) – Mapping from keyword to occurrence count.

get_polling_status()[source]

Return the current polling toggle state.

This method is designed to be overridden or replaced by an injected callback.

Returns:

True if polling is active; otherwise False.

Return type:

bool

get_always_show_setting()[source]

Return the current “always show buttons” setting.

This method is designed to be overridden or replaced by an injected callback.

Returns:

True if buttons are always shown; otherwise False.

Return type:

bool