gui.ui.window_main

File:

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

Defines the main application window for EuljiroBible, managing tabs, settings, language switching, overlay handling, and polling controls.

class gui.ui.window_main.WindowMain(*args, **kwargs)[source]

Bases: QMainWindow

Main application window for EuljiroBible.

This window hosts the primary tab-based interface, including:

  • Verse lookup and export (TabVerse)

  • Keyword search and export (TabKeyword)

  • Settings and overlay configuration (TabSettings)

It also manages global UI behaviors such as:

  • Language switching (menu-driven)

  • Polling enable/disable toggle and propagation to tabs

  • About/help actions

  • Optional memory monitor window

settings

Current settings dictionary (reloaded as needed via ConfigManager).

Type:

dict

app_version

Application version string displayed in the title and About dialog.

Type:

str

current_language

Active UI language code (e.g., “ko”, “en”).

Type:

str

messages

Loaded translation dictionary for the active language.

Type:

dict

help_menu

Help menu container (About action).

Type:

QMenu

tools_menu

Tools menu container (memory monitor, test error).

Type:

QMenu

lang_menu

Language selection menu if languages are available.

Type:

QMenu | None

about_action

Opens the About dialog.

Type:

QAction

memory_action

Opens the memory monitor window.

Type:

QAction

test_error_action

Triggers a controlled error for testing.

Type:

QAction

poll_toggle_btn

Global polling toggle button (checkable). When enabled, export/clear controls become available and polling-dependent UI elements are shown where applicable.

Type:

QPushButton

tabs

Tab widget hosting the main UI tabs.

Type:

QTabWidget

tab_verse

Verse lookup tab instance.

Type:

TabVerse

tab_keyword

Keyword search tab instance.

Type:

TabKeyword

tab_settings

Settings tab instance.

Type:

TabSettings

copyright_label

Footer label showing copyright/license text.

Type:

QLabel

monitor_window

Memory monitor window instance when opened.

Type:

MonitorMemory | None

__init__(version_list, settings, icon_path, app_version, parent=None)[source]

Initialize the main window and construct menus, tabs, and global controls.

Parameters:
  • version_list (list) – List of available Bible version identifiers for the verse/keyword tabs.

  • settings (dict) – Loaded user settings dictionary.

  • icon_path (str) – Path to the application icon file (provided by caller).

  • app_version (str) – Application version string.

  • parent (QWidget | None) – Optional parent widget.

tr(key)[source]

Translate a UI key using the currently loaded language messages.

Parameters:

key (str) – Translation key.

Returns:

Translated string if found; otherwise the key itself.

Return type:

str

change_language(lang_code)[source]

Translate a UI key using the currently loaded language messages.

Parameters:

key (str) – Translation key.

Returns:

Translated string if found; otherwise the key itself.

Return type:

str

refresh_settings_and_tabs()[source]

Reload settings from ConfigManager and refresh polling-dependent tab UI.

This is used after settings changes to ensure:

  • verse tab button layout is updated

  • keyword tab output button visibility is updated

  • settings tab overlay group visibility is updated

apply_tab_icons()[source]

Apply tab icons to the QTabWidget (skipped on macOS).

On macOS, icons are intentionally omitted due to Qt style inconsistencies.

update_poll_button_text()[source]

Update the polling toggle button label and icon.

The button reflects the current checked state and uses localized labels.

on_poll_toggle_clicked()[source]

Handle clicks on the polling toggle button.

This persists the new polling state and propagates it across tabs by:

  • saving poll_enabled to ConfigManager

  • updating settings tab polling behavior (start/stop/restart timer logic)

  • updating button label/icon

  • updating verse/keyword tab button visibility/layout

show_about()[source]

Show the About dialog.

The dialog content is localized and includes the current application version.

open_monitor_memory()[source]

Open the real-time memory monitor window.

This reads the refresh interval from settings and launches MonitorMemory.

trigger_error()[source]

Trigger a controlled exception to test error handling.

This is intended for validating logging and critical error dialog behavior.

closeEvent(event)[source]

Handle application close events and persist UI state.

This attempts to:

  • apply dynamic settings (fonts/overlay) before exit

  • save UI-derived settings to disk

  • close any active overlay window owned by the settings tab

Parameters:

event (QCloseEvent) – Close event.