controller.utils.slide_file_watcher
- File:
EuljiroWorship/controller/utils/slide_file_watcher.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.
Slide file watcher for the slide controller.
This module continuously monitors the slide output JSON file used by the slide controller. It detects file modification events via polling and emits Qt signals when:
Slide content is updated (non-empty JSON)
Slide content is cleared (empty JSON), typically indicating the end of emergency caption mode
The watcher is designed to run inside a QThread and communicate with the
controller.slide_controller.SlideController via Qt signals only.
- class controller.utils.slide_file_watcher.SlideFileWatcher(*args, **kwargs)[source]
Bases:
QObjectWatches a slide JSON file and emits signals on content changes.
This watcher polls the target slide file at a fixed interval and detects changes using the file’s modified timestamp.
- Signals:
slide_changed(list, int):Emitted when the slide file is updated with non-empty content. The second argument represents the initial slide index.
slide_cleared():Emitted when the slide file becomes empty, typically signaling the end of emergency caption mode.
- slide_changed
alias of
list
- __init__(slide_file, poll_interval=1)[source]
Initialize the slide file watcher.
- Parameters:
slide_file (str) – Path to the JSON slide file to monitor.
poll_interval (int, optional) – Polling interval in seconds. Defaults to 1.
- Returns:
None
- stop()[source]
Stop the file watching loop.
This method signals the watcher to exit its polling loop gracefully.
- Returns:
None
- run()[source]
Start monitoring the slide file for changes.
This method runs an infinite polling loop while the watcher is active. When a file modification is detected:
Emits
slide_changedif the file contains slide dataEmits
slide_clearedif the file is empty
This method is intended to be executed inside a QThread.
- Returns:
None