fix: app icon missing in packaged builds — bundle icons + set window icon (#20) #31
Reference in New Issue
Block a user
Delete Branch "feat/20-app-icon"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #20
Root cause
Two independent gaps meant the packaged app showed no icon at runtime:
bcc.spechaddatas=[]— theicons/folder was never bundled into the frozen app, so any runtimeQIcon(...)load failed in packaged builds (this also silently broke the About-dialog icon).main()never set an application/window icon and did not set a Windows AppUserModelID, so the taskbar/window fell back to the default host icon even though the.exePE resource icon (icons/app.ico) was set.Fix
bcc.spec:datas=[("icons", "icons")]so the icon assets ship inside the bundle (all platforms).bcc.py:_asset_dir()— resolves assets for both a source run and a frozen PyInstaller onefile build (sys._MEIPASS)._app_icon()— builds a multi-resolutionQIconfrom the bundled PNGs (16–512), falling back toapp.ico.main()setsapp.setWindowIcon(_app_icon()), and on Windows callsSetCurrentProcessExplicitAppUserModelID(...)(guarded in try/except) so the taskbar groups under our own icon.AboutDialognow resolves its icon via_asset_dir()too, so it works in packaged builds.tests/test_core.py: a guard test asserting the referenced icon assets exist (so the spec mapping / icon sizes can't silently drift).Verification
ruff check,ruff format --check,pytestall green (166 tests).bcc.pyvalidated viaast.parse+ ruff (PySide6 not installed in CI sandbox).Needs real-Windows confirmation
The runtime taskbar-icon behavior (AppUserModelID + bundled icon) can only be fully verified on a packaged Windows build — the code path is correct-by-inspection and fully guarded, but worth a visual check on the next Windows release artifact.