gui.utils.keyword_result_model

File:

EuljiroBible/gui/utils/keyword_result_model.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.

Provides a QAbstractTableModel for displaying Bible keyword search results.

class gui.utils.keyword_result_model.KeywordResultTableModel(*args, **kwargs)[source]

Bases: QAbstractTableModel

Table model for displaying Bible keyword search results.

This QAbstractTableModel exposes a fixed 3-column table:
  1. Row index number (1-based)

  2. Localized reference string: “<Book> <chapter>:<verse>”

  3. Verse text

results

List of search result entries. Each entry is expected to contain at least: “book”, “chapter”, “verse”, and “text”.

Type:

List[dict]

bible_data

Data loader used to resolve localized/standard book display names.

Type:

BibleDataLoader

language

Active language code used for localization (e.g., “ko”, “en”).

Type:

str

tr

Translation function for header labels and UI text.

Type:

Callable[[str], str]

__init__(results, bible_data, current_language, tr)[source]

Initialize the model with results and localization helpers.

Parameters:
  • results (List[dict] | None) – Search results to display. If None, an empty list is used.

  • bible_data (BibleDataLoader) – Bible data loader used for book-name localization.

  • current_language (str) – Language code for localized book names (e.g., “ko”, “en”).

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

rowCount(parent=PySide6.QtCore.QModelIndex)[source]

Return the number of rows in the table.

Parameters:

parent (QModelIndex) – Unused Qt parent index.

Returns:

Number of result rows.

Return type:

int

columnCount(parent=PySide6.QtCore.QModelIndex)[source]

Return the number of columns in the table.

The model always returns 3 columns:

0 - Row index number 1 - Reference (localized book + chapter:verse) 2 - Verse text

Parameters:

parent (QModelIndex) – Unused Qt parent index.

Returns:

Always 3.

Return type:

int

data(index, role=PySide6.QtCore.Qt.DisplayRole)[source]

Return cell data for the given index and role.

Only Qt.DisplayRole is handled. Other roles return None.

Parameters:
  • index (QModelIndex) – Model index indicating the target cell.

  • role (int) – Qt item data role.

Returns:

Display string for the cell, or None if not applicable.

Return type:

str | None

headerData(section, orientation, role)[source]

Return header labels for the table.

Only Qt.DisplayRole with Qt.Horizontal orientation is handled.

Parameters:
  • section (int) – Column index.

  • orientation (Qt.Orientation) – Header orientation.

  • role (int) – Qt item data role.

Returns:

Header label for the given column, or None if not applicable.

Return type:

str | None