gui.ui.tab_settings_logic

File:

EuljiroBible/gui/ui/tab_settings_logic.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.

Handles backend logic for the settings tab: dynamic UI updates, file paths, colors, and polling behavior.

class gui.ui.tab_settings_logic.TabSettingsLogic(settings, app, tr_func, refresh_settings_callback)[source]

Bases: object

Backend logic handler for the settings tab.

This class encapsulates non-UI operations used by TabSettings, including: font application, overlay configuration persistence, polling interval validation, output path selection, and color picker actions.

settings

Shared application settings dictionary.

Type:

dict

app

Qt application instance used for theme/style updates.

Type:

QApplication

tr

Translation function for localized UI strings.

Type:

Callable[[str], str]

refresh_settings_callback

Optional callback to refresh other UI tabs/components after settings changes.

Type:

Callable[[], None] | None

__init__(settings, app, tr_func, refresh_settings_callback)[source]

Initialize the settings logic handler.

Parameters:
  • settings (dict) – Shared application settings dictionary.

  • app (QApplication) – QApplication instance.

  • tr_func (Callable[[str], str]) – Translation function for localized messages.

  • refresh_settings_callback (Callable[[], None] | None) – Optional callback invoked after applying settings to refresh other UI components.

apply_dynamic_settings(parent)[source]

Apply dynamic font and overlay display settings.

This applies the main application font, collects overlay display settings from the UI widgets, persists them via ConfigManager, and updates the active overlay window if it is currently shown. If a refresh callback is provided, it is called to propagate the updated settings to other tabs.

Parameters:

parent (QWidget) – TabSettings instance providing current UI widget state.

apply_font_to_children(parent, widget, font)[source]

Apply a font to a widget and all of its child widgets.

Parameters:
  • parent (QWidget) – Root window or settings tab context (kept for signature consistency).

  • widget (QWidget) – Target widget to apply the font to.

  • font (QFont) – Font to apply.

select_output_path(parent)[source]

Open a file dialog to select the verse output file path.

If the user selects a path, this updates the UI field and persists the value to settings via ConfigManager.

Parameters:

parent (QWidget) – TabSettings instance containing the path UI field and settings.

select_text_color(parent)[source]

Open a color picker dialog to set the overlay text color.

This updates the color preview, persists the setting, and triggers reapplication of dynamic settings.

Parameters:

parent (QWidget) – TabSettings instance containing the text color UI button.

select_bg_color(parent)[source]

Open a color picker dialog to set the overlay background color.

This updates the color preview, persists the setting, and triggers reapplication of dynamic settings.

Parameters:

parent (QWidget) – TabSettings instance containing the background color UI button.

save_poll_interval(parent)[source]

Validate and save the polling interval from the UI.

If the interval is not a valid integer, this shows a warning dialog and does not persist any changes. On success, the interval is saved to settings via ConfigManager.

Parameters:

parent (QWidget) – TabSettings instance containing the polling interval input widget.

apply_polling_settings(parent)[source]

Apply polling timer behavior based on the current settings.

If polling is enabled, this restarts the polling timer using the configured interval and performs an immediate poll. If polling is disabled, this stops the timer and closes any active overlay window.

Parameters:

parent (QWidget) – TabSettings instance owning the polling timer and overlay window.