Skip to content

Windows installer and GUI app (v0.1.0) - #3

Merged
Osiris-DevWorks merged 7 commits into
mainfrom
feature/installer-and-gui
May 7, 2026
Merged

Osiris-DevWorks merged 7 commits into
mainfrom
feature/installer-and-gui

Conversation

@Osiris-DevWorks

Copy link
Copy Markdown
Owner

Summary

Packages Super TTS as a downloadable Windows installer alongside the existing Docker / Railway path. Same bot code, two delivery modes — gui_main.py is the PyInstaller entry point used by the installer; main.py is unchanged for Docker / Railway.

What's in this branch (7 commits)

  • Windows installer recipe — scripts/build/build_exe.py (PyInstaller onedir, --windowed, --noupx, ~500 MB bundle), installer.iss (Inno Setup, no [Code] block — config happens in the GUI), scripts/build/build_all.bat, VERSION.TXT.
  • PyQt6 GUI mirroring smart-citizen's style — Status / Settings / Logs / About tabs, four themes (ODW default), QThread-hosted bot runner, Qt-bridge logging into the Logs tab. New gui/ package.
  • .env config surface at `%APPDATA%\Osiris DevWorks\Super TTS.env` — Settings tab is the sole config UI; installer doesn't prompt for credentials.
  • OWNER_ID and TTS_DEVICE finally consumed by the bot. Both were documented as required env vars but never read in code (`RAILWAY_ENV_VARS.md` even flagged `OWNER_ID` as "Never referenced"). `main.py` now passes `OWNER_ID` to the Bot constructor; `tts/engine_factory.py` honors `TTS_DEVICE` over `config.yaml`.
  • Defer fix on 12 slash command handlers. Discord invalidates interactions after 3 seconds; any handler that queried the DB before responding hit `10062 Unknown interaction` when run far from the database (the typical installer scenario). Confirmed in the wild on `/admin_voice subscription-info`. Pattern matches the existing handlers that were already correct.
  • `DISCORD_SETUP.md` rewritten as a comprehensive end-user guide covering token retrieval, intent setup, OWNER_ID via Developer Mode, OAuth invite, GUI vs `.env` configuration, and a troubleshooting section for the gotchas we hit during testing (4006 disconnects from shared tokens, intent misconfig, slash propagation delay, model download rate limits).

Test status

  • ✅ GUI dev-mode launch verified — connects to Discord, syncs slash commands, loads cog, plays TTS in voice channel using local CPU engine.
  • ✅ Installer .exe successfully built — `dist\Super-TTS-0.1.0-Setup.exe` (310 MB).
  • ⚠️ Installer .exe not yet test-installed on a clean machine — recommended before tagging the release.
  • ⚠️ `pyproject.toml` and `poetry.lock` are unchanged; PyQt6 is installed via pip on the build machine (not added as a Poetry dep, so Docker / Railway image is unaffected).

Plan after merge

Tag `v0.1.0` on main, run `gh release create v0.1.0` with `.release-notes-v0.1.0.md` and the installer .exe as the asset.

aabou and others added 7 commits April 26, 2026 20:04
Mirrors the smart-citizen / sc-profile-editor build recipe so end users can
run the bot locally on Windows while still talking to the shared Railway
PostgreSQL. Each install is paired with the user's own Discord token,
collected via an Inno Setup wizard page and written to
%APPDATA%\Osiris DevWorks\Super TTS\.env.

Code changes (all backwards-compatible; Docker/Railway run path unchanged):
- main.py: load .env from %APPDATA% first, fall back to original
  load_dotenv() in dev/Docker; friendlier "missing token" error with a
  pause prompt only when frozen; skip the import-time exit when
  SUPER_TTS_GUI_MODE=1 so the upcoming GUI can import this module.
- tts_module/tts.py: resolve config/config.yaml via _MEIPASS-aware helper
  so it works under PyInstaller; identical to old behavior in dev/Docker.
- common/constants.py: route logs to %LOCALAPPDATA% only when frozen;
  swap the racy mkdir for makedirs(exist_ok=True).

New build artifacts:
- VERSION.TXT (single source of truth, optional --increment bumping)
- scripts/build/build_exe.py (PyInstaller onedir, --noupx, --collect-all
  for supertonic + onnxruntime, --exclude-module for dead Coqui-TTS path)
- scripts/build/build_all.bat (clean -> build -> ISCC)
- installer.iss (Inno Setup, %LOCALAPPDATA% target, no admin, post-install
  token wizard, preserves existing .env on reinstall)

.gitignore: anchor "build/" rule to repo root so scripts/build/ is tracked.
CLAUDE.md added with project orientation for future Claude Code sessions.

Note: installer.iss has a placeholder DATABASE_URL (#define on line 22)
that must be replaced with the real Railway public-proxy URL before
producing a release build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Windows desktop GUI that wraps the existing bot's asyncio main
function in a QThread so the UI stays responsive while discord.py runs.
The GUI is the entry point for the installer build only — Docker/Railway
keep using main.py directly and never load the gui/ package.

Style mirrors smart-citizen/src/gui:
- 4-theme palette system (Light / Dark / SCLE / ODW), default ODW
  (Osiris DevWorks navy + antique gold). Theme swap is live via
  QApplication palette + QSS rule (no .qss files); secondary text
  uses the role=secondary property pattern.
- LogTab with QPlainTextEdit + Qt-bridge logging handler and per-level
  color coding, max 2000 lines, export-to-file.
- Tabs: Status | Settings | Logs | About. Branded title header above.
- Tooltip wake-up tuned to 800ms via a Fusion proxy style.

Status tab:
- Connection dot + status label (Disconnected / Connecting / Connected /
  Error), auto-connects on launch when a token is configured.
- Connect/Disconnect button. Discord.py only allows one start() per Bot
  instance, so re-connect requires app relaunch — surfaced as a note
  under the disabled button.

Settings tab:
- Token + DATABASE_URL + log level persisted to
  %APPDATA%\Osiris DevWorks\Super TTS\.env (same path the installer
  writes during install, interchangeable with hand-edited .env files).
- Theme persisted to QSettings (HKCU\Software\Osiris DevWorks\Super TTS).
- Show/Hide toggles for the masked credential fields.

main.py change (single line): re-read DISCORD_TOKEN from os.environ
inside main() so the GUI can update it after the user enters a token in
Settings without restarting. Docker/Railway behavior unchanged (the env
var doesn't change in those environments).

Build:
- gui_main.py is the new PyInstaller entry point.
- build_exe.py switches to gui_main.py, adds --windowed (no console),
  --collect-submodules=PyQt6, and hidden imports for every gui.* and
  in-tree module.
- build_all.bat now also pip-installs PyQt6 alongside pyinstaller.

PyQt6 is intentionally NOT added to pyproject.toml — installing it via
pip in build_all.bat keeps poetry.lock untouched so Docker/Railway
builds keep working bit-for-bit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The installer no longer prompts for a Discord token or writes a .env
file. It just lays the binaries down, creates the Start Menu shortcut,
and launches the app — exactly the "all-in-one binary, configure inside
the app" flow the user expected.

Why the previous design felt off: smart-citizen's installer wizard
prompts for paths (SC directory, OneDrive override) which feel natural
during install. A Discord bot token doesn't — most users haven't created
the bot yet when they click Install, and asking up front confuses the
first-run experience.

What changes:
- installer.iss: dropped the [Code] section (TokenPage / CurStepChanged)
  and the #define DATABASE_URL constant. Setup is now files + icons +
  run, no wizard prompts beyond Inno's standard License/InstallDir pages.
- gui/settings.py: added DEFAULT_DATABASE_URL constant (the operator-
  baked Railway public-proxy URL placeholder). The installer used to
  write this into .env at install time; now the GUI pre-fills the
  Settings tab's Database URL field with it on first launch instead.
  Added DEFAULT_LOG_LEVEL for symmetry.
- gui/settings_tab.py:
  - Pre-fill the Database URL field with DEFAULT_DATABASE_URL when .env
    is missing or has an empty DATABASE_URL key. End users typically
    just click Save — they never need to know the Railway URL.
  - Added a "Need a token? Create one at discord.com/developers..." help
    line above the form with intent-checklist guidance. Single most
    common support question, addressed before they ask.
- gui/main_window.py: on first launch when no DISCORD_TOKEN is set, the
  app opens directly on the Settings tab so users land on the form they
  need to fill in. Subsequent launches (token present) open on Status
  and auto-connect as before.

Operator workflow on rotation:
  - Edit DEFAULT_DATABASE_URL in gui/settings.py
  - Rebuild installer with scripts\build\build_all.bat
  - Redistribute. Users' existing .env files keep their saved token
    (and, if they edited it, their saved DB URL); new installs pick up
    the new default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match main.py's resolution order exactly so dev-mode launches
(`poetry run python gui_main.py` from the repo) pick up an existing
project-root .env on the Status tab from launch — previously the bot
thread loaded it on main.py import, so the Status tab would briefly
show "No token" even when one was configured.

Production install behavior unchanged: the %APPDATA% .env is checked
first, and falls back to the CWD search only when it's missing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OWNER_ID and TTS_DEVICE were documented but never actually consumed
(RAILWAY_ENV_VARS.md even flagged OWNER_ID as "Never referenced in
code"). Without these wired, end users had no path to enable admin
commands or flip CPU/CUDA on their hardware.

Bot side:
- main.py now passes OWNER_ID through to the Bot constructor so
  is_admin_or_owner actually recognizes the install owner.
- tts/engine_factory.py honors TTS_DEVICE env var with config.yaml as
  the fallback, so a CUDA-capable user can toggle GPU without editing
  the bundled config.

GUI side:
- Settings tab gains Owner ID, HuggingFace Token (masked + show
  toggle), and TTS Device fields with inline help text pointing at
  Discord Developer Mode and HuggingFace token settings.
- Empty Owner ID / HF token entries are skipped on save so a user
  hand-editing .env doesn't get clobbered by an empty GUI field.
Twelve slash command handlers were calling interaction.response.send_message
*after* one or more DB queries. Discord invalidates an interaction after 3
seconds, so any user running the bot far from the database (the typical
installer scenario, where the bot machine is on a different continent from
Railway) hit "10062 Unknown interaction" errors. Confirmed in the wild on
/admin_voice subscription-info.

Fix is mechanical: defer immediately after the cheap pre-checks
(initialized + db model setup), then use interaction.followup.send for all
subsequent replies. Pattern matches the existing cleanup-expired and
reassign-voice handlers that were already correct.

Handlers patched: setup add/remove/list, grant/revoke/list/info
subscription, speed, voice list/set, claim/release voice. Plus
subscription-info specifically (the one we caught failing in the GUI logs).

DISCORD_SETUP.md was a minimal dev-flow doc; rewritten as a complete
end-user guide that walks through application creation, intent setup,
token + OWNER_ID retrieval (with Developer Mode), invite URL generation,
configuration via either GUI Settings tab or .env, and a troubleshooting
section covering the gotchas we hit during testing (4006 disconnects from
shared tokens, intent misconfig, slash propagation delay, model download
rate limits).
Two issues surfaced producing the first installer:

build_all.bat tested for the onedir output with `if exist "dist\Super-TTS-v*\"`,
but cmd's `if exist` doesn't expand wildcards on directory names. A successful
PyInstaller build was being falsely flagged as missing, and the script then
hit `pause` and hung waiting for input. Read VERSION.TXT and check the exact
folder name instead.

installer.iss declared `ArchitecturesAllowed=x64`, which Inno Setup 6.7+ has
deprecated in favor of `x64compatible`. Switching keeps the build warning-free
and stays compatible with future Inno Setup releases (the latter is the
documented preferred form).
@Osiris-DevWorks
Osiris-DevWorks merged commit 49bd4a2 into main May 7, 2026
1 check passed
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