gui.ui.tab_keyword_logic

File:

EuljiroBible/gui/ui/tab_keyword_logic.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.

Handles the keyword search, result display, and verse saving logic for the gui.ui.tab_keyword.TabKeyword UI.

class gui.ui.tab_keyword_logic.TabKeywordLogic(settings, tr_func)[source]

Bases: object

Backend logic for keyword-based Bible search and verse export.

This class implements the non-UI logic used by the TabKeyword GUI tab, including executing keyword searches, formatting results for display, and exporting a selected verse to the configured overlay output file.

settings

Application-level settings dictionary used for output paths and persistence behavior.

Type:

dict

tr

Translation function used to render localized UI strings and message box text.

Type:

Callable[[str], str]

__init__(settings, tr_func)[source]

Initialize the logic handler with settings and a translation function.

Parameters:
  • settings (dict) – Global application settings.

  • tr_func (Callable[[str], str]) – Translation function for localized strings.

Run a keyword search and update the UI with results and summary.

This reads the selected Bible version and keyword input from the parent UI, executes the search via BibleKeywordSearcher, and then updates the table and summary views through the parent’s update methods. User-facing warnings are shown when input is missing or no results are found.

Parameters:

parent (QWidget) – The TabKeyword UI instance providing the search inputs and output widgets.

save_selected_verse(parent)[source]

Save the currently selected verse from the result table to the overlay output.

This extracts the selected reference from the result table, resolves/normalizes the book name, retrieves the verse text from the selected version, formats the output text, and writes it using the project’s output-saving helper.

Parameters:

parent (QWidget) – The TabKeyword UI instance providing table selection, Bible data access, language context, and settings.

Raises:
  • Exception – Any error raised by the output writer is caught and presented

  • to the user via a critical dialog.

clear_outputs(parent)[source]

Clear the verse output destination.

This writes an empty string to the configured output path(s), effectively clearing any overlay text that is being polled or displayed.

Parameters:

parent (QWidget) – The TabKeyword UI instance providing settings.

update_table(parent, results)[source]

Update the result table model and install keyword highlighting.

This constructs a KeywordResultTableModel from the search results, attaches it to the UI table, and applies a KeywordHighlightDelegate for visual emphasis of matched terms.

Parameters:
  • parent (QWidget) – The TabKeyword UI instance containing the table widget.

  • results (List[dict]) – List of verse entry dictionaries returned by the searcher.

update_summary(parent, counts)[source]

Update the summary box with per-keyword occurrence counts.

Parameters:
  • parent (QWidget) – The TabKeyword UI instance containing the summary widget.

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