core.generator.ui.contents.respo_content

File:

EuljiroWorship/core/generator/ui/contents/respo_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 “respo” (responsive reading) style slides.

This module defines core.generator.ui.contents.respo_content.RespoContent, a QWidget that provides a table-based editor for responsive readings (교독문). Each slide consists of a title and a sequence of speaker-response pairs, which are rendered as formatted HTML for slide output.

The widget supports loading and saving responsive readings from JSON files stored under data/respo/, and integrates with core.generator.utils.slide_input_submitter.SlideInputSubmitter for automatic synchronization with the slide generator.

class core.generator.ui.contents.respo_content.RespoContent(*args, **kwargs)[source]

Bases: QWidget

Content editor widget for “respo” (responsive reading) slides.

This widget provides a small editor UI for creating and maintaining responsive reading (교독문) content backed by local JSON files under data/respo/.

Users can:

  • Select a responsive reading by number and load its JSON data

  • Edit the reading title (exported as slide caption)

  • Edit speaker/response pairs in a 2-column table

  • Save the edited content back to the JSON database

  • Export the current state as a slide dictionary where table rows are converted into an HTML-like formatted string (exported as slide headline)

The widget itself is responsible for editing and formatting the content. Actual slide splitting / rendering is handled downstream by the generator and overlay/controller pipelines.

Integration with core.generator.utils.slide_input_submitter.SlideInputSubmitter enables automatic submission/synchronization with the generator window.

Parameters:
  • caption (str)

  • headline (str)

caption

Initial caption provided at construction time. Often contains a numbered title such as "12. ..." which may trigger auto-loading.

Type:

str

headline

Initial headline provided at construction time. This is not directly edited; exported headline is rebuilt from the table via format_responsive_text().

Type:

str

respo_data

In-memory JSON payload for the currently loaded responsive reading. Typically contains title and slides.

Type:

dict

generator_window

Reference to the generator main window that receives slide updates and manages auto-save/session state.

number_input

Input field for the responsive reading number.

Type:

QLineEdit

load_button

Button that triggers load_respo_by_number().

Type:

QPushButton

capt_edit

Title input field (exported as slide caption).

Type:

QLineEdit

table

Two-column table editor for speaker/response rows. Column 0 = speaker, column 1 = body text.

Type:

QTableWidget

save_button

Button that triggers save_respo_json().

Type:

QPushButton

submitter

Auto-submit helper that observes the title/table widgets and supplies updated slide data via build_respo_slide().

Type:

SlideInputSubmitter

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

Initialize the responsive reading editor.

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

  • generator_window – Reference to the generator main window, used for submission and auto-save behavior.

  • caption (str) – Initial slide caption, typically a numbered title.

  • headline (str) – Initial slide body content (unused for direct editing; rebuilt from table data).

Returns:

None

build_ui()[source]

Construct the UI layout for responsive reading editing.

The layout includes:

  • A number input field with load button

  • A title input field

  • A two-column table for speaker and response text

  • A save button for writing data back to JSON

This method also initializes auto-loading when a numbered caption is detected.

load_respo_by_number()[source]

Load responsive reading data from a JSON file.

The JSON file is selected based on the number entered by the user and must exist under the data/respo/ directory. The loaded data populates the title field and the speaker-response table.

Displays a warning dialog if the input is invalid or out of range.

build_respo_slide()[source]

Conditionally generate responsive reading slide data.

If both the title and formatted body are empty, no slide data is produced. Otherwise, the current table contents are formatted and returned as slide data.

Returns:

Slide data dictionary if valid; otherwise, None.

Return type:

dict | None

get_respo_number_range()[source]

Determine the valid range of responsive reading numbers.

Scans the data/respo/ directory for available JSON files and extracts their numeric identifiers.

Returns:

Minimum and maximum available responsive reading numbers.

Return type:

tuple[int, int]

get_slide_data()[source]

Generate the slide data dictionary for export.

Returns:

Dictionary containing:

  • style: “respo”

  • caption: title of the responsive reading

  • headline: formatted HTML body

Return type:

dict

format_responsive_text()[source]

Convert table contents into formatted HTML text.

Each row in the table is rendered as a bold speaker label followed by the corresponding response text.

Returns:

HTML-formatted responsive reading content.

Return type:

str

save_respo_json()[source]

Save the current responsive reading data to a JSON file.

The data is written back to the file corresponding to the selected responsive reading number under data/respo/. A warning is shown if no valid number is provided.