Add custom icon and tray-minimize behavior (like VersaGUI's TrayApp)

Minimizing or closing hides the window instead of leaving a taskbar
entry; only "Beenden" in the tray right-click menu really exits. Tray
callbacks route through a queue instead of touching Tk directly from
pystray's thread (same pattern as the earlier serial-thread fix).

Also fixes the build script: PyInstaller failed on the network share
while copying Tcl/Tk tzdata (path-length issue), so building now
happens in a local temp copy instead of directly on Z:.

Adds an info button that explains the MCP server's available tools.
This commit is contained in:
cjjohn 2026-08-05 08:30:50 +02:00
parent e456af7c19
commit 4ac29a3e5c
6 changed files with 208 additions and 25 deletions

View file

@ -1,19 +1,38 @@
# Baut VersaPadViewer.exe (PyInstaller --onedir) und kopiert das Ergebnis
# nach lokal (C:\Users\<user>\AppData\Local\VersaPadViewer).
#
# WICHTIG: Muss lokal laufen, NICHT direkt vom Netzlaufwerk (Z:\Git\...) --
# Windows blockiert das Nachladen der PyInstaller-_internal-DLLs von einem
# Netzwerkpfad (SMB-Share) ohne jede Fehlermeldung, der Prozess startet
# einfach nie. Deshalb bauen wir hier (Quelle darf auf Z: liegen) und
# kopieren das fertige Bundle danach nach C:.
# WICHTIG: Sowohl Bauen als auch Laufen muessen lokal passieren, NICHT auf
# dem Netzlaufwerk (Z:\Git\...):
# - Laufzeit: Windows blockiert das Nachladen der PyInstaller-_internal-
# DLLs von einem Netzwerkpfad (SMB-Share) ohne jede Fehlermeldung, der
# Prozess startet einfach nie.
# - Buildzeit: PyInstaller scheitert beim Kopieren von Tcl/Tk-tzdata (viele
# tief verschachtelte, lang benannte Zeitzonen-Ordner) mit
# "FileNotFoundError: [WinError 3]" -- Pfadlaengen-Problem auf dem
# SMB-Share, kombiniert mit dem eh schon langen Projektpfad.
#
# Deshalb: Quellcode zuerst nach lokal (%TEMP%) kopieren, dort bauen, danach
# das fertige Bundle nach %LOCALAPPDATA% kopieren. Z: wird nur zum Lesen der
# Quelldateien angefasst.
$ErrorActionPreference = "Stop"
$projectDir = $PSScriptRoot
$buildSrc = "$env:TEMP\versapad_build_src"
$localDir = "$env:LOCALAPPDATA\VersaPadViewer"
Push-Location $projectDir
if (Test-Path $buildSrc) {
Remove-Item $buildSrc -Recurse -Force
}
New-Item -ItemType Directory -Path $buildSrc | Out-Null
Copy-Item "$projectDir\*.py" -Destination $buildSrc
Copy-Item "$projectDir\icon.ico" -Destination $buildSrc
Copy-Item "$projectDir\icon.png" -Destination $buildSrc
Push-Location $buildSrc
try {
py -m PyInstaller --windowed --onedir --name VersaPadViewer desktop_viewer.py --noconfirm
py -m PyInstaller --windowed --onedir --name VersaPadViewer `
--icon icon.ico --add-data "icon.png;." --add-data "icon.ico;." `
desktop_viewer.py --noconfirm
} finally {
Pop-Location
}
@ -21,6 +40,7 @@ try {
if (Test-Path $localDir) {
Remove-Item $localDir -Recurse -Force
}
Copy-Item "$projectDir\dist\VersaPadViewer" -Destination $localDir -Recurse
Copy-Item "$buildSrc\dist\VersaPadViewer" -Destination $localDir -Recurse
Remove-Item $buildSrc -Recurse -Force
Write-Host "Fertig: $localDir\VersaPadViewer.exe"