Implementiere Update-Mechanismus mit Gitea API

- Neue Datei version.txt für Versionsverwaltung (1.0.0)
- Neue Datei update_checker.py für automatische Update-Prüfung
- Prüft auf neueste Releases über Gitea API (https://git.file-archive.de)
- GUI zeigt Update-Dialog wenn neue Version verfügbar ist
- Update-Prüfung läuft asynchron im Hintergrund
- install.sh: packaging-Paket hinzugefügt, version.txt und update_checker.py werden mitgekopiert
This commit is contained in:
2026-02-23 14:54:27 +01:00
parent 9aa9db8c17
commit 86e6b4d0a6
4 changed files with 145 additions and 2 deletions

33
gui.py
View File

@@ -11,6 +11,7 @@ import threading
import re
import json
from pdf_to_ics import extract_dienstplan_data, create_ics_from_dienstplan
from update_checker import check_for_updates, get_current_version
# Versuche tkinterdnd2 zu importieren (optional für besseres Drag & Drop)
try:
@@ -56,6 +57,10 @@ class PDFtoICSGUI:
# Drag & Drop einrichten
self.setup_drag_and_drop()
# Update-Prüfung im Hintergrund starten
update_thread = threading.Thread(target=self.check_for_updates_background, daemon=True)
update_thread.start()
# Speichere Konfiguration beim Schließen
self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
@@ -445,6 +450,34 @@ class PDFtoICSGUI:
f"Es wurden {success_count} ICS-Datei(en) erfolgreich erstellt!\n\n"
f"Speicherort: {output_dir}"
))
def check_for_updates_background(self):
"""Prüfe auf Updates im Hintergrund"""
try:
update_available, new_version, download_url = check_for_updates()
if update_available:
# Zeige Update-Dialog auf dem Main-Thread
self.root.after(0, self.show_update_dialog, new_version, download_url)
except Exception as e:
# Stille Fehler ignorieren, damit GUI nicht beeinflusst wird
pass
def show_update_dialog(self, new_version, download_url):
"""Zeige Update-Dialog"""
current_version = get_current_version()
response = messagebox.showinfo(
"Update verfügbar",
f"Eine neue Version ist verfügbar!\n\n"
f"Aktuelle Version: v{current_version}\n"
f"Neue Version: v{new_version}\n\n"
f"Möchten Sie die neue Version herunterladen?"
)
if response == 'ok': # Dialog mit OK-Button
import webbrowser
webbrowser.open(download_url)
def main():