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:
33
gui.py
33
gui.py
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user