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.
46 lines
1.8 KiB
PowerShell
46 lines
1.8 KiB
PowerShell
# Baut VersaPadViewer.exe (PyInstaller --onedir) und kopiert das Ergebnis
|
|
# nach lokal (C:\Users\<user>\AppData\Local\VersaPadViewer).
|
|
#
|
|
# 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"
|
|
|
|
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 `
|
|
--icon icon.ico --add-data "icon.png;." --add-data "icon.ico;." `
|
|
desktop_viewer.py --noconfirm
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
if (Test-Path $localDir) {
|
|
Remove-Item $localDir -Recurse -Force
|
|
}
|
|
Copy-Item "$buildSrc\dist\VersaPadViewer" -Destination $localDir -Recurse
|
|
Remove-Item $buildSrc -Recurse -Force
|
|
|
|
Write-Host "Fertig: $localDir\VersaPadViewer.exe"
|