Skip to content

feat: add progress bar and ETA to splash screen#120

Open
raman78 wants to merge 1 commit intoSTOCD:mainfrom
raman78:feature/splash-progress
Open

feat: add progress bar and ETA to splash screen#120
raman78 wants to merge 1 commit intoSTOCD:mainfrom
raman78:feature/splash-progress

Conversation

@raman78
Copy link
Copy Markdown

@raman78 raman78 commented Mar 29, 2026

Problem

The splash screen shows only a text label during startup. Long operations like downloading several thousand icons give no indication of how much remains.

Solution

Replaces the three-function splash.py with a QTimer-polling design and adds a QProgressBar + file counter label to setup_splash().

Thread-safety: worker threads write to a plain Python dict (_state); a QTimer in MainThread polls it every 50 ms and updates widgets — no Qt calls from worker threads, no new signals.

New API:

splash_progress(self, current: int, total: int)  # safe from any thread

ETA displayed inline: Downloading Icons (ETA: 34s)

Backwards compatible: bar and counter are hidden by default; if nothing calls splash_progress() the splash looks identical to before. Both widgets accessed via getattr(..., None) for graceful degradation.

File Change
src/splash.py QTimer-polling version + splash_progress + ETA
src/app.py setup_splash() — adds progress bar + counter rows
src/datafunctions.py adds splash_progress to import

The splash screen currently shows only a text label during startup.
This adds a `QProgressBar` and a file counter label that are driven by
a new `splash_progress(self, current, total)` helper — safe to call from
any worker thread.

Implementation:
- `splash.py` is replaced with a QTimer-polling design: worker threads
  write to a plain dict (_state); the MainThread timer reads it every 50ms
  and updates widgets — no Qt calls from worker threads, no extra signals
- ETA is computed from the rate of progress since the bar first appeared
  and displayed inline in the status label: "Downloading Icons (ETA: 12s)"
- `progress_bar` and `progress_detail` are hidden by default and only
  appear when a worker calls `splash_progress(self, current, total)` with
  total > 0 — backwards compatible, behaviour unchanged if never called
- Both widgets are accessed via `getattr(self.widgets, ..., None)` so
  they degrade gracefully even if `setup_splash` is ever overridden
- `setup_splash()` gains two rows in the existing grid layout for the bar
  and counter; the stretch spacers are adjusted accordingly

New public API in `splash.py`:
  `splash_text(self, text)`           — update status label (was already there)
  `splash_progress(self, cur, total)` — update progress bar + counter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant