core.utils.verse_version_helper

File:

EuljiroBible/core/utils/verse_version_helper.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.

Performs logic for managing selected Bible versions and computing shared books.

class core.utils.verse_version_helper.VerseVersionHelper(bible_data, version_layout)[source]

Bases: object

Handles logic related to selected Bible versions and finding common books.

This helper reads the version-selection state from a layout containing version checkboxes, computes the intersection of available books across selected versions, and provides stable sorting for version display.

bible_data

Shared Bible data loader used to resolve version/book metadata and access per-version verse structures.

Type:

BibleDataLoader

version_layout

Layout containing version QCheckBox widgets. Each checkbox is expected to expose a version_key attribute holding the full internal version identifier (not the alias label shown to users).

Type:

QLayout

__init__(bible_data, version_layout)[source]

Initialize the helper with data source and layout.

Parameters:
  • bible_data (BibleDataLoader) – Instance of BibleDataLoader.

  • version_layout (QLayout) – Layout containing QCheckBox widgets.

get_selected_versions()[source]

Return a list of selected Bible versions based on checked checkboxes.

Returns:

List of selected version keys.

Return type:

List[str]

get_common_books()[source]

Find books common to all selected Bible versions.

Returns:

List of book names common to all selected versions.

Return type:

List[str]

validate_selection(initializing=False)[source]

Validate selected versions and compute common books.

Parameters:

initializing (bool) – If True, skip validation logic and return the raw selection.

Returns:

(validated_versions, common_books).

Return type:

Tuple[List[str], List[str]]

sort_versions(version_list)[source]

Sort a list of version keys using the configured sort order and prefix rules.

Parameters:

version_list (List[str]) – List of version keys to sort.

Returns:

Sorted list of version keys.

Return type:

List[str]