Feat: v1.4.1 - Windows installer updated.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Series 3 Watcher — System Tray Launcher v1.4.0
|
||||
Series 3 Watcher — System Tray Launcher v1.4.1
|
||||
Requires: pystray, Pillow, tkinter (stdlib)
|
||||
|
||||
Run with: pythonw series3_tray.py (no console window)
|
||||
@@ -126,7 +126,12 @@ def apply_update(download_url):
|
||||
|
||||
# --------------- Paths ---------------
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
# When frozen by PyInstaller, __file__ points to a temp extraction dir.
|
||||
# sys.executable is always the real .exe location — use that instead.
|
||||
if getattr(sys, "frozen", False):
|
||||
HERE = os.path.dirname(os.path.abspath(sys.executable))
|
||||
else:
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
CONFIG_PATH = os.path.join(HERE, "config.ini")
|
||||
|
||||
|
||||
@@ -141,11 +146,50 @@ COLORS = {
|
||||
}
|
||||
|
||||
ICON_SIZE = 64
|
||||
ICON_FILE = os.path.join(HERE, "icon.ico")
|
||||
|
||||
# Load base icon once at startup; fall back to None if missing.
|
||||
# When frozen, bundled data files live in sys._MEIPASS.
|
||||
def _load_base_icon():
|
||||
candidates = [ICON_FILE]
|
||||
if getattr(sys, "frozen", False):
|
||||
candidates.insert(0, os.path.join(sys._MEIPASS, "icon.ico"))
|
||||
for path in candidates:
|
||||
try:
|
||||
img = Image.open(path)
|
||||
img = img.convert("RGBA").resize((ICON_SIZE, ICON_SIZE), Image.LANCZOS)
|
||||
return img
|
||||
except Exception:
|
||||
continue
|
||||
return None
|
||||
|
||||
_BASE_ICON = _load_base_icon()
|
||||
|
||||
|
||||
def make_icon(status):
|
||||
"""Draw a solid filled circle on a transparent background."""
|
||||
"""
|
||||
Use icon.ico as the base and overlay a small status dot in the
|
||||
bottom-right corner. Falls back to a plain colored circle if the
|
||||
ico file is not available.
|
||||
"""
|
||||
color = COLORS.get(status, COLORS["starting"])
|
||||
|
||||
if _BASE_ICON is not None:
|
||||
img = _BASE_ICON.copy()
|
||||
draw = ImageDraw.Draw(img)
|
||||
# Dot size and position — bottom-right corner
|
||||
dot_r = ICON_SIZE // 5 # radius ~12px on 64px icon
|
||||
margin = 2
|
||||
x0 = ICON_SIZE - dot_r * 2 - margin
|
||||
y0 = ICON_SIZE - dot_r * 2 - margin
|
||||
x1 = ICON_SIZE - margin
|
||||
y1 = ICON_SIZE - margin
|
||||
# White outline for contrast on dark/light backgrounds
|
||||
draw.ellipse([x0 - 2, y0 - 2, x1 + 2, y1 + 2], fill=(255, 255, 255, 220))
|
||||
draw.ellipse([x0, y0, x1, y1], fill=color + (255,))
|
||||
return img
|
||||
|
||||
# Fallback: plain colored circle
|
||||
img = Image.new("RGBA", (ICON_SIZE, ICON_SIZE), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
margin = 6
|
||||
|
||||
Reference in New Issue
Block a user