controller.ui.slide_controller_ui_builder

File:

EuljiroWorship/controller/ui/slide_controller_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.

Builds the user interface for the slide controller window.

This module defines a small UI builder class that constructs and wires the widgets used by the controller.slide_controller.SlideController main window. The builder is responsible for creating the layout, initializing interactive controls, populating the preview table, and installing event filters for keyboard navigation.

Key responsibilities:

  • Create top status label and apply elided text rendering

  • Create emergency caption ON/OFF buttons and connect controller callbacks

  • Create page navigation controls (first/prev/next/last + page input)

  • Create and populate the slide preview table

  • Install global event filters for keyboard-based slide navigation

class controller.ui.slide_controller_ui_builder.SlideControllerUIBuilder(controller)[source]

Bases: object

UI builder for the controller.slide_controller.SlideController main window.

This class encapsulates widget construction so that controller.slide_controller.SlideController can keep runtime logic separate from UI layout details. The builder creates and attaches widgets onto the controller instance (self.c), and wires up signals to the controller’s navigation and emergency-caption handlers.

The builder assumes the controller already has:

  • slides: list[dict] containing slide data for preview population

  • index: int current slide index to pre-select in the table

c

The controller instance that owns the window and runtime logic. Widgets created by this builder are attached onto this object.

This builder assigns (at minimum) the following attributes onto c:

  • label (QLabel): Top status label (elided text).

  • btn_on (QPushButton): Emergency caption ON button.

  • btn_off (QPushButton): Emergency caption OFF button.

  • first_button (QPushButton): Jump to first slide button.

  • prev_button (QPushButton): Jump to previous slide button.

  • next_button (QPushButton): Jump to next slide button.

  • last_button (QPushButton): Jump to last slide button.

  • page_input (QLineEdit): Page number input used for direct jump.

  • table (QTableWidget): Slide preview table (row selection + click-to-jump).

Type:

controller.slide_controller.SlideController

Note

  • Widgets are attached onto the controller instance as attributes (e.g., controller.label, controller.table, controller.page_input).

  • The builder installs event filters on the controller and its table to support keyboard navigation.

__init__(controller)[source]

Initialize the UI builder with a controller.slide_controller.SlideController instance.

Parameters:

controller (QWidget) – The main controller.slide_controller.SlideController instance that owns the window and runtime logic. Widgets created by this builder are assigned as attributes on this object.

Returns:

None

build_ui()[source]

Build and wire the full controller.slide_controller.SlideController UI.

This method constructs:

  • Top status label (with elided rendering)

  • Emergency caption ON/OFF buttons

  • Page navigation row (first/prev/page/next/last)

  • Slide preview table (row selection + click-to-jump)

  • Event filters for global keyboard navigation

Side Effects:

  • Creates widgets and assigns them onto the controller instance.

  • Connects widget signals to controller slots/callbacks.

  • Installs event filters on the controller and its table.

Returns:

None

static set_elided_label_text(label, text)[source]

Set right-elided text on a QLabel to fit the current label width.

This helper computes an elided string (truncated with an ellipsis) so the label does not overflow horizontally. Truncation occurs on the right side.

Parameters:
  • label (QLabel) – Target label widget whose text will be updated.

  • text (str) – Full text to render (may be truncated).

Returns:

None