This commit was merged in pull request #31.
This commit is contained in:
@@ -1253,6 +1253,31 @@ class LogViewerDialog(QDialog):
|
|||||||
super().closeEvent(event)
|
super().closeEvent(event)
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Bundled assets (icons) — resolves both a normal source run and a frozen
|
||||||
|
# PyInstaller build (onefile extracts assets under sys._MEIPASS).
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
def _asset_dir() -> Path:
|
||||||
|
base = getattr(sys, "_MEIPASS", None)
|
||||||
|
return Path(base) if base else Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
|
||||||
|
def _app_icon() -> QIcon:
|
||||||
|
"""Multi-resolution app/window icon from the bundled PNGs (falls back to
|
||||||
|
the .ico). Returns a null QIcon if no asset is found."""
|
||||||
|
icon = QIcon()
|
||||||
|
base = _asset_dir() / "icons" / "twin-gears" / "rounded"
|
||||||
|
for size in (16, 32, 48, 64, 128, 256, 512):
|
||||||
|
f = base / f"icon-{size}.png"
|
||||||
|
if f.is_file():
|
||||||
|
icon.addFile(str(f))
|
||||||
|
if icon.isNull():
|
||||||
|
ico = _asset_dir() / "icons" / "app.ico"
|
||||||
|
if ico.is_file():
|
||||||
|
icon.addFile(str(ico))
|
||||||
|
return icon
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
# About dialog
|
# About dialog
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
@@ -1274,9 +1299,7 @@ class AboutDialog(QDialog):
|
|||||||
self._worker: UpdateCheckWorker | None = None
|
self._worker: UpdateCheckWorker | None = None
|
||||||
self._release_url: str | None = None
|
self._release_url: str | None = None
|
||||||
|
|
||||||
icon_path = (
|
icon_path = _asset_dir() / "icons" / "twin-gears" / "rounded" / "icon-128.png"
|
||||||
Path(__file__).resolve().parent / "icons" / "twin-gears" / "rounded" / "icon-128.png"
|
|
||||||
)
|
|
||||||
if icon_path.is_file():
|
if icon_path.is_file():
|
||||||
self.setWindowIcon(QIcon(str(icon_path)))
|
self.setWindowIcon(QIcon(str(icon_path)))
|
||||||
|
|
||||||
@@ -2366,9 +2389,23 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if sys.platform == "win32":
|
||||||
|
# Without an explicit AppUserModelID, Windows taskbar groups the app
|
||||||
|
# under the default host/Python icon instead of our own window icon.
|
||||||
|
try:
|
||||||
|
import ctypes
|
||||||
|
|
||||||
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||||
|
"io.avezzano.better-claude-config"
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
app.setApplicationName("Better Claude Config")
|
app.setApplicationName("Better Claude Config")
|
||||||
app.setApplicationDisplayName("Better Claude Config")
|
app.setApplicationDisplayName("Better Claude Config")
|
||||||
|
icon = _app_icon()
|
||||||
|
if not icon.isNull():
|
||||||
|
app.setWindowIcon(icon)
|
||||||
app.setStyleSheet(STYLESHEET)
|
app.setStyleSheet(STYLESHEET)
|
||||||
win = MainWindow()
|
win = MainWindow()
|
||||||
win.show()
|
win.show()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ a = Analysis(
|
|||||||
["bcc.py"],
|
["bcc.py"],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=[],
|
datas=[("icons", "icons")],
|
||||||
hiddenimports=[],
|
hiddenimports=[],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
hooksconfig={},
|
hooksconfig={},
|
||||||
|
|||||||
@@ -1326,3 +1326,18 @@ def test_health_from_spawn_result_failed_without_stderr_has_no_dash():
|
|||||||
}
|
}
|
||||||
_, summary = c.health_from_spawn_result(result)
|
_, summary = c.health_from_spawn_result(result)
|
||||||
assert "—" not in summary
|
assert "—" not in summary
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# App icon assets present (issue #20 — icons must exist to be bundled/loaded)
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
def test_app_icon_assets_present():
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
root = Path(c.__file__).resolve().parent
|
||||||
|
rounded = root / "icons" / "twin-gears" / "rounded"
|
||||||
|
# The window-icon builder in bcc.py loads these sizes; keep them present.
|
||||||
|
for size in (16, 32, 128, 256):
|
||||||
|
assert (rounded / f"icon-{size}.png").is_file(), f"missing icon-{size}.png"
|
||||||
|
assert (root / "icons" / "app.ico").is_file()
|
||||||
|
assert (root / "icons" / "app.icns").is_file()
|
||||||
|
|||||||
Reference in New Issue
Block a user