core.generator.ui.slide_generator_ui_builder

File:

EuljiroWorship/core/generator/ui/slide_generator_ui_builder.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 builder for the Slide Generator main window.

This module defines core.generator.ui.slide_generator_ui_builder.SlideGeneratorUIBuilder, a helper class responsible for constructing and wiring the full Qt UI layout of the slide generator window. It separates UI composition from application logic to keep the main window class (core.generator.ui.slide_generator.SlideGenerator) focused on workflow and state management.

The builder assembles:

  • A top row of action buttons with icons (load, save, add, duplicate, insert, delete, move, export)

  • A tools menu containing church-specific Sunday worship-order actions, afternoon praise-service actions, announcement import actions, and settings

  • A central table area for listing and managing slides

  • A label showing the current worship/session name

  • Keyboard shortcuts (e.g., Ctrl+S) and signal connections

class core.generator.ui.slide_generator_ui_builder.SlideGeneratorUIBuilder(parent, worship_name='')[source]

Bases: object

Build and wire the full UI layout for the slide generator window.

This builder is responsible for composing the visual layout and connecting UI controls to handler methods exposed by the parent generator window. It does not own or manage application state; instead, it assumes that the parent provides the required widgets, managers, and callbacks.

Constructed UI elements include:

  • A horizontal toolbar of action buttons (SVG-icon buttons), including row duplication

  • A label displaying the current worship/session name

  • The central slide table widget

  • 도구 menu actions for church-specific Sunday worship-order actions, afternoon praise-service actions, announcement import actions, and settings

  • Keyboard shortcuts and signal-slot connections

Required parent interface:

The parent object is expected to provide at least:

  • table (QTableWidget):

    Main slide table widget.

  • menuBar() -> QMenuBar:

    Menu bar accessor for adding menus and actions.

  • table_manager (core.generator.ui.slide_table_manager.SlideTableManager):

    Row manipulation logic for the slide table, including insertion, deletion, movement, and duplication.

  • prompt_load_from_file():

    Run the interactive file-open flow and load a slide session.

  • save_as():

    Save the current slide session using a Save As flow.

  • export_slides_for_overlay():

    Export overlay-ready JSON and launch the slide controller if needed.

  • import_worship_order_and_announcements_from_hwpx():

    Import both worship-order information and announcement slides from a single HWPX bulletin file.

  • import_worship_order_from_hwpx():

    Import worship-order information from a HWPX bulletin file.

  • import_praise_service_order_and_announcements_from_hwpx():

    Import both afternoon praise-service order information and announcement slides from a single HWPX bulletin file.

  • import_praise_service_order_from_hwpx():

    Import afternoon praise-service order information from a HWPX bulletin file.

  • import_announcements():

    Import announcement slides from another worship JSON file.

  • import_announcements_from_hwpx():

    Import announcement slides from a HWPX bulletin file.

  • handle_ctrl_s():

    Handle the Ctrl+S shortcut for saving the current session.

  • open_settings_dialog():

    Open the generator settings dialog.

  • handle_table_double_click(row: int, column: int):

    Open the style-specific slide editor dialog.

  • apply_generator_font_settings():

    Apply persisted font preferences to the generator UI.

parent

The slide generator main window that owns the UI and application logic. All widgets are ultimately attached to this object.

Type:

QMainWindow | QWidget

worship_name

Current worship/session name displayed above the slide table.

Type:

str

worship_label

Label widget showing the current worship/session name. This is created during UI setup and updated when a session is loaded or renamed.

Type:

QLabel

__init__(parent, worship_name='')[source]

Initialize the UI builder and immediately construct the UI layout.

This constructor stores references to the parent window and the initial worship/session name, then calls setup_ui() to build and connect all UI components.

Parameters:
  • parent (QMainWindow or QWidget) – The main core.generator.ui.slide_generator.SlideGenerator window that owns the UI and application logic. It must expose the methods and attributes required by this builder.

  • worship_name (str) – Initial worship/session name to display above the slide table.

Returns:

None

setup_ui()[source]

Construct and wire the complete slide generator UI.

This method performs the following:

  • Registers keyboard shortcuts (e.g., Ctrl+S for saving)

  • Creates action buttons with SVG icons and connects them to parent handlers

  • Provides direct row actions such as add, duplicate, insert, delete, and move

  • Assembles the button toolbar, label, and slide table into a vertical layout

  • Adds grouped church-specific Sunday worship-order, afternoon praise-service, announcement import, and settings actions to the Tools menu

  • Applies persisted font settings to the UI

  • Connects table double-click events to the slide editor dialog

  • Installs the composed layout as the parent’s central widget

Parameters:

None

Returns:

None

set_worship_label(name)[source]

Update the worship/session name label shown above the slide table.

This method is typically called after loading a session file or when the session name changes, and simply updates the text of the label if it exists.

Parameters:

name (str) – New name to display (e.g., a worship title derived from the filename).

Returns:

None