core.generator.ui.settings_dialog

File:

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

Settings dialog for the slide generator and controller.

This module defines core.generator.ui.settings_dialog.SettingsDialog, a modal dialog that allows users to configure persistent UI-related settings shared by the slide generator (and controller), including:

  • Font family

  • Font size

  • Font weight

  • Output path for the emergency subtitle file (e.g., verse_output.txt)

Settings are stored in a JSON file at a well-defined location and are loaded automatically when the dialog is opened.

class core.generator.ui.settings_dialog.SettingsDialog(*args, **kwargs)[source]

Bases: QDialog

Dialog for configuring generator and controller settings.

This dialog provides controls for selecting font preferences used throughout the generator/controller UI and for specifying the file path of the emergency subtitle output file.

The dialog follows a simple lifecycle:

  • Load persisted settings on construction.

  • Allow the user to modify values via UI controls.

  • Persist updated settings when accepted.

font_combo

Font family selector.

Type:

QFontComboBox

size_spin

Font size selector.

Type:

QSpinBox

weight_combo

Font weight selector.

Type:

QComboBox

path_line

Text field for the emergency subtitle file path.

Type:

QLineEdit

__init__(parent=None)[source]

Initialize the settings dialog.

This constructor builds the full UI layout, initializes all input widgets, and loads previously saved settings from the persistent settings file into the UI.

Parameters:

parent (QWidget | None) – Optional parent widget for modal ownership.

Returns:

None

browse_path()[source]

Open a file dialog to select the emergency subtitle output file.

This method shows a file-open dialog filtered to text files and, if the user selects a file, updates the corresponding path input field.

Parameters:

None

Returns:

None

load_settings()[source]

Load persisted settings from the JSON settings file into the UI.

If the settings file exists, this method reads the JSON content and updates the font selectors and emergency subtitle path field. If the file does not exist, default values remain in effect.

Parameters:

None

Returns:

None

Raises:
  • json.JSONDecodeError – If the settings file exists but contains invalid JSON.

  • OSError – If the settings file cannot be read.

save_settings()[source]

Persist the current settings to the JSON settings file.

This method collects values from the UI controls, writes them to the settings file in UTF-8 encoded JSON format, and returns the saved settings dictionary.

Parameters:

None

Returns:

Dictionary containing the persisted settings, including font preferences and the emergency subtitle file path.

Return type:

dict

Raises:

OSError – If the settings file cannot be written.