core.generator.ui.contents.verse_content

File:

EuljiroWorship/core/generator/ui/contents/verse_content.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.

UI content widget for editing “verse”-style slides.

This module defines core.generator.ui.contents.verse_content.VerseContent, a QWidget that provides an interface for entering Bible references, fetching the corresponding verses from the internal Bible data engine, and previewing the formatted output.

The widget supports:

  • Selecting a Bible version

  • Parsing and validating Scripture references

  • Expanding verse ranges and full chapters

  • Writing fetched verses to core.config.paths.VERSE_FILE for emergency overlay use

class core.generator.ui.contents.verse_content.VerseContent(*args, **kwargs)[source]

Bases: QWidget

Content editor widget for “verse” (Bible verse) slides.

This widget provides a verse-focused editor workflow:

  • Select a Bible version (JSON file under core.config.paths.BIBLE_DATA_DIR)

  • Enter a Bible reference string (e.g., “요한복음 3:16”)

  • Press Enter to parse the reference, fetch verses, and preview the result

  • Export the fetched/assembled text into the slide system and also write the same formatted output to core.config.paths.VERSE_FILE for emergency subtitle overlays.

Verse resolution is performed by core.utils.bible_parser.parse_reference() and verse retrieval uses core.utils.bible_data_loader.BibleDataLoader. When the parsed reference indicates a full chapter request ((1, -1)), the widget expands the verse range using the chapter’s maximum verse count when available.

Note

  • The preview text shown in the editor is a joined block of "{caption}\n{headline}" entries separated by blank lines.

  • The exported slide data returned by get_slide_data() uses the raw user-entered reference as caption and the preview text block as headline (the detailed per-verse slide dicts are kept separately in generated_slides when generated).

Parameters:
  • caption (str)

  • headline (str)

caption

Initial reference string provided at construction time.

Type:

str

headline

Initial preview/body text provided at construction time.

Type:

str

generator_window

Reference to the generator main window for submission and synchronization (auto-save/session updates via the submitter).

VERSION_ALIASES

Mapping of Bible version display names to shorter aliases, loaded from core.config.paths.ALIASES_VERSION_FILE. Used when composing per-verse caption strings (e.g., "(개역개정)").

Type:

dict

versions

Available version keys discovered from JSON files in core.config.paths.BIBLE_DATA_DIR.

Type:

list[str]

version_dropdown

Version selector widget; current selection determines which JSON is loaded when fetching verses.

Type:

QComboBox

caption_edit

Reference input widget. returnPressed triggers try_fetch_verse_output().

Type:

QLineEdit

headline_edit

Multi-line preview area that displays the formatted verse output.

Type:

QTextEdit

submitter

Auto-submit helper that observes the verse preview widget and provides export-ready slide data via build_verse_slide(). The reference input is ignored for auto-submit in this widget.

Type:

SlideInputSubmitter

generated_slides

List of per-verse slide dictionaries produced by the last successful fetch. Each entry follows the standard slide schema (style, caption, headline). Present only after a successful fetch.

Type:

list[dict]

__init__(parent, generator_window, caption='', headline='')[source]

Initialize the verse slide editor.

Parameters:
  • parent (QWidget) – Parent widget container.

  • generator_window – Reference to the generator main window, used for submission and synchronization.

  • caption (str) – Initial Bible reference string.

  • headline (str) – Initial verse text content.

Returns:

None

build_ui()[source]

Construct the UI layout for verse editing.

The layout includes:

  • A Bible version selector

  • A reference input field

  • A multi-line text preview for verse content

The reference input is connected to dynamic verse fetching when the user presses Enter.

try_fetch_verse_output()[source]

Fetch and display Bible verses based on the entered reference.

This method:

  • Parses the reference string

  • Loads the selected Bible version

  • Expands verse ranges or full chapters if needed

  • Formats and displays the verse text

  • Writes the output to core.config.paths.VERSE_FILE

Displays an error message in the preview area if parsing or loading fails.

build_verse_slide()[source]

Conditionally build verse slide data.

Returns slide data only if either the reference or verse text is non-empty.

Returns:

Slide data dictionary if valid; otherwise, None.

Return type:

dict | None

get_slide_data()[source]

Return the current verse slide data.

Returns:

Dictionary containing:

  • style: “verse”

  • caption: Bible reference string

  • headline: Verse text content

Return type:

dict