core.generator.utils.slide_generator_data_manager
- File:
EuljiroWorship/core/generator/utils/slide_generator_data_manager.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.
Data management layer for the slide generator table UI.
This module defines core.generator.utils.slide_generator_data?manager.SlideGeneratorDataManager, which is responsible for
loading slide data from JSON files into the generator table, collecting
edited table contents back into structured slide dictionaries, and
handling style-specific normalization (e.g., anthem choir names,
Bible verse formatting).
It acts as the sole translation layer between:
Persistent slide JSON files
The QTableWidget-based generator UI
- class core.generator.utils.slide_generator_data_manager.SlideGeneratorDataManager(table_widget)[source]
Bases:
objectManage slide data exchange between JSON files and the generator table UI.
This class acts as a thin data-adapter layer between JSON-based slide definitions and the slide generator’s QTableWidget. It is responsible for loading slide session data from disk into the table, and for collecting and normalizing table contents back into structured slide dictionaries suitable for saving or exporting.
Responsibilities include:
Populating the generator table from a slide JSON file
Extracting slide data from table rows into normalized dictionaries
Applying style alias mappings between display labels and internal keys
Performing style-specific preprocessing and normalization, such as:
Merging and splitting anthem captions and choir names
Reformatting multi-verse Bible slide text for readability
This class deliberately contains no UI control logic beyond direct table population and inspection, and does not handle dialogs, user interaction, or rendering concerns.
- table
Reference to the generator’s slide table widget.
- Type:
QTableWidget
- loader
Bible data loader instance used for verse-related preprocessing.
- Type:
- __init__(table_widget)[source]
Initialize the data manager with a reference to the generator table.
- Parameters:
table_widget (QTableWidget) – Table widget that stores slide rows in the generator UI.
- load_from_file(path)[source]
Load slide data from a JSON file and populate the generator table.
This method:
Clears the existing table
Inserts rows matching the number of slides
Applies style aliases to the style combo box
Performs style-specific preprocessing:
Merges anthem caption and choir name
Formats multi-verse Bible slides for readability
- Parameters:
path (str) – Path to the slide JSON file.
- Returns:
List of slide dictionaries loaded from the file.
- Return type:
list[dict]
- save_to_file(path)[source]
Save the current table contents to a JSON slide file.
- Parameters:
path (str) – Destination file path.
- Return type:
None
- collect_slide_data()[source]
Collect slide data from the generator table and normalize it.
This method reads each table row and converts it into a slide dictionary using internal style keys. Style-specific handling is applied where necessary (e.g., anthem
caption/choirseparation).- Returns:
List of structured slide dictionaries.
- Return type:
list[dict]
- _insert_empty_row()[source]
Insert a new empty slide row into the generator table.
The row includes:
A style selection combo box
Empty caption and headline cells
- _split_verse_headline(text)[source]
Reformat concatenated Bible verse text into a readable multi-line form.
If multiple verse references are detected, this method splits the text so that each reference and its verse body are separated by blank lines. Single-verse text is returned unchanged.
- Parameters:
text (str) – Raw verse headline string.
- Returns:
Reformatted verse text suitable for display in the table.
- Return type:
str