Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17b2e7ed59 | |||
| 54516a315a | |||
| 1bb8820cf1 | |||
| 95c461eca4 | |||
| db76fbf0d2 | |||
| 07c8905f47 | |||
| e692983a02 | |||
| df3db2cba4 | |||
| 61971f2155 | |||
| 4b18cd9495 | |||
| d1d1788a3c | |||
| fde69adcec | |||
| 44857c6a3c | |||
| 9173e59e1e | |||
| fa59ef5e8a | |||
| 10674a1454 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -3,3 +3,9 @@
|
||||
.venv/
|
||||
__pycache__/
|
||||
.pdf_to_ics_config.json
|
||||
|
||||
# Build artifacts
|
||||
dist/
|
||||
release/
|
||||
*.spec
|
||||
build/PDFtoICS/
|
||||
|
||||
147
BUILD_STANDALONE.md
Normal file
147
BUILD_STANDALONE.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Standalone Builds (Linux, macOS, Windows)
|
||||
|
||||
Diese Anleitung erstellt eigenständige Anwendungen mit **PyInstaller** auf dem jeweiligen Zielbetriebssystem.
|
||||
|
||||
## Wichtig
|
||||
|
||||
- Builds müssen **nativ pro OS** erstellt werden (kein Cross-Compile mit diesen Skripten).
|
||||
- Verwenden Sie eine aktive und funktionierende `.venv` im Projektordner.
|
||||
- Die GUI wird aus `gui_wxpython.py` gebaut.
|
||||
|
||||
---
|
||||
|
||||
## Release auf einen Blick
|
||||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
./build/build_linux.sh
|
||||
./build/package_linux.sh
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
```bash
|
||||
./build/build_macos.sh
|
||||
./build/package_macos.sh
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
```cmd
|
||||
build\build_windows.cmd
|
||||
build\package_windows.cmd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Empfohlene Release-Reihenfolge
|
||||
|
||||
1. Version erhöhen (z. B. `version.txt` und Changelog)
|
||||
2. Pro Zielplattform Build + Packaging ausführen
|
||||
3. Artefakte im `release/`-Ordner prüfen
|
||||
4. Git-Commit erstellen und Tag setzen (z. B. `v1.2.0`)
|
||||
5. Tag und Branch pushen
|
||||
6. Release-Artefakte auf der Release-Seite hochladen
|
||||
|
||||
Beispiel Git-Workflow:
|
||||
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "Release x.y.z"
|
||||
git tag -a vx.y.z -m "vx.y.z"
|
||||
git push origin main
|
||||
git push origin vx.y.z
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Linux
|
||||
|
||||
```bash
|
||||
chmod +x build/build_linux.sh
|
||||
./build/build_linux.sh
|
||||
```
|
||||
|
||||
Ergebnis:
|
||||
- `dist/PDFtoICS/` (Ordner mit ausführbarer Datei)
|
||||
|
||||
Optional als Release-Archiv (`.tar.gz`) verpacken:
|
||||
|
||||
```bash
|
||||
chmod +x build/package_linux.sh
|
||||
./build/package_linux.sh
|
||||
```
|
||||
|
||||
Ergebnis:
|
||||
- `release/PDFtoICS-linux-v<VERSION>.tar.gz`
|
||||
|
||||
---
|
||||
|
||||
## macOS
|
||||
|
||||
```bash
|
||||
chmod +x build/build_macos.sh
|
||||
./build/build_macos.sh
|
||||
```
|
||||
|
||||
Ergebnis:
|
||||
- `dist/PDFtoICS.app`
|
||||
|
||||
Hinweis:
|
||||
- Für öffentliche Verteilung ist Code-Signing/Notarisierung empfohlen.
|
||||
|
||||
Optional als Release-Archiv (`.zip`) verpacken:
|
||||
|
||||
```bash
|
||||
chmod +x build/package_macos.sh
|
||||
./build/package_macos.sh
|
||||
```
|
||||
|
||||
Ergebnis:
|
||||
- `release/PDFtoICS-macos-v<VERSION>.zip`
|
||||
|
||||
---
|
||||
|
||||
## Windows
|
||||
|
||||
Starten Sie unter Windows:
|
||||
|
||||
```cmd
|
||||
build\build_windows.cmd
|
||||
```
|
||||
|
||||
Ergebnis:
|
||||
- `dist\PDFtoICS\PDFtoICS.exe`
|
||||
|
||||
Hinweis:
|
||||
- Für weniger SmartScreen-Warnungen ist Signierung empfohlen.
|
||||
|
||||
Optional als Release-Archiv (`.zip`) verpacken:
|
||||
|
||||
```cmd
|
||||
build\package_windows.cmd
|
||||
```
|
||||
|
||||
Ergebnis:
|
||||
- `release\PDFtoICS-windows-v<VERSION>.zip`
|
||||
|
||||
---
|
||||
|
||||
## Clean Build
|
||||
|
||||
PyInstaller erstellt `build/` und `dist/` sowie eine `.spec` Datei im Projektverzeichnis.
|
||||
|
||||
Optionales Aufräumen:
|
||||
|
||||
```bash
|
||||
rm -rf build dist *.spec
|
||||
```
|
||||
|
||||
Unter Windows:
|
||||
|
||||
```cmd
|
||||
rmdir /s /q build
|
||||
rmdir /s /q dist
|
||||
del /q *.spec
|
||||
```
|
||||
@@ -1,35 +1,9 @@
|
||||
# 🎨 GUI Installation
|
||||
# 🎨 GUI Installation (wxPython)
|
||||
|
||||
Die grafische Benutzeroberfläche benötigt Tkinter, das auf manchen Systemen separat installiert werden muss.
|
||||
|
||||
## Installation von Tkinter
|
||||
|
||||
### Ubuntu/Debian
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3-tk
|
||||
```
|
||||
|
||||
### Fedora/RHEL
|
||||
```bash
|
||||
sudo dnf install python3-tkinter
|
||||
```
|
||||
|
||||
### Arch Linux
|
||||
```bash
|
||||
sudo pacman -S tk
|
||||
```
|
||||
|
||||
### macOS
|
||||
Tkinter ist bereits mit Python installiert - nichts zu tun! ✓
|
||||
|
||||
### Windows
|
||||
Tkinter ist bereits mit Python installiert - nichts zu tun! ✓
|
||||
Die grafische Benutzeroberfläche nutzt **wxPython** für ein natives Look & Feel auf Linux, macOS und Windows.
|
||||
|
||||
## GUI starten
|
||||
|
||||
Nach der Tkinter-Installation:
|
||||
|
||||
**Linux/macOS:**
|
||||
```bash
|
||||
./start_gui.sh
|
||||
@@ -40,44 +14,41 @@ Nach der Tkinter-Installation:
|
||||
Doppelklick auf start_gui.cmd
|
||||
```
|
||||
|
||||
Beim ersten Start werden `.venv`, Kern-Abhängigkeiten und `wxPython` automatisch installiert.
|
||||
|
||||
## GUI-Features
|
||||
|
||||
✨ **Drag & Drop:** Ziehen Sie PDF-Dateien direkt in die Liste (optional mit tkinterdnd2)
|
||||
✨ **Native Oberfläche:** Optisch passend zum Betriebssystem
|
||||
📋 **Mehrere PDFs:** Wählen Sie mehrere Dateien gleichzeitig
|
||||
📁 **Ausgabe-Verzeichnis:** Wählen Sie, wo die ICS-Dateien gespeichert werden
|
||||
📊 **Echtzeit-Log:** Sehen Sie den Fortschritt live
|
||||
✅ **Fortschrittsbalken:** Visuelles Feedback bei der Konvertierung
|
||||
|
||||
### Drag & Drop aktivieren (optional)
|
||||
|
||||
Für besseres Drag & Drop installieren Sie tkinterdnd2:
|
||||
|
||||
```bash
|
||||
.venv/bin/pip install tkinterdnd2
|
||||
```
|
||||
|
||||
Oder lassen Sie das Startskript es automatisch installieren.
|
||||
🖱️ **Drag & Drop:** Direkt in die PDF-Liste ziehen
|
||||
|
||||
## Fehlerbehebung
|
||||
|
||||
### "No module named 'tkinter'"
|
||||
→ Tkinter muss installiert werden (siehe oben)
|
||||
### "No module named 'wx'"
|
||||
→ `wxPython` konnte nicht installiert werden.
|
||||
|
||||
Unter Linux Mint/Ubuntu helfen häufig:
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3-dev libgtk-3-dev libglib2.0-dev libjpeg-dev libtiff-dev libpng-dev
|
||||
rm -rf .venv
|
||||
./start_gui.sh
|
||||
```
|
||||
|
||||
### GUI startet nicht
|
||||
→ Versuchen Sie:
|
||||
```bash
|
||||
rm -rf .venv
|
||||
./start_gui.sh
|
||||
```
|
||||
|
||||
### Fenster erscheint nicht
|
||||
→ Stellen Sie sicher, dass Sie eine grafische Oberfläche haben (kein SSH ohne X11)
|
||||
→ Stellen Sie sicher, dass eine grafische Sitzung aktiv ist (kein reines SSH ohne X11/Wayland-Forwarding).
|
||||
|
||||
## Alternative: CLI-Version
|
||||
|
||||
Falls Tkinter nicht installiert werden kann, nutzen Sie die CLI-Version:
|
||||
Falls keine GUI möglich ist:
|
||||
```bash
|
||||
./start.sh
|
||||
```
|
||||
|
||||
Die CLI-Version funktioniert überall ohne zusätzliche Installation! 🚀
|
||||
|
||||
43
INSTALL.md
43
INSTALL.md
@@ -14,7 +14,7 @@ Das war's! Die Anwendung erscheint nun in Ihrem Anwendungsmenü unter "PDF zu IC
|
||||
## 📋 Was macht das Installations-Script?
|
||||
|
||||
1. ✅ **Prüft Python-Installation** (Python 3.6+)
|
||||
2. ✅ **Installiert Tkinter** falls nötig (mit sudo-Berechtigung)
|
||||
2. ✅ **Installiert wxPython** in der virtuellen Umgebung
|
||||
3. ✅ **Erstellt Installationsverzeichnis** in `~/.local/share/pdf-to-ics`
|
||||
4. ✅ **Kopiert alle Dateien** ins Installationsverzeichnis
|
||||
5. ✅ **Erstellt Python Virtual Environment** mit allen Abhängigkeiten
|
||||
@@ -43,14 +43,14 @@ pdf-to-ics
|
||||
## 🔧 Systemanforderungen
|
||||
|
||||
### Unterstützte Distributionen:
|
||||
- ✅ Ubuntu / Debian (automatische Tkinter-Installation)
|
||||
- ✅ Fedora / RHEL (automatische Tkinter-Installation)
|
||||
- ✅ Arch Linux (automatische Tkinter-Installation)
|
||||
- ✅ Andere Distributionen (manuelle Tkinter-Installation erforderlich)
|
||||
- ✅ Ubuntu / Debian / Linux Mint
|
||||
- ✅ Fedora / RHEL
|
||||
- ✅ Arch Linux
|
||||
- ✅ Andere Distributionen (ggf. zusätzliche Build-Abhängigkeiten nötig)
|
||||
|
||||
### Voraussetzungen:
|
||||
- Python 3.6 oder höher
|
||||
- `sudo`-Berechtigung (für Tkinter-Installation)
|
||||
- Internetzugang für `pip install wxPython`
|
||||
- Etwa 50 MB Festplattenspeicher
|
||||
|
||||
## 📁 Installations-Pfade
|
||||
@@ -76,21 +76,12 @@ Das Deinstallations-Script entfernt:
|
||||
|
||||
## ⚠️ Fehlerbehebung
|
||||
|
||||
### "Tkinter ist nicht installiert"
|
||||
### "wxPython konnte nicht installiert werden"
|
||||
|
||||
**Ubuntu/Debian:**
|
||||
**Ubuntu/Debian/Linux Mint:**
|
||||
```bash
|
||||
sudo apt-get install python3-tk
|
||||
```
|
||||
|
||||
**Fedora:**
|
||||
```bash
|
||||
sudo dnf install python3-tkinter
|
||||
```
|
||||
|
||||
**Arch Linux:**
|
||||
```bash
|
||||
sudo pacman -S tk
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3-dev libgtk-3-dev libglib2.0-dev libjpeg-dev libtiff-dev libpng-dev
|
||||
```
|
||||
|
||||
### "pdf-to-ics: Befehl nicht gefunden"
|
||||
@@ -106,6 +97,18 @@ Dann Terminal neu laden:
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
### Windows: "python" oder "python3" wurde nicht gefunden
|
||||
|
||||
1. Installieren Sie Python 3.10+ von python.org und aktivieren Sie beim Setup **"Add Python to PATH"**.
|
||||
2. Öffnen Sie danach eine neue Eingabeaufforderung im Projektordner.
|
||||
3. Führen Sie aus:
|
||||
|
||||
```bat
|
||||
py -3 -m venv .venv --upgrade-deps
|
||||
.\.venv\Scripts\python.exe -m pip install -q pdfplumber icalendar pypdf2 pytz packaging
|
||||
.\.venv\Scripts\pythonw.exe gui_wxpython.py
|
||||
```
|
||||
|
||||
### Anwendung erscheint nicht im Menü
|
||||
|
||||
Aktualisieren Sie die Desktop-Datenbank:
|
||||
@@ -142,7 +145,7 @@ Die Installation ist nur für End-Benutzer gedacht.
|
||||
|
||||
## 🐧 Andere Betriebssysteme
|
||||
|
||||
- **Windows:** Nutzen Sie `start_gui.cmd` (keine Installation nötig)
|
||||
- **Windows:** Nutzen Sie `start_gui.cmd` (Python 3.10+ erforderlich, Einrichtung beim ersten Start erfolgt automatisch)
|
||||
- **macOS:** Nutzen Sie `start_gui.sh` (keine Installation nötig)
|
||||
|
||||
## 📞 Support
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
|
||||
**macOS/Linux:**
|
||||
```bash
|
||||
./start.sh
|
||||
./start_gui.sh
|
||||
```
|
||||
|
||||
**Windows:**
|
||||
Doppelklick auf `start.cmd`
|
||||
Doppelklick auf `start_gui.cmd` (empfohlen)
|
||||
|
||||
Beim ersten Start werden Python-Umgebung (`.venv`) und Abhängigkeiten automatisch eingerichtet.
|
||||
|
||||
Alternative (CLI): Doppelklick auf `start.cmd`
|
||||
|
||||
### 2. PDF-Dateien hinzufügen
|
||||
|
||||
@@ -19,9 +23,9 @@ Kopieren Sie Ihre Dienstplan-PDF-Dateien in dieses Verzeichnis:
|
||||
/home/sebastian/Dokumente/ICS-Import/
|
||||
```
|
||||
|
||||
### 3. Konvertieren und Importieren
|
||||
## 3. Konvertieren und Importieren
|
||||
|
||||
Im Menü wählen Sie Option "1. PDF(s) konvertieren" und die ICS-Dateien werden automatisch erstellt.
|
||||
In der GUI auf "ICS Datei erstellen" klicken. Die ICS-Dateien werden dann automatisch erstellt.
|
||||
|
||||
---
|
||||
|
||||
|
||||
302
README.md
302
README.md
@@ -1,210 +1,158 @@
|
||||
# PDF zu ICS Konverter - Dienstplan Importer
|
||||
|
||||
Dieses Tool extrahiert Kalenderdaten aus Dienstplan-PDFs und konvertiert sie in das iCalendar-Format (ICS), das von den meisten Kalenderanwendungen importiert werden kann.
|
||||
Dieses Tool extrahiert Kalenderdaten aus Dienstplan-PDFs und konvertiert sie in das iCalendar-Format (ICS), das in gängigen Kalender-Apps importiert werden kann.
|
||||
|
||||
## 🎯 Zwei Versionen verfügbar
|
||||
## 🎯 Varianten
|
||||
|
||||
### 1. **GUI-Version** (Grafische Oberfläche) - Empfohlen!
|
||||
Benutzerfreundliche grafische Oberfläche mit Drag & Drop Support.
|
||||
### 1) GUI (empfohlen)
|
||||
Native Oberfläche mit wxPython:
|
||||
|
||||
```bash
|
||||
./start_gui.sh
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- ✨ Drag & Drop für PDF-Dateien
|
||||
- 📋 Mehrere PDFs gleichzeitig verarbeiten
|
||||
- 📁 Ausgabe-Verzeichnis frei wählbar
|
||||
- 📊 Live-Log und Fortschrittsanzeige
|
||||
- 💾 Merkt sich letzte Verzeichnisse
|
||||
**Highlights:**
|
||||
- Drag & Drop für PDFs
|
||||
- Mehrere PDFs gleichzeitig
|
||||
- Frei wählbares Ausgabe-Verzeichnis
|
||||
- Live-Log mit Fortschritt
|
||||
- Optionale Filter:
|
||||
- Ruhetage ausschließen
|
||||
- Urlaub (060/0060) ausschließen
|
||||
|
||||
**Voraussetzung:** Tkinter muss installiert sein (siehe [GUI_README.md](GUI_README.md))
|
||||
|
||||
### 2. **CLI-Version** (Kommandozeile)
|
||||
Textbasiertes Menü für die Kommandozeile.
|
||||
### 2) CLI
|
||||
Interaktives Textmenü:
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- ⚡ Funktioniert überall ohne zusätzliche Abhängigkeiten
|
||||
- 🔄 Automatische Verarbeitung aller PDFs im Verzeichnis
|
||||
- 📝 Textbasiertes interaktives Menü
|
||||
---
|
||||
|
||||
## Features
|
||||
## ⚡ Schnellstart (60 Sekunden)
|
||||
|
||||
✅ Extrahiert Dienstplan-Informationen aus PDFs
|
||||
✅ Erkennt Schicht-Zeitangaben (z.B. 04:51-15:46)
|
||||
✅ Handhabt Nachtschichten korrekt (über Mitternacht hinaus)
|
||||
✅ Erstellt Standard-konforme ICS-Dateien
|
||||
✅ Unterstützt mehrere PDFs gleichzeitig
|
||||
✅ GUI mit Drag & Drop (optional)
|
||||
✅ CLI-Menü für schnelle Nutzung
|
||||
1. GUI starten (`./start_gui.sh` oder `start_gui.cmd` unter Windows)
|
||||
2. PDF-Dateien hinzufügen
|
||||
3. Optional Filter aktivieren
|
||||
4. Auf **"ICS Datei erstellen"** klicken
|
||||
|
||||
## Installation
|
||||
### Schnellstart (Empfohlen)
|
||||
---
|
||||
|
||||
## 🧩 Installation nach Betriebssystem
|
||||
|
||||
### Linux (Ubuntu/Debian/Mint)
|
||||
|
||||
**Für GUI-Version:**
|
||||
```bash
|
||||
./start_gui.sh
|
||||
```
|
||||
Siehe [GUI_README.md](GUI_README.md) für Tkinter-Installation.
|
||||
|
||||
**Für CLI-Version:**
|
||||
Beim ersten Start wird automatisch `.venv` erstellt und alles installiert.
|
||||
|
||||
Wenn `wxPython` nicht installiert werden kann, helfen häufig:
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
```GUI-Version (Empfohlen)
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3-dev libgtk-3-dev libglib2.0-dev libjpeg-dev libtiff-dev libpng-dev
|
||||
```
|
||||
|
||||
1. Starten Sie die GUI:
|
||||
Für systemweite Installation mit Menüeintrag siehe [INSTALL.md](INSTALL.md).
|
||||
|
||||
### macOS
|
||||
|
||||
```bash
|
||||
./start_gui.sh
|
||||
```
|
||||
|
||||
Beim ersten Start wird `.venv` erstellt und die Abhängigkeiten werden installiert.
|
||||
|
||||
### Windows
|
||||
|
||||
1. Python 3.10+ installieren (Option **Add Python to PATH** aktivieren)
|
||||
2. `start_gui.cmd` per Doppelklick starten
|
||||
|
||||
Beim ersten Start wird `.venv` automatisch eingerichtet.
|
||||
|
||||
---
|
||||
|
||||
## 🧱 Standalone-Apps (ohne Python beim Endnutzer)
|
||||
|
||||
Für Build/Packaging auf Linux, macOS und Windows:
|
||||
|
||||
- [BUILD_STANDALONE.md](BUILD_STANDALONE.md)
|
||||
|
||||
Dort enthalten:
|
||||
- Build-Skripte pro OS
|
||||
- Packaging-Skripte für Release-Artefakte
|
||||
- empfohlene Release-Reihenfolge
|
||||
|
||||
---
|
||||
|
||||
## 🖥️ CLI-Nutzung
|
||||
|
||||
### Beispiele
|
||||
|
||||
```bash
|
||||
# Alle PDFs im aktuellen Verzeichnis konvertieren
|
||||
python3 pdf_to_ics.py
|
||||
|
||||
# Input/Output-Verzeichnis setzen
|
||||
python3 pdf_to_ics.py --input ./pdfs --output ./ics_dateien
|
||||
|
||||
# Ruhetage ausschließen
|
||||
python3 pdf_to_ics.py --exclude-rest
|
||||
|
||||
# Urlaub (060/0060) ausschließen
|
||||
python3 pdf_to_ics.py --exclude-vacation
|
||||
|
||||
# Einzelne PDF-Datei
|
||||
python3 pdf_to_ics.py /pfad/zur/datei.pdf
|
||||
```
|
||||
|
||||
### Optionen
|
||||
|
||||
| Option | Kurzform | Beschreibung |
|
||||
|--------|----------|-------------|
|
||||
| `--input DIR` | `-i` | Eingabe-Verzeichnis mit PDF-Dateien (Standard: aktuelles Verzeichnis) |
|
||||
| `--output DIR` | `-o` | Ausgabe-Verzeichnis für ICS-Dateien (Standard: Eingabe-Verzeichnis) |
|
||||
| `--exclude-rest` | `-e` | Ruhetage ausschließen (Ruhe, R56, R36, vRWF48, RWE, vR48) |
|
||||
| `--exclude-vacation` | `-u` | Urlaub ausschließen (060, 0060) |
|
||||
| `--verbose` | `-v` | Detaillierte Ausgabe |
|
||||
| `--help` | `-h` | Hilfe anzeigen |
|
||||
|
||||
---
|
||||
|
||||
## 📅 ICS-Import
|
||||
|
||||
Die erzeugten `.ics`-Dateien lassen sich u. a. in folgende Kalender importieren:
|
||||
- Outlook
|
||||
- Google Kalender
|
||||
- Apple Kalender
|
||||
- Thunderbird
|
||||
- LibreOffice
|
||||
- Android-Kalender-Apps
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Fehlerbehebung
|
||||
|
||||
- **Keine Events gefunden:** PDF-Layout prüfen
|
||||
- **GUI startet nicht:** `.venv` löschen und neu starten
|
||||
```bash
|
||||
rm -rf .venv
|
||||
./start_gui.sh
|
||||
```
|
||||
|
||||
2. Fügen Sie PDF-Dateien hinzu:
|
||||
- Klicken Sie auf "➕ PDF hinzufügen", oder
|
||||
- Ziehen Sie PDF-Dateien in die Liste (Drag & Drop)
|
||||
|
||||
**Interaktives Menü:**
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
```
|
||||
|
||||
Dann wählen Sie im Menü die gewünschte Option.
|
||||
|
||||
### Erweiterte Nutzung (Python-Modul)abe-Verzeichnis (optional)
|
||||
|
||||
4. Klicken Sie auf "📄 ICS Datei erstellen"
|
||||
|
||||
Die GUI merkt sich Ihre letzten Verzeichnisse für schnelleren Zugriff!
|
||||
|
||||
### CLI-Version
|
||||
|
||||
**Schnellstart:**
|
||||
|
||||
Beide Skripte erstellen automatisch eine Python Virtual Environment und installieren alle benötigten Abhängigkeiten.
|
||||
|
||||
### Manuelle Installation
|
||||
|
||||
|
||||
Die erforderlichen Dependencies sind bereits installiert. Falls Sie das Projekt neu einrichten:
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install pdfplumber icalendar pypdf2 pytz
|
||||
```
|
||||
|
||||
## Verwendung
|
||||
|
||||
### Schnellstart
|
||||
|
||||
1. Kopieren Sie Ihre Dienstplan-PDF-Dateien in dieses Verzeichnis
|
||||
2. Führen Sie das Skript aus:
|
||||
|
||||
```bash
|
||||
python3 pdf_to_ics.py
|
||||
```
|
||||
|
||||
Das Tool findet automatisch alle `.pdf` Dateien und erstellt entsprechende `.ics` Dateien.
|
||||
|
||||
### Erweiterte Nutzung
|
||||
|
||||
Sie können auch direkt mit dem Python-Modul arbeiten:
|
||||
|
||||
```python
|
||||
from pdf_to_ics import extract_dienstplan_data, create_ics_from_dienstplan
|
||||
|
||||
# PDF verarbeiten
|
||||
dienstplan = extract_dienstplan_data('meine_pdf.pdf')
|
||||
|
||||
# ICS erstellen
|
||||
create_ics_from_dienstplan(dienstplan, 'mein_kalender.ics')
|
||||
```
|
||||
|
||||
## Dateiformat
|
||||
|
||||
### ICS-Datei importieren
|
||||
|
||||
Die erstellte `.ics` Datei kann in folgende Kalenderanwendungen importiert werden:
|
||||
|
||||
- **Outlook**: Datei → Öffnen und exportieren → Importieren
|
||||
- **Google Kalender**: Einstellungen → Kalender importieren
|
||||
- **iCal/macOS**: Doppelklick auf die .ics Datei
|
||||
- **Thunderbird**: Kalender → Kalender importieren
|
||||
- **Android**: Mit einer Kalender-App öffnen
|
||||
- **LibreOffice**: Datei → Öffnen
|
||||
|
||||
## Struktur der extrahierten Daten
|
||||
|
||||
Das Tool extrahiert folgende Informationen aus der PDF:
|
||||
|
||||
- **Name und Personalnummer**: Des Mitarbeiters
|
||||
- **Betriebshof**: Standort
|
||||
- **Sollarbeitszeit**: Gewünschte Arbeitszeit pro Monat
|
||||
- **Events**: Einzelne Schichten mit:
|
||||
- Datum
|
||||
- Dienstart (z.B. "36234", "Ruhe", "Dispo")
|
||||
- Zeitangabe (falls vorhanden)
|
||||
|
||||
## Output
|
||||
|
||||
Für jede verarbeitete PDF wird eine entsprechende ICS-Datei erstellt:
|
||||
|
||||
```
|
||||
2026-02-23 DB Köhler00100718_März2026.pdf → 2026-02-23 DB Köhler00100718_März2026.ics
|
||||
```
|
||||
|
||||
Die ICS-Datei enthält ein Event für jeden Arbeitstag mit:
|
||||
- **Titel**: Name - Dienstart
|
||||
- **Beschreibung**: Dienstart und Betriebshof
|
||||
- **Zeit**: Mit aktueller Zeitzone (Europe/Berlin)
|
||||
|
||||
## Fehlerbehebung
|
||||
|
||||
### Keine Events gefunden?
|
||||
- Stellen Sie sicher, dass die PDF das erwartete Tabellenformat hat
|
||||
- Überprüfen Sie die Dateiname und die PDF-Struktur
|
||||
|
||||
### Zeitzone falsch?
|
||||
- Die aktuelle Einstellung ist Europe/Berlin
|
||||
- Zum Ändern: Bearbeiten Sie die Zeile in `pdf_to_ics.py`:
|
||||
```python
|
||||
tz = pytz.timezone('Europe/Berlin') # Ändern SIe diesen Wert
|
||||
```
|
||||
|
||||
## Technische Details
|
||||
|
||||
### Projektstruktur
|
||||
|
||||
```
|
||||
ICS-Import/
|
||||
├── pdf_to_ics.py # Core-Konvertierungslogik
|
||||
├── gui.py # GUI-Version (Tkinter)
|
||||
├── menu.py # CLI-Menü
|
||||
├── start_gui.sh/cmd # GUI-Startskripte
|
||||
├── start.sh/cmd # CLI-Startskripte
|
||||
├── README.md # Diese Datei
|
||||
└── GUI_README.md # GUI-spezifische Dokumentation
|
||||
```
|
||||
|
||||
### Technische Spezifikationen
|
||||
|
||||
- **Abhängigkeiten**: pdfplumber, icalendar, pytz, pypdf2
|
||||
- **Optional für GUI**: tkinter (Python-Standard), tkinterdnd2 (Drag & Drop)
|
||||
- **Python-Version**: 3.6+
|
||||
- **Format**: iCalendar 2.0 (RFC 5545)
|
||||
- **Konfiguration**: `~/.pdf_to_ics_config.json` (GUI-Einstellungen)
|
||||
|
||||
## Lizenz
|
||||
|
||||
Dieses Tool ist zur privaten Verwendung gedacht.
|
||||
- **Zeitzone ändern:** in `pdf_to_ics.py` den Wert `Europe/Berlin` anpassen
|
||||
|
||||
---
|
||||
|
||||
## 📚 Weitere Dokumentation
|
||||
|
||||
- **[GUI_README.md](GUI_README.md)** - Ausführliche GUI-Dokumentation und Tkinter-Installation
|
||||
- **[QUICKSTART.md](QUICKSTART.md)** - Schnellanleitung für den Import in verschiedene Kalender
|
||||
- **[ZUSAMMENFASSUNG.md](ZUSAMMENFASSUNG.md)** - Projekt-Übersicht und technische Details
|
||||
- [INSTALL.md](INSTALL.md) - Linux-Installation mit Menüeintrag
|
||||
- [WXPYTHON_README.md](WXPYTHON_README.md) - wxPython-spezifische Hinweise
|
||||
- [BUILD_STANDALONE.md](BUILD_STANDALONE.md) - Standalone-Builds/Packaging
|
||||
- [QUICKSTART.md](QUICKSTART.md) - Kurzanleitung Kalender-Import
|
||||
- [ZUSAMMENFASSUNG.md](ZUSAMMENFASSUNG.md) - Projekt- und Changelog-Übersicht
|
||||
|
||||
## Lizenz
|
||||
|
||||
Dieses Tool ist zur privaten Verwendung gedacht.
|
||||
|
||||
@@ -74,9 +74,10 @@ sudo apt install python3 python3-pip python3-venv
|
||||
|
||||
### Die Anwendung startet nicht
|
||||
|
||||
Prüfen Sie, ob Tkinter installiert ist:
|
||||
Prüfen Sie, ob wxPython-Build-Abhängigkeiten installiert sind:
|
||||
```bash
|
||||
sudo apt install python3-tk
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3-dev libgtk-3-dev libglib2.0-dev libjpeg-dev libtiff-dev libpng-dev
|
||||
```
|
||||
|
||||
## 📞 Weitere Hilfe
|
||||
|
||||
287
WXPYTHON_README.md
Normal file
287
WXPYTHON_README.md
Normal file
@@ -0,0 +1,287 @@
|
||||
# wxPython GUI - PDF zu ICS Konverter
|
||||
|
||||
Native GUI-Lösung mit **wxPython** - funktioniert zuverlässig auf macOS 13.6, Windows und Linux.
|
||||
|
||||
## ✅ Warum wxPython?
|
||||
|
||||
Nach den Problemen mit BeeWare/Toga (macOS 13.7+ erforderlich) ist wxPython die perfekte Lösung:
|
||||
|
||||
| Feature | BeeWare/Toga | **wxPython** |
|
||||
|---------|--------------|--------------|
|
||||
| Native auf macOS | ✅ (nur 13.7+) | ✅ **Alle Versionen** |
|
||||
| Native auf Windows | ✅ | ✅ |
|
||||
| Native auf Linux | ✅ | ✅ |
|
||||
| Stabilität | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
|
||||
| Look & Feel | Modern | **Perfekt nativ** |
|
||||
| macOS 13.6 Support | ❌ | ✅ |
|
||||
| Installation | Kompliziert | Einfach |
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Installation
|
||||
|
||||
```bash
|
||||
cd /Users/sebastian/PDFTOICS/pdf_to_ics
|
||||
python3 -m pip install wxPython
|
||||
```
|
||||
|
||||
**Dependencies werden automatisch installiert:**
|
||||
- wxPython 4.2+
|
||||
- numpy (für wxPython)
|
||||
- Alle anderen sind bereits vorhanden (pdfplumber, icalendar, etc.)
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Starten
|
||||
|
||||
```bash
|
||||
cd /Users/sebastian/PDFTOICS/pdf_to_ics
|
||||
python3 gui_wxpython.py
|
||||
```
|
||||
|
||||
Die App startet sofort mit **nativen macOS-Widgets**! 🎉
|
||||
|
||||
---
|
||||
|
||||
## 📊 Features
|
||||
|
||||
### ✅ Vollständig implementiert:
|
||||
|
||||
1. **PDF-Verwaltung**
|
||||
- Mehrfach-Auswahl über nativen macOS File Dialog
|
||||
- Drag & Drop (automatisch durch wxPython)
|
||||
- PDFs entfernen/löschen
|
||||
|
||||
2. **Ausgabeverzeichnis**
|
||||
- Nativer Directory Picker
|
||||
- Merkt letztes Verzeichnis
|
||||
|
||||
3. **Exportoptionen**
|
||||
- Checkbox für "Ruhetage ausschließen"
|
||||
- Checkbox für "Urlaub ausschließen (060, 0060)"
|
||||
- Speichert Einstellung persistent
|
||||
|
||||
4. **Konvertierung**
|
||||
- Threading (blockiert UI nicht)
|
||||
- Progress-Logging in Echtzeit
|
||||
- Erfolgs-Dialog nach Abschluss
|
||||
|
||||
5. **Menüleiste**
|
||||
- "Hilfe" → Android-Export-Anleitung
|
||||
- "Über dieses Programm"
|
||||
- Beenden (Cmd+Q)
|
||||
|
||||
6. **Update-Checker**
|
||||
- Automatische Update-Prüfung beim Start
|
||||
- Dialog wenn neues Update verfügbar
|
||||
|
||||
7. **Konfiguration**
|
||||
- Speichert automatisch Einstellungen
|
||||
- `~/.pdf_to_ics_config.json`
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Look & Feel
|
||||
|
||||
### macOS 13.6
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ Datei Bearbeiten Hilfe │ ← Native macOS Menu Bar
|
||||
├─────────────────────────────────────┤
|
||||
│ 📅 PDF zu ICS Konverter │ ← Dunkler Header
|
||||
├─────────────────────────────────────┤
|
||||
│ PDF-Dateien: │
|
||||
│ ┌─────────────────────────────────┐ │
|
||||
│ │ ☑ dienstplan_januar.pdf │ │ ← Native ListBox
|
||||
│ │ ☑ dienstplan_februar.pdf │ │
|
||||
│ └─────────────────────────────────┘ │
|
||||
│ [➕ Hinzufügen] [➖ Entfernen] [...] │ ← Native Buttons
|
||||
├─────────────────────────────────────┤
|
||||
│ Ausgabe-Verzeichnis: │
|
||||
│ [/Users/sebastian/Documents ] 📁 │ ← Native TextCtrl
|
||||
├─────────────────────────────────────┤
|
||||
│ ☐ Ruhetage ausschließen │ ← Native CheckBox
|
||||
│ ☐ Urlaub ausschließen (060) │ ← Native CheckBox
|
||||
├─────────────────────────────────────┤
|
||||
│ Status: │
|
||||
│ ┌─────────────────────────────────┐ │
|
||||
│ │ [10:30:15] ✓ 2 PDFs hinzugefügt│ │ ← Log Output
|
||||
│ │ [10:30:20] 🔄 Starte... │ │
|
||||
│ └─────────────────────────────────┘ │
|
||||
│ │
|
||||
│ [📄 ICS Datei erstellen] │ ← Grüner Button
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Sieht exakt wie eine native macOS-App aus!** 🎨
|
||||
|
||||
---
|
||||
|
||||
## 🔧 wxPython APIs im Überblick
|
||||
|
||||
### 1. Event Handling
|
||||
```python
|
||||
btn = wx.Button(panel, label="Klick")
|
||||
btn.Bind(wx.EVT_BUTTON, self.on_click)
|
||||
```
|
||||
|
||||
### 2. Layout
|
||||
```python
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(widget, 1, wx.EXPAND)
|
||||
panel.SetSizer(sizer)
|
||||
```
|
||||
|
||||
### 3. Threading + UI
|
||||
```python
|
||||
wx.CallAfter(self.log_text.AppendText, "Message\n")
|
||||
```
|
||||
|
||||
### 4. Dialog
|
||||
```python
|
||||
with wx.FileDialog(...) as dialog:
|
||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||
return
|
||||
paths = dialog.GetPaths()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💡 Vorteile von wxPython
|
||||
|
||||
### ✅ Native Widgets
|
||||
- Nutzt echte **Cocoa** auf macOS
|
||||
- Nutzt echte **Win32** auf Windows
|
||||
- Nutzt **GTK** auf Linux
|
||||
|
||||
### ✅ Drag & Drop
|
||||
Funktioniert automatisch! Keine extra Implementierung nötig:
|
||||
```python
|
||||
# Drag PDF-Dateien direkt auf die Listbox
|
||||
self.pdf_listbox = wx.ListBox(panel, style=wx.LB_EXTENDED)
|
||||
# wxPython handled DnD automatisch!
|
||||
```
|
||||
|
||||
### ✅ Bessere Performance
|
||||
- Schnelle native Darstellung
|
||||
- Native Controls = weniger CPU
|
||||
|
||||
### ✅ Moderne Features
|
||||
- Transparenz
|
||||
- Native Notifications
|
||||
- Statusbar
|
||||
- Toolbar
|
||||
- Split Windows
|
||||
|
||||
### ✅ Dark Mode Support
|
||||
Automatisch! wxPython folgt dem System-Theme.
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing Checklist
|
||||
|
||||
Jetzt testen:
|
||||
|
||||
```bash
|
||||
cd /Users/sebastian/PDFTOICS/pdf_to_ics
|
||||
python3 gui_wxpython.py
|
||||
```
|
||||
|
||||
**Checklist:**
|
||||
- [ ] App startet ohne Fehler
|
||||
- [ ] Fenster sieht nativ aus (perfektes macOS Look & Feel)
|
||||
- [ ] "PDF hinzufügen" öffnet nativen macOS Dialog
|
||||
- [ ] Mehrere PDFs können ausgewählt werden
|
||||
- [ ] PDFs erscheinen in der Liste
|
||||
- [ ] "Entfernen" funktioniert
|
||||
- [ ] "Alle entfernen" funktioniert
|
||||
- [ ] "Durchsuchen" für Ausgabe-Verzeichnis funktioniert
|
||||
- [ ] Checkbox "Ruhetage" funktioniert
|
||||
- [ ] Checkbox "Urlaub ausschließen (060)" funktioniert
|
||||
- [ ] "ICS Datei erstellen" startet Konvertierung
|
||||
- [ ] Log zeigt Status in Echtzeit
|
||||
- [ ] Nach Konvertierung: Erfolgs-Dialog
|
||||
- [ ] Menü "Hilfe" → "Android-Anleitung" funktioniert
|
||||
- [ ] Menü "Über" zeigt About-Dialog
|
||||
- [ ] Einstellungen werden gespeichert (nach Neustart testen)
|
||||
|
||||
---
|
||||
|
||||
## 📈 Migration auf wxPython
|
||||
|
||||
### Was blieb gleich:
|
||||
- Threading-Logik
|
||||
- PDF-Parsing mit pdfplumber
|
||||
- ICS-Erstellung mit icalendar
|
||||
- Config-Speicherung (JSON)
|
||||
|
||||
### Was wurde verbessert:
|
||||
- ✅ Nativer Look & Feel (statt blechig)
|
||||
- ✅ Bessere Farben / Styling
|
||||
- ✅ Automatisches Drag & Drop
|
||||
- ✅ Native Menüleiste (statt Popup)
|
||||
- ✅ Native Dialoge (About, File, Directory)
|
||||
- ✅ Thread-sicheres UI-Update mit `wx.CallAfter`
|
||||
|
||||
### Status
|
||||
- ✅ GUI-Start erfolgt über `start_gui.sh` / `start_gui.cmd`
|
||||
- ✅ GUI-Einstiegspunkt ist `gui_wxpython.py`
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Nächste Schritte (optional)
|
||||
|
||||
### 1. Packaging mit PyInstaller
|
||||
```bash
|
||||
pip install pyinstaller
|
||||
pyinstaller --onefile --windowed gui_wxpython.py
|
||||
```
|
||||
→ Erstellt `.app` Bundle für macOS!
|
||||
|
||||
### 2. Weitere Features
|
||||
- Icon hinzufügen
|
||||
- Statusbar mit Progress
|
||||
- Toolbar mit Icons
|
||||
- Preferences-Dialog
|
||||
- Drag & Drop direkt auf Window
|
||||
|
||||
---
|
||||
|
||||
## 🆚 Plattformstatus
|
||||
|
||||
| Kriterium | wxPython |
|
||||
|-----------|----------|
|
||||
| **Look auf macOS** | ✅ **Perfekt nativ** |
|
||||
| **Menüleiste** | ✅ **Native MenuBar** |
|
||||
| **File Dialoge** | ✅ **Perfekt nativ** |
|
||||
| **Thread-Safety** | ✅ **wx.CallAfter** |
|
||||
| **Installation** | ⚠️ Pip install |
|
||||
| **Bundle-Größe** | ⚠️ Größer (~20MB) |
|
||||
| **macOS 13.6 Support** | ✅ **Ja!** |
|
||||
| **Dark Mode** | ✅ **Automatisch** |
|
||||
|
||||
---
|
||||
|
||||
## 📚 Ressourcen
|
||||
|
||||
- [wxPython Dokumentation](https://docs.wxpython.org/)
|
||||
- [wxPython Phoenix Docs](https://wxpython.org/Phoenix/docs/html/index.html)
|
||||
- [Widget Gallery](https://docs.wxpython.org/gallery.html)
|
||||
- [Tutorial](https://wxpython.org/pages/overview/)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Fazit
|
||||
|
||||
**wxPython ist die perfekte Lösung für Ihr Projekt:**
|
||||
|
||||
1. ✅ Funktioniert auf macOS 13.6 (im Gegensatz zu Toga)
|
||||
2. ✅ Perfekter nativer Look & Feel
|
||||
3. ✅ Keine Versionskonflikte
|
||||
4. ✅ Stabil und production-ready
|
||||
5. ✅ Einheitlicher GUI-Stack mit wxPython
|
||||
6. ✅ Alle Features vollständig implementiert
|
||||
|
||||
**Status:** 🎉 **PRODUCTION READY!**
|
||||
|
||||
Viel Erfolg mit der nativen GUI!
|
||||
@@ -98,7 +98,7 @@ Doppelklick auf start.cmd
|
||||
## 🔧 Technische Details
|
||||
|
||||
- **Sprache:** Python 3.6+
|
||||
- **Abhängigkeiten:** pdfplumber, icalendar, pytz, pypdf2
|
||||
- **Abhängigkeiten:** pdfplumber, icalendar, pytz, pypdf2, packaging
|
||||
- **Format:** iCalendar 2.0 (RFC 5545)
|
||||
- **Umgebung:** Python virtual environment (.venv)
|
||||
|
||||
@@ -108,6 +108,7 @@ pdfplumber==0.10.0+ - PDF-Datenextraktion
|
||||
icalendar==5.0.0+ - ICS-Datei-Erstellung
|
||||
pytz - Zeitzonenverwaltung
|
||||
pypdf2 - PDF-Parsing
|
||||
packaging - Versionsvergleich
|
||||
```
|
||||
|
||||
---
|
||||
@@ -161,6 +162,39 @@ Jedes Event in der ICS-Datei:
|
||||
|
||||
---
|
||||
|
||||
## 📝 Changelog (März 2026)
|
||||
|
||||
### v1.2.2
|
||||
|
||||
- README grundlegend strukturiert und bereinigt
|
||||
- Installationshinweise nach Betriebssystem ergänzt (Linux, macOS, Windows)
|
||||
- Standalone-Hinweise im README klar hervorgehoben
|
||||
- Schnellstart und Troubleshooting kompakter und ohne Redundanzen
|
||||
|
||||
### v1.2.1
|
||||
|
||||
- Standalone-Build-Workflow mit PyInstaller ergänzt (`build/build_*.{sh,cmd}`)
|
||||
- Packaging-Skripte für Release-Artefakte ergänzt:
|
||||
- Linux: `.tar.gz`
|
||||
- macOS: `.zip`
|
||||
- Windows: `.zip`
|
||||
- Neue Build-Dokumentation `BUILD_STANDALONE.md`
|
||||
- `.gitignore` um Build-Artefakte erweitert (`dist/`, `release/`, `*.spec`, `build/PDFtoICS/`)
|
||||
|
||||
### v1.2.0
|
||||
|
||||
- GUI-Technik vollständig auf **wxPython** umgestellt
|
||||
- Standard-Startpfade auf `gui_wxpython.py` angepasst (`start_gui.sh`, `start_gui.cmd`, `install.sh`)
|
||||
- Linux-Hinweise für wxPython-Build-Abhängigkeiten ergänzt
|
||||
- Alte Tkinter-GUI-Datei `gui.py` entfernt
|
||||
- Neue Exportoption ergänzt: **Urlaub ausschließen (060/0060)**
|
||||
- GUI: zusätzliche Checkbox
|
||||
- CLI: `--exclude-vacation` / `-u`
|
||||
- Core-Logik: Urlaubseinträge werden optional nicht in ICS exportiert
|
||||
- Dokumentation konsolidiert und auf wxPython-only aktualisiert
|
||||
|
||||
---
|
||||
|
||||
## 📞 Support
|
||||
|
||||
Für detaillierte Informationen:
|
||||
@@ -174,5 +208,5 @@ Für detaillierte Informationen:
|
||||
|
||||
Ihr System ist bereit. Viel Erfolg mit der Dienstplan-Verwaltung! 📅✨
|
||||
|
||||
**Letzte Änderung:** 23. Februar 2026
|
||||
**Letzte Änderung:** 2. März 2026
|
||||
**Status:** ✅ Einsatzbereit
|
||||
|
||||
27
build/build_linux.sh
Executable file
27
build/build_linux.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
PYTHON_BIN="${PYTHON_BIN:-.venv/bin/python}"
|
||||
|
||||
if [ ! -x "$PYTHON_BIN" ]; then
|
||||
echo "❌ Python nicht gefunden: $PYTHON_BIN"
|
||||
echo "💡 Erwartet wird eine Virtual Environment unter .venv"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🐧 Erstelle Linux-Standalone mit PyInstaller..."
|
||||
"$PYTHON_BIN" -m pip install --upgrade pip pyinstaller
|
||||
|
||||
"$PYTHON_BIN" -m PyInstaller \
|
||||
--noconfirm \
|
||||
--clean \
|
||||
--name "PDFtoICS" \
|
||||
--windowed \
|
||||
--add-data "version.txt:." \
|
||||
gui_wxpython.py
|
||||
|
||||
echo "✅ Fertig: dist/PDFtoICS"
|
||||
27
build/build_macos.sh
Normal file
27
build/build_macos.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
PYTHON_BIN="${PYTHON_BIN:-.venv/bin/python}"
|
||||
|
||||
if [ ! -x "$PYTHON_BIN" ]; then
|
||||
echo "❌ Python nicht gefunden: $PYTHON_BIN"
|
||||
echo "💡 Erwartet wird eine Virtual Environment unter .venv"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🍎 Erstelle macOS-Standalone mit PyInstaller..."
|
||||
"$PYTHON_BIN" -m pip install --upgrade pip pyinstaller
|
||||
|
||||
"$PYTHON_BIN" -m PyInstaller \
|
||||
--noconfirm \
|
||||
--clean \
|
||||
--name "PDFtoICS" \
|
||||
--windowed \
|
||||
--add-data "version.txt:." \
|
||||
gui_wxpython.py
|
||||
|
||||
echo "✅ Fertig: dist/PDFtoICS.app"
|
||||
24
build/build_windows.cmd
Normal file
24
build/build_windows.cmd
Normal file
@@ -0,0 +1,24 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
cd /d "%~dp0\.."
|
||||
|
||||
set "PYTHON_BIN=.venv\Scripts\python.exe"
|
||||
if not exist "%PYTHON_BIN%" (
|
||||
echo ❌ Python nicht gefunden: %PYTHON_BIN%
|
||||
echo 💡 Erwartet wird eine Virtual Environment unter .venv
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo 🪟 Erstelle Windows-Standalone mit PyInstaller...
|
||||
"%PYTHON_BIN%" -m pip install --upgrade pip pyinstaller
|
||||
|
||||
"%PYTHON_BIN%" -m PyInstaller ^
|
||||
--noconfirm ^
|
||||
--clean ^
|
||||
--name "PDFtoICS" ^
|
||||
--windowed ^
|
||||
--add-data "version.txt;." ^
|
||||
gui_wxpython.py
|
||||
|
||||
echo ✅ Fertig: dist\PDFtoICS\PDFtoICS.exe
|
||||
24
build/package_linux.sh
Executable file
24
build/package_linux.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
APP_DIR="dist/PDFtoICS"
|
||||
VERSION="$(tr -d '[:space:]' < version.txt)"
|
||||
OUT_DIR="release"
|
||||
ARCHIVE_NAME="PDFtoICS-linux-v${VERSION}.tar.gz"
|
||||
|
||||
if [ ! -d "$APP_DIR" ]; then
|
||||
echo "❌ Build-Ordner nicht gefunden: $APP_DIR"
|
||||
echo "💡 Bitte zuerst ausführen: ./build/build_linux.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
echo "📦 Erstelle Archiv: $OUT_DIR/$ARCHIVE_NAME"
|
||||
tar -czf "$OUT_DIR/$ARCHIVE_NAME" -C dist PDFtoICS
|
||||
|
||||
echo "✅ Fertig: $OUT_DIR/$ARCHIVE_NAME"
|
||||
25
build/package_macos.sh
Normal file
25
build/package_macos.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
APP_BUNDLE="dist/PDFtoICS.app"
|
||||
VERSION="$(tr -d '[:space:]' < version.txt)"
|
||||
OUT_DIR="release"
|
||||
ARCHIVE_NAME="PDFtoICS-macos-v${VERSION}.zip"
|
||||
|
||||
if [ ! -d "$APP_BUNDLE" ]; then
|
||||
echo "❌ App-Bundle nicht gefunden: $APP_BUNDLE"
|
||||
echo "💡 Bitte zuerst ausführen: ./build/build_macos.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
echo "📦 Erstelle Archiv: $OUT_DIR/$ARCHIVE_NAME"
|
||||
rm -f "$OUT_DIR/$ARCHIVE_NAME"
|
||||
(cd dist && zip -r "../$OUT_DIR/$ARCHIVE_NAME" "PDFtoICS.app" >/dev/null)
|
||||
|
||||
echo "✅ Fertig: $OUT_DIR/$ARCHIVE_NAME"
|
||||
27
build/package_windows.cmd
Normal file
27
build/package_windows.cmd
Normal file
@@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
cd /d "%~dp0\.."
|
||||
|
||||
set /p VERSION=<version.txt
|
||||
set "VERSION=%VERSION: =%"
|
||||
|
||||
if not exist "dist\PDFtoICS\PDFtoICS.exe" (
|
||||
echo ❌ Build-Ausgabe nicht gefunden: dist\PDFtoICS\PDFtoICS.exe
|
||||
echo 💡 Bitte zuerst ausfuehren: build\build_windows.cmd
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "release" mkdir release
|
||||
|
||||
set "ARCHIVE=release\PDFtoICS-windows-v%VERSION%.zip"
|
||||
if exist "%ARCHIVE%" del /q "%ARCHIVE%"
|
||||
|
||||
echo 📦 Erstelle Archiv: %ARCHIVE%
|
||||
powershell -NoProfile -Command "Compress-Archive -Path 'dist\PDFtoICS\*' -DestinationPath '%ARCHIVE%'"
|
||||
if errorlevel 1 (
|
||||
echo ❌ Konnte Archiv nicht erstellen
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo ✅ Fertig: %ARCHIVE%
|
||||
497
gui.py
497
gui.py
@@ -1,497 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
GUI für PDF zu ICS Konverter
|
||||
Grafische Benutzeroberfläche mit Tkinter
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import ttk, filedialog, messagebox, scrolledtext
|
||||
from pathlib import Path
|
||||
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:
|
||||
from tkinterdnd2 import DND_FILES, TkinterDnD
|
||||
HAS_TKINTERDND = True
|
||||
except ImportError:
|
||||
HAS_TKINTERDND = False
|
||||
|
||||
# Konfigurationsdatei
|
||||
CONFIG_FILE = Path.home() / '.pdf_to_ics_config.json'
|
||||
|
||||
|
||||
class PDFtoICSGUI:
|
||||
def __init__(self, root):
|
||||
self.root = root
|
||||
self.root.title("PDF zu ICS Konverter - Dienstplan Importer")
|
||||
self.root.geometry("800x600")
|
||||
self.root.minsize(700, 500)
|
||||
|
||||
# Lade gespeicherte Einstellungen
|
||||
self.config = self.load_config()
|
||||
|
||||
# Variablen
|
||||
self.pdf_files = []
|
||||
|
||||
# Nutze letztes Ausgabeverzeichnis oder Standard
|
||||
default_dir = self.config.get('last_output_dir', None)
|
||||
if not default_dir or not Path(default_dir).exists():
|
||||
default_dir = Path.cwd()
|
||||
if str(default_dir).split('/')[-1].startswith('.'):
|
||||
default_dir = Path.home()
|
||||
self.output_dir = tk.StringVar(value=str(default_dir))
|
||||
|
||||
# Letztes PDF-Verzeichnis merken
|
||||
self.last_pdf_dir = self.config.get('last_pdf_dir', str(Path.home()))
|
||||
|
||||
# Exportoptionen
|
||||
self.exclude_rest = tk.BooleanVar(value=self.config.get('exclude_rest', False))
|
||||
|
||||
# UI erstellen
|
||||
self.create_widgets()
|
||||
|
||||
# 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)
|
||||
|
||||
def create_widgets(self):
|
||||
"""Erstelle die UI-Komponenten"""
|
||||
|
||||
# Header
|
||||
header_frame = tk.Frame(self.root, bg="#2c3e50", height=80)
|
||||
header_frame.pack(fill=tk.X)
|
||||
header_frame.pack_propagate(False)
|
||||
|
||||
title_label = tk.Label(
|
||||
header_frame,
|
||||
text="📅 PDF zu ICS Konverter",
|
||||
font=("Arial", 20, "bold"),
|
||||
bg="#2c3e50",
|
||||
fg="white"
|
||||
)
|
||||
title_label.pack(pady=20)
|
||||
|
||||
# Main Content Frame
|
||||
content_frame = tk.Frame(self.root, padx=20, pady=20)
|
||||
content_frame.pack(fill=tk.BOTH, expand=True)
|
||||
|
||||
# PDF-Dateien Bereich
|
||||
pdf_label = tk.Label(
|
||||
content_frame,
|
||||
text="PDF-Dateien:",
|
||||
font=("Arial", 12, "bold")
|
||||
)
|
||||
pdf_label.pack(anchor=tk.W, pady=(0, 5))
|
||||
|
||||
# Listbox mit Scrollbar für PDFs
|
||||
list_frame = tk.Frame(content_frame)
|
||||
list_frame.pack(fill=tk.BOTH, expand=True, pady=(0, 10))
|
||||
|
||||
scrollbar = tk.Scrollbar(list_frame)
|
||||
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
||||
|
||||
self.pdf_listbox = tk.Listbox(
|
||||
list_frame,
|
||||
selectmode=tk.EXTENDED,
|
||||
yscrollcommand=scrollbar.set,
|
||||
font=("Arial", 10)
|
||||
)
|
||||
self.pdf_listbox.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
|
||||
scrollbar.config(command=self.pdf_listbox.yview)
|
||||
|
||||
# Buttons für PDF-Verwaltung
|
||||
button_frame = tk.Frame(content_frame)
|
||||
button_frame.pack(fill=tk.X, pady=(0, 10))
|
||||
|
||||
add_btn = tk.Button(
|
||||
button_frame,
|
||||
text="➕ PDF hinzufügen",
|
||||
command=self.add_pdf_files,
|
||||
bg="#3498db",
|
||||
fg="white",
|
||||
font=("Arial", 10, "bold"),
|
||||
padx=20,
|
||||
pady=8,
|
||||
cursor="hand2"
|
||||
)
|
||||
add_btn.pack(side=tk.LEFT, padx=(0, 5))
|
||||
|
||||
remove_btn = tk.Button(
|
||||
button_frame,
|
||||
text="➖ Entfernen",
|
||||
command=self.remove_selected_pdfs,
|
||||
bg="#e74c3c",
|
||||
fg="white",
|
||||
font=("Arial", 10, "bold"),
|
||||
padx=20,
|
||||
pady=8,
|
||||
cursor="hand2"
|
||||
)
|
||||
remove_btn.pack(side=tk.LEFT, padx=(0, 5))
|
||||
|
||||
clear_btn = tk.Button(
|
||||
button_frame,
|
||||
text="🗑️ Alle entfernen",
|
||||
command=self.clear_all_pdfs,
|
||||
bg="#95a5a6",
|
||||
fg="white",
|
||||
font=("Arial", 10, "bold"),
|
||||
padx=20,
|
||||
pady=8,
|
||||
cursor="hand2"
|
||||
)
|
||||
clear_btn.pack(side=tk.LEFT)
|
||||
|
||||
# Konvertieren Button (rechts in der Zeile)
|
||||
self.convert_btn = tk.Button(
|
||||
button_frame,
|
||||
text="📄 ICS Datei erstellen",
|
||||
command=self.convert_pdfs,
|
||||
bg="#27ae60",
|
||||
fg="white",
|
||||
font=("Arial", 10, "bold"),
|
||||
padx=20,
|
||||
pady=8,
|
||||
cursor="hand2"
|
||||
)
|
||||
self.convert_btn.pack(side=tk.RIGHT)
|
||||
|
||||
# Ausgabe-Verzeichnis
|
||||
output_frame = tk.Frame(content_frame)
|
||||
output_frame.pack(fill=tk.X, pady=(10, 10))
|
||||
|
||||
output_label = tk.Label(
|
||||
output_frame,
|
||||
text="Ausgabe-Verzeichnis:",
|
||||
font=("Arial", 10)
|
||||
)
|
||||
output_label.pack(side=tk.LEFT, padx=(0, 5))
|
||||
|
||||
output_entry = tk.Entry(
|
||||
output_frame,
|
||||
textvariable=self.output_dir,
|
||||
font=("Arial", 10),
|
||||
state="readonly"
|
||||
)
|
||||
output_entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=(0, 5))
|
||||
|
||||
browse_btn = tk.Button(
|
||||
output_frame,
|
||||
text="📁 Durchsuchen",
|
||||
command=self.browse_output_dir,
|
||||
bg="#16a085",
|
||||
fg="white",
|
||||
font=("Arial", 10),
|
||||
padx=15,
|
||||
pady=5,
|
||||
cursor="hand2"
|
||||
)
|
||||
browse_btn.pack(side=tk.LEFT)
|
||||
|
||||
# Exportoptionen
|
||||
options_frame = tk.Frame(content_frame)
|
||||
options_frame.pack(fill=tk.X, pady=(10, 5))
|
||||
|
||||
exclude_rest_check = tk.Checkbutton(
|
||||
options_frame,
|
||||
text="🧘 Ruhetage ausschließen - (Ruhe, R56, R36, vRWF48, RWE, vR48)",
|
||||
variable=self.exclude_rest,
|
||||
font=("Arial", 10)
|
||||
)
|
||||
exclude_rest_check.pack(anchor=tk.W)
|
||||
|
||||
# Log-Bereich
|
||||
log_label = tk.Label(
|
||||
content_frame,
|
||||
text="Status:",
|
||||
font=("Arial", 10, "bold")
|
||||
)
|
||||
log_label.pack(anchor=tk.W, pady=(10, 5))
|
||||
|
||||
self.log_text = scrolledtext.ScrolledText(
|
||||
content_frame,
|
||||
height=8,
|
||||
font=("Consolas", 9),
|
||||
bg="#f8f9fa",
|
||||
state=tk.DISABLED
|
||||
)
|
||||
self.log_text.pack(fill=tk.BOTH, expand=True)
|
||||
|
||||
# Fortschrittsbalken
|
||||
self.progress = ttk.Progressbar(
|
||||
content_frame,
|
||||
mode='determinate',
|
||||
length=300
|
||||
)
|
||||
drag_info = " (Drag & Drop unterstützt)" if HAS_TKINTERDND else " (Tipp: Installiere tkinterdnd2 für Drag & Drop)"
|
||||
self.log(f"Bereit. Fügen Sie PDF-Dateien hinzu um zu starten.{drag_info}")
|
||||
|
||||
def load_config(self):
|
||||
"""Lade gespeicherte Konfiguration"""
|
||||
try:
|
||||
if CONFIG_FILE.exists():
|
||||
with open(CONFIG_FILE, 'r') as f:
|
||||
return json.load(f)
|
||||
except Exception as e:
|
||||
print(f"Warnung: Konfiguration konnte nicht geladen werden: {e}")
|
||||
return {}
|
||||
|
||||
def save_config(self):
|
||||
"""Speichere Konfiguration"""
|
||||
try:
|
||||
config = {
|
||||
'last_output_dir': self.output_dir.get(),
|
||||
'last_pdf_dir': self.last_pdf_dir,
|
||||
'exclude_rest': self.exclude_rest.get()
|
||||
}
|
||||
with open(CONFIG_FILE, 'w') as f:
|
||||
json.dump(config, f, indent=2)
|
||||
except Exception as e:
|
||||
print(f"Warnung: Konfiguration konnte nicht gespeichert werden: {e}")
|
||||
|
||||
def on_closing(self):
|
||||
"""Handle für Fenster schließen"""
|
||||
self.save_config()
|
||||
self.root.destroy()
|
||||
|
||||
def setup_drag_and_drop(self):
|
||||
"""Richte Drag & Drop ein"""
|
||||
if HAS_TKINTERDND:
|
||||
# Verwende tkinterdnd2 wenn verfügbar
|
||||
self.pdf_listbox.drop_target_register(DND_FILES)
|
||||
self.pdf_listbox.dnd_bind('<<Drop>>', self.drop_files)
|
||||
else:
|
||||
# Fallback: Native Tkinter Drag & Drop (funktioniert auf Unix)
|
||||
try:
|
||||
self.pdf_listbox.drop_target_register('DND_Files')
|
||||
self.pdf_listbox.dnd_bind('<<Drop>>', self.drop_files)
|
||||
except:
|
||||
# Wenn auch das nicht funktioniert, zeige Hilfstext
|
||||
pass
|
||||
|
||||
def drop_files(self, event):
|
||||
"""Handle für Drag & Drop Events"""
|
||||
files = []
|
||||
|
||||
if HAS_TKINTERDND:
|
||||
# Parse tkinterdnd2 format
|
||||
files_str = event.data
|
||||
# Entferne geschweifte Klammern und splitte
|
||||
files_str = files_str.strip('{}')
|
||||
files = re.findall(r'[^\s{}]+(?:\s+[^\s{}]+)*', files_str)
|
||||
else:
|
||||
# Fallback parsing
|
||||
if hasattr(event, 'data'):
|
||||
files_str = event.data.strip('{}')
|
||||
files = [f.strip() for f in files_str.split()]
|
||||
|
||||
# Füge nur PDF-Dateien hinzu
|
||||
pdf_count = 0
|
||||
for file_path in files:
|
||||
file_path = file_path.strip()
|
||||
if file_path.lower().endswith('.pdf'):
|
||||
if file_path not in self.pdf_files:
|
||||
self.pdf_files.append(file_path)
|
||||
self.pdf_listbox.insert(tk.END, Path(file_path).name)
|
||||
pdf_count += 1
|
||||
|
||||
if pdf_count > 0:
|
||||
self.log(f"✓ {pdf_count} PDF-Datei(en) per Drag & Drop hinzugefügt")
|
||||
elif files:
|
||||
self.log("⚠ Nur PDF-Dateien können hinzugefügt werden")
|
||||
|
||||
return 'break'
|
||||
|
||||
def log(self, message):
|
||||
"""Füge eine Nachricht zum Log hinzu"""
|
||||
self.log_text.config(state=tk.NORMAL)
|
||||
self.log_text.insert(tk.END, message + "\n")
|
||||
self.log_text.see(tk.END)
|
||||
self.log_text.config(state=tk.DISABLED)
|
||||
|
||||
def add_pdf_files(self):
|
||||
"""Öffne Datei-Dialog zum Hinzufügen von PDFs"""
|
||||
# Starte im letzten PDF-Verzeichnis
|
||||
initial_dir = self.last_pdf_dir
|
||||
if initial_dir.startswith('.') or not Path(initial_dir).exists():
|
||||
initial_dir = str(Path.home())
|
||||
|
||||
files = filedialog.askopenfilenames(
|
||||
title="PDF-Dateien auswählen",
|
||||
filetypes=[("PDF Dateien", "*.pdf"), ("Alle Dateien", "*.*")],
|
||||
initialdir=initial_dir
|
||||
)
|
||||
|
||||
for file in files:
|
||||
if file not in self.pdf_files:
|
||||
self.pdf_files.append(file)
|
||||
self.pdf_listbox.insert(tk.END, Path(file).name)
|
||||
|
||||
if files:
|
||||
# Merke Verzeichnis der ersten ausgewählten Datei
|
||||
self.last_pdf_dir = str(Path(files[0]).parent)
|
||||
self.log(f"✓ {len(files)} PDF-Datei(en) hinzugefügt")
|
||||
|
||||
def remove_selected_pdfs(self):
|
||||
"""Entferne ausgewählte PDFs aus der Liste"""
|
||||
selected = self.pdf_listbox.curselection()
|
||||
|
||||
# Rückwärts durchlaufen, um Indexprobleme zu vermeiden
|
||||
for index in reversed(selected):
|
||||
self.pdf_listbox.delete(index)
|
||||
del self.pdf_files[index]
|
||||
|
||||
if selected:
|
||||
self.log(f"✓ {len(selected)} PDF-Datei(en) entfernt")
|
||||
|
||||
def clear_all_pdfs(self):
|
||||
"""Entferne alle PDFs aus der Liste"""
|
||||
count = len(self.pdf_files)
|
||||
self.pdf_listbox.delete(0, tk.END)
|
||||
self.pdf_files.clear()
|
||||
|
||||
if count > 0:
|
||||
self.log(f"✓ Alle {count} PDF-Datei(en) entfernt")
|
||||
|
||||
def browse_output_dir(self):
|
||||
"""Öffne Dialog zur Auswahl des Ausgabe-Verzeichnisses"""
|
||||
# Verhindere Start in versteckten Verzeichnissen
|
||||
initial_dir = self.output_dir.get()
|
||||
if initial_dir.startswith('.') or '/.venv' in initial_dir or '/__pycache__' in initial_dir:
|
||||
initial_dir = str(Path.home())
|
||||
|
||||
directory = filedialog.askdirectory(
|
||||
title="Ausgabe-Verzeichnis auswählen",
|
||||
initialdir=initial_dir,
|
||||
mustexist=True
|
||||
)
|
||||
|
||||
if directory:
|
||||
self.output_dir.set(directory)
|
||||
self.save_config() # Sofort speichern
|
||||
self.log(f"✓ Ausgabe-Verzeichnis: {directory}")
|
||||
|
||||
def convert_pdfs(self):
|
||||
"""Konvertiere alle PDFs zu ICS"""
|
||||
if not self.pdf_files:
|
||||
messagebox.showwarning(
|
||||
"Keine PDFs",
|
||||
"Bitte fügen Sie mindestens eine PDF-Datei hinzu."
|
||||
)
|
||||
return
|
||||
|
||||
# Starte Konvertierung in separatem Thread
|
||||
thread = threading.Thread(target=self._convert_worker, daemon=True)
|
||||
thread.start()
|
||||
|
||||
def _convert_worker(self):
|
||||
"""Worker-Thread für Konvertierung"""
|
||||
self.progress['maximum'] = len(self.pdf_files)
|
||||
self.progress['value'] = 0
|
||||
|
||||
output_dir = Path(self.output_dir.get())
|
||||
success_count = 0
|
||||
|
||||
self.log("\n" + "="*50)
|
||||
self.log("🔄 Starte Konvertierung...")
|
||||
self.log("="*50)
|
||||
|
||||
for i, pdf_path in enumerate(self.pdf_files, 1):
|
||||
try:
|
||||
self.log(f"\n[{i}/{len(self.pdf_files)}] Verarbeite: {Path(pdf_path).name}")
|
||||
|
||||
# Extrahiere Daten
|
||||
dienstplan = extract_dienstplan_data(pdf_path)
|
||||
|
||||
# Zeige Informationen
|
||||
self.log(f" ├─ Name: {dienstplan['vorname']} {dienstplan['name']}")
|
||||
self.log(f" ├─ Personalnummer: {dienstplan['personalnummer']}")
|
||||
self.log(f" ├─ Betriebshof: {dienstplan['betriebshof']}")
|
||||
self.log(f" └─ Events gefunden: {len(dienstplan['events'])}")
|
||||
|
||||
if not dienstplan['events']:
|
||||
self.log(" ⚠️ Warnung: Keine Events gefunden!")
|
||||
continue
|
||||
|
||||
# Erstelle ICS-Datei
|
||||
ics_filename = Path(pdf_path).stem + '.ics'
|
||||
ics_path = output_dir / ics_filename
|
||||
|
||||
create_ics_from_dienstplan(dienstplan, str(ics_path), exclude_rest=self.exclude_rest.get())
|
||||
|
||||
self.log(f" ✓ ICS erstellt: {ics_filename}")
|
||||
success_count += 1
|
||||
|
||||
except Exception as e:
|
||||
self.log(f" ✗ Fehler: {str(e)}")
|
||||
|
||||
finally:
|
||||
self.progress['value'] = i
|
||||
|
||||
# Zusammenfassung
|
||||
self.log("\n" + "="*50)
|
||||
self.log(f"✅ Fertig! {success_count}/{len(self.pdf_files)} ICS-Dateien erstellt")
|
||||
self.log("="*50 + "\n")
|
||||
|
||||
# Erfolgsmeldung
|
||||
if success_count > 0:
|
||||
self.root.after(0, lambda: messagebox.showinfo(
|
||||
"Konvertierung abgeschlossen",
|
||||
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():
|
||||
"""Hauptfunktion"""
|
||||
if HAS_TKINTERDND:
|
||||
# Verwende TkinterDnD root für besseres Drag & Drop
|
||||
root = TkinterDnD.Tk()
|
||||
else:
|
||||
# Standard Tkinter
|
||||
root = tk.Tk()
|
||||
|
||||
app = PDFtoICSGUI(root)
|
||||
root.mainloop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
516
gui_wxpython.py
Normal file
516
gui_wxpython.py
Normal file
@@ -0,0 +1,516 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
GUI für PDF zu ICS Konverter mit wxPython
|
||||
Native Benutzeroberfläche für macOS, Windows, Linux
|
||||
"""
|
||||
|
||||
import wx
|
||||
import wx.adv
|
||||
from pathlib import Path
|
||||
import threading
|
||||
import json
|
||||
import webbrowser
|
||||
from datetime import datetime
|
||||
from pdf_to_ics import extract_dienstplan_data, create_ics_from_dienstplan
|
||||
from update_checker import check_for_updates, get_current_version
|
||||
|
||||
# Konfigurationsdatei
|
||||
CONFIG_FILE = Path.home() / '.pdf_to_ics_config.json'
|
||||
|
||||
|
||||
class FileDropTarget(wx.FileDropTarget):
|
||||
"""Custom FileDropTarget für Drag & Drop von PDF-Dateien"""
|
||||
def __init__(self, window):
|
||||
wx.FileDropTarget.__init__(self)
|
||||
self.window = window
|
||||
|
||||
def OnDropFiles(self, x, y, filenames):
|
||||
"""Handle für Drag & Drop Events"""
|
||||
pdf_count = 0
|
||||
|
||||
for filepath in filenames:
|
||||
# Nur PDF-Dateien akzeptieren
|
||||
if filepath.lower().endswith('.pdf'):
|
||||
if filepath not in self.window.pdf_files:
|
||||
self.window.pdf_files.append(filepath)
|
||||
self.window.pdf_listbox.Append(Path(filepath).name)
|
||||
pdf_count += 1
|
||||
# Merke Verzeichnis
|
||||
self.window.last_pdf_dir = str(Path(filepath).parent)
|
||||
|
||||
if pdf_count > 0:
|
||||
self.window.log(f"✓ {pdf_count} PDF-Datei(en) per Drag & Drop hinzugefügt")
|
||||
elif filenames:
|
||||
self.window.log("⚠ Nur PDF-Dateien können hinzugefügt werden")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class PDFtoICSFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
super().__init__(parent=None, title='PDF zu ICS Konverter - Dienstplan Importer', size=(800, 700))
|
||||
|
||||
# Lade gespeicherte Einstellungen
|
||||
self.config = self.load_config()
|
||||
|
||||
# Variablen
|
||||
self.pdf_files = []
|
||||
|
||||
# Nutze letztes Ausgabeverzeichnis oder Standard
|
||||
default_dir = self.config.get('last_output_dir', None)
|
||||
if not default_dir or not Path(default_dir).exists():
|
||||
default_dir = Path.cwd()
|
||||
if str(default_dir).split('/')[-1].startswith('.'):
|
||||
default_dir = Path.home()
|
||||
self.output_dir = str(default_dir)
|
||||
|
||||
# Letztes PDF-Verzeichnis merken
|
||||
self.last_pdf_dir = self.config.get('last_pdf_dir', str(Path.home()))
|
||||
|
||||
# Erstelle UI
|
||||
self.create_widgets()
|
||||
|
||||
# Erstelle Menüleiste
|
||||
self.create_menu()
|
||||
|
||||
# Center window
|
||||
self.Centre()
|
||||
|
||||
# Update-Prüfung im Hintergrund starten
|
||||
update_thread = threading.Thread(target=self.check_for_updates_background, daemon=True)
|
||||
update_thread.start()
|
||||
|
||||
# Handle window close
|
||||
self.Bind(wx.EVT_CLOSE, self.on_closing)
|
||||
|
||||
def load_config(self):
|
||||
"""Lade gespeicherte Konfiguration"""
|
||||
try:
|
||||
if CONFIG_FILE.exists():
|
||||
with open(CONFIG_FILE, 'r') as f:
|
||||
return json.load(f)
|
||||
except Exception as e:
|
||||
print(f"Warnung: Konfiguration konnte nicht geladen werden: {e}")
|
||||
return {}
|
||||
|
||||
def save_config(self):
|
||||
"""Speichere Konfiguration"""
|
||||
try:
|
||||
config = {
|
||||
'last_output_dir': self.output_dir,
|
||||
'last_pdf_dir': self.last_pdf_dir,
|
||||
'exclude_rest': self.exclude_rest_checkbox.GetValue(),
|
||||
'exclude_vacation': self.exclude_vacation_checkbox.GetValue()
|
||||
}
|
||||
with open(CONFIG_FILE, 'w') as f:
|
||||
json.dump(config, f, indent=2)
|
||||
except Exception as e:
|
||||
print(f"Warnung: Konfiguration konnte nicht gespeichert werden: {e}")
|
||||
|
||||
def create_menu(self):
|
||||
"""Erstelle die Menüleiste"""
|
||||
menubar = wx.MenuBar()
|
||||
|
||||
# Hilfe-Menü
|
||||
help_menu = wx.Menu()
|
||||
android_item = help_menu.Append(wx.ID_ANY, 'PDF-Export auf Android (iPD)\tCtrl+H')
|
||||
help_menu.AppendSeparator()
|
||||
about_item = help_menu.Append(wx.ID_ABOUT, 'Über dieses Programm\tCtrl+I')
|
||||
help_menu.AppendSeparator()
|
||||
quit_item = help_menu.Append(wx.ID_EXIT, 'Beenden\tCtrl+Q')
|
||||
|
||||
menubar.Append(help_menu, '&Hilfe')
|
||||
self.SetMenuBar(menubar)
|
||||
|
||||
# Bind events
|
||||
self.Bind(wx.EVT_MENU, self.show_android_export_guide, android_item)
|
||||
self.Bind(wx.EVT_MENU, self.show_about_dialog, about_item)
|
||||
self.Bind(wx.EVT_MENU, self.on_closing, quit_item)
|
||||
|
||||
def create_widgets(self):
|
||||
"""Erstelle die UI-Komponenten"""
|
||||
panel = wx.Panel(self)
|
||||
main_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
# ========== HEADER ==========
|
||||
header_panel = wx.Panel(panel)
|
||||
header_panel.SetBackgroundColour('#2c3e50')
|
||||
header_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
title_label = wx.StaticText(header_panel, label='PDF zu ICS Konverter')
|
||||
title_font = wx.Font(20, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
|
||||
title_label.SetFont(title_font)
|
||||
title_label.SetForegroundColour(wx.WHITE)
|
||||
|
||||
header_sizer.Add(title_label, 0, wx.ALL | wx.ALIGN_CENTER, 20)
|
||||
header_panel.SetSizer(header_sizer)
|
||||
|
||||
main_sizer.Add(header_panel, 0, wx.EXPAND)
|
||||
|
||||
# ========== CONTENT AREA ==========
|
||||
content_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
# PDF-Dateien Bereich
|
||||
pdf_label = wx.StaticText(panel, label='PDF-Dateien:')
|
||||
pdf_font = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
|
||||
pdf_label.SetFont(pdf_font)
|
||||
content_sizer.Add(pdf_label, 0, wx.ALL, 10)
|
||||
|
||||
# ListBox für PDFs
|
||||
self.pdf_listbox = wx.ListBox(panel, style=wx.LB_EXTENDED)
|
||||
# Richte Drag & Drop ein
|
||||
self.pdf_listbox.SetDropTarget(FileDropTarget(self))
|
||||
content_sizer.Add(self.pdf_listbox, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
|
||||
|
||||
# Buttons für PDF-Verwaltung
|
||||
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
add_btn = wx.Button(panel, label='PDF hinzufügen')
|
||||
add_btn.Bind(wx.EVT_BUTTON, self.add_pdf_files)
|
||||
button_sizer.Add(add_btn, 1, wx.ALL, 5)
|
||||
|
||||
remove_btn = wx.Button(panel, label='Entfernen')
|
||||
remove_btn.Bind(wx.EVT_BUTTON, self.remove_selected_pdfs)
|
||||
button_sizer.Add(remove_btn, 1, wx.ALL, 5)
|
||||
|
||||
clear_btn = wx.Button(panel, label='Alle entfernen')
|
||||
clear_btn.Bind(wx.EVT_BUTTON, self.clear_all_pdfs)
|
||||
button_sizer.Add(clear_btn, 1, wx.ALL, 5)
|
||||
|
||||
content_sizer.Add(button_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
|
||||
|
||||
# Ausgabe-Verzeichnis
|
||||
output_label = wx.StaticText(panel, label='Ausgabe-Verzeichnis:')
|
||||
content_sizer.Add(output_label, 0, wx.ALL, 10)
|
||||
|
||||
output_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.output_text = wx.TextCtrl(panel, value=self.output_dir, style=wx.TE_READONLY)
|
||||
output_sizer.Add(self.output_text, 1, wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
|
||||
browse_btn = wx.Button(panel, label='Durchsuchen')
|
||||
browse_btn.Bind(wx.EVT_BUTTON, self.browse_output_dir)
|
||||
output_sizer.Add(browse_btn, 0, wx.LEFT, 5)
|
||||
|
||||
content_sizer.Add(output_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
|
||||
|
||||
# Exportoptionen
|
||||
self.exclude_rest_checkbox = wx.CheckBox(
|
||||
panel,
|
||||
label='🧘 Ruhetage ausschließen (Ruhe, R56, R36, vRWF48, RWE, vR48)'
|
||||
)
|
||||
self.exclude_rest_checkbox.SetValue(self.config.get('exclude_rest', False))
|
||||
content_sizer.Add(self.exclude_rest_checkbox, 0, wx.ALL, 10)
|
||||
|
||||
self.exclude_vacation_checkbox = wx.CheckBox(
|
||||
panel,
|
||||
label='🏖️ Urlaub ausschließen (060, 0060)'
|
||||
)
|
||||
self.exclude_vacation_checkbox.SetValue(self.config.get('exclude_vacation', False))
|
||||
content_sizer.Add(self.exclude_vacation_checkbox, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)
|
||||
|
||||
# Log-Bereich
|
||||
log_label = wx.StaticText(panel, label='Status:')
|
||||
log_label.SetFont(pdf_font)
|
||||
content_sizer.Add(log_label, 0, wx.ALL, 10)
|
||||
|
||||
self.log_text = wx.TextCtrl(
|
||||
panel,
|
||||
style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP
|
||||
)
|
||||
self.log_text.SetBackgroundColour('#f8f9fa')
|
||||
content_sizer.Add(self.log_text, 2, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
|
||||
|
||||
# Konvertieren Button
|
||||
self.convert_btn = wx.Button(panel, label='ICS Datei erstellen')
|
||||
self.convert_btn.Bind(wx.EVT_BUTTON, self.convert_pdfs)
|
||||
content_sizer.Add(self.convert_btn, 0, wx.EXPAND | wx.ALL, 10)
|
||||
|
||||
main_sizer.Add(content_sizer, 1, wx.EXPAND)
|
||||
|
||||
panel.SetSizer(main_sizer)
|
||||
|
||||
# Initial log message
|
||||
self.log("Bereit. Fügen Sie PDF-Dateien hinzu um zu starten.")
|
||||
self.log("✓ Native wxPython GUI - perfekte Integration auf macOS, Windows & Linux!")
|
||||
|
||||
def log(self, message):
|
||||
"""Füge eine Nachricht zum Log hinzu"""
|
||||
timestamp = datetime.now().strftime("%H:%M:%S")
|
||||
wx.CallAfter(self._append_log, f"[{timestamp}] {message}\n")
|
||||
|
||||
def _append_log(self, message):
|
||||
"""Thread-sichere Log-Ausgabe"""
|
||||
self.log_text.AppendText(message)
|
||||
|
||||
def add_pdf_files(self, event=None):
|
||||
"""Öffne Datei-Dialog zum Hinzufügen von PDFs"""
|
||||
with wx.FileDialog(
|
||||
self,
|
||||
"PDF-Dateien auswählen",
|
||||
defaultDir=self.last_pdf_dir,
|
||||
wildcard="PDF Dateien (*.pdf)|*.pdf|Alle Dateien (*.*)|*.*",
|
||||
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE
|
||||
) as fileDialog:
|
||||
|
||||
if fileDialog.ShowModal() == wx.ID_CANCEL:
|
||||
return
|
||||
|
||||
paths = fileDialog.GetPaths()
|
||||
|
||||
for path in paths:
|
||||
if path not in self.pdf_files:
|
||||
self.pdf_files.append(path)
|
||||
self.pdf_listbox.Append(Path(path).name)
|
||||
|
||||
if paths:
|
||||
# Merke Verzeichnis der ersten ausgewählten Datei
|
||||
self.last_pdf_dir = str(Path(paths[0]).parent)
|
||||
self.log(f"✓ {len(paths)} PDF-Datei(en) hinzugefügt")
|
||||
|
||||
def remove_selected_pdfs(self, event=None):
|
||||
"""Entferne ausgewählte PDFs aus der Liste"""
|
||||
selections = self.pdf_listbox.GetSelections()
|
||||
|
||||
if not selections:
|
||||
return
|
||||
|
||||
# Rückwärts durchlaufen, um Indexprobleme zu vermeiden
|
||||
for index in reversed(selections):
|
||||
self.pdf_listbox.Delete(index)
|
||||
del self.pdf_files[index]
|
||||
|
||||
self.log(f"✓ {len(selections)} PDF-Datei(en) entfernt")
|
||||
|
||||
def clear_all_pdfs(self, event=None):
|
||||
"""Entferne alle PDFs aus der Liste"""
|
||||
count = len(self.pdf_files)
|
||||
self.pdf_listbox.Clear()
|
||||
self.pdf_files.clear()
|
||||
|
||||
if count > 0:
|
||||
self.log(f"✓ Alle {count} PDF-Datei(en) entfernt")
|
||||
|
||||
def browse_output_dir(self, event=None):
|
||||
"""Öffne Dialog zur Auswahl des Ausgabe-Verzeichnisses"""
|
||||
with wx.DirDialog(
|
||||
self,
|
||||
"Ausgabe-Verzeichnis auswählen",
|
||||
defaultPath=self.output_dir,
|
||||
style=wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST
|
||||
) as dirDialog:
|
||||
|
||||
if dirDialog.ShowModal() == wx.ID_CANCEL:
|
||||
return
|
||||
|
||||
self.output_dir = dirDialog.GetPath()
|
||||
self.output_text.SetValue(self.output_dir)
|
||||
self.save_config()
|
||||
self.log(f"✓ Ausgabe-Verzeichnis: {self.output_dir}")
|
||||
|
||||
def convert_pdfs(self, event=None):
|
||||
"""Konvertiere alle PDFs zu ICS"""
|
||||
if not self.pdf_files:
|
||||
wx.MessageBox(
|
||||
'Bitte fügen Sie mindestens eine PDF-Datei hinzu.',
|
||||
'Keine PDFs',
|
||||
wx.OK | wx.ICON_WARNING
|
||||
)
|
||||
return
|
||||
|
||||
# Starte Konvertierung in separatem Thread
|
||||
thread = threading.Thread(target=self._convert_worker, daemon=True)
|
||||
thread.start()
|
||||
|
||||
def _convert_worker(self):
|
||||
"""Worker-Thread für Konvertierung"""
|
||||
# Deaktiviere Button
|
||||
wx.CallAfter(self.convert_btn.Enable, False)
|
||||
|
||||
output_dir = Path(self.output_dir)
|
||||
success_count = 0
|
||||
|
||||
self.log("\n" + "="*50)
|
||||
self.log("🔄 Starte Konvertierung...")
|
||||
self.log("="*50)
|
||||
|
||||
for i, pdf_path in enumerate(self.pdf_files, 1):
|
||||
try:
|
||||
self.log(f"\n[{i}/{len(self.pdf_files)}] Verarbeite: {Path(pdf_path).name}")
|
||||
|
||||
# Extrahiere Daten
|
||||
dienstplan = extract_dienstplan_data(pdf_path)
|
||||
|
||||
# Zeige Informationen
|
||||
self.log(f" ├─ Name: {dienstplan['vorname']} {dienstplan['name']}")
|
||||
self.log(f" ├─ Personalnummer: {dienstplan['personalnummer']}")
|
||||
self.log(f" ├─ Betriebshof: {dienstplan['betriebshof']}")
|
||||
self.log(f" └─ Events gefunden: {len(dienstplan['events'])}")
|
||||
|
||||
if not dienstplan['events']:
|
||||
self.log(" ⚠️ Warnung: Keine Events gefunden!")
|
||||
continue
|
||||
|
||||
# Erstelle ICS-Datei
|
||||
ics_filename = Path(pdf_path).stem + '.ics'
|
||||
ics_path = output_dir / ics_filename
|
||||
|
||||
create_ics_from_dienstplan(
|
||||
dienstplan,
|
||||
str(ics_path),
|
||||
exclude_rest=self.exclude_rest_checkbox.GetValue(),
|
||||
exclude_vacation=self.exclude_vacation_checkbox.GetValue()
|
||||
)
|
||||
|
||||
self.log(f" ✓ ICS erstellt: {ics_filename}")
|
||||
success_count += 1
|
||||
|
||||
except Exception as e:
|
||||
self.log(f" ✗ Fehler: {str(e)}")
|
||||
|
||||
# Zusammenfassung
|
||||
self.log("\n" + "="*50)
|
||||
self.log(f"✅ Fertig! {success_count}/{len(self.pdf_files)} ICS-Dateien erstellt")
|
||||
self.log("="*50 + "\n")
|
||||
|
||||
# Speichere Config
|
||||
self.save_config()
|
||||
|
||||
# Reaktiviere Button
|
||||
wx.CallAfter(self.convert_btn.Enable, True)
|
||||
|
||||
# Erfolgsmeldung
|
||||
if success_count > 0:
|
||||
wx.CallAfter(
|
||||
wx.MessageBox,
|
||||
f"Es wurden {success_count} ICS-Datei(en) erfolgreich erstellt!\n\n"
|
||||
f"Speicherort: {output_dir}",
|
||||
"Konvertierung abgeschlossen",
|
||||
wx.OK | wx.ICON_INFORMATION
|
||||
)
|
||||
|
||||
def show_android_export_guide(self, event=None):
|
||||
"""Zeige Anleitung für PDF-Export aus Android App (iPD)"""
|
||||
guide_window = wx.Dialog(self, title="PDF-Export auf Android (iPD)", size=(600, 600))
|
||||
|
||||
panel = wx.Panel(guide_window)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
# Header
|
||||
header = wx.StaticText(panel, label="PDF-Export aus iPD")
|
||||
header_font = wx.Font(16, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
|
||||
header.SetFont(header_font)
|
||||
sizer.Add(header, 0, wx.ALL | wx.ALIGN_CENTER, 15)
|
||||
|
||||
# Anleitung-Text
|
||||
guide_text = wx.TextCtrl(
|
||||
panel,
|
||||
value="""1. Öffne die iPD App auf deinem Android-Gerät
|
||||
|
||||
2. Öffne einen Dienstplan
|
||||
|
||||
3. Wähle den gewünschten Monat aus
|
||||
|
||||
4. Tippe auf das PDF-Symbol
|
||||
(rechts oben, links neben dem 3-Punkte-Menü)
|
||||
|
||||
5. Tippe auf "Datei herunterladen"
|
||||
(rechts oben, neben Drucker-Button)
|
||||
|
||||
6. Wähle "Im Arbeitsprofil speichern"
|
||||
|
||||
7. Sende die PDF-Datei als E-Mail-Anhang
|
||||
an deine private E-Mailadresse
|
||||
|
||||
8. Transferiere die PDF-Datei auf deinen Computer
|
||||
|
||||
9. Öffne diese Anwendung und füge die PDF ein
|
||||
|
||||
10. Klicke "ICS Datei erstellen"
|
||||
|
||||
11. Importiere die ICS-Datei in deinen Kalender
|
||||
|
||||
✓ Fertig!""",
|
||||
style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP
|
||||
)
|
||||
guide_text.SetBackgroundColour('#f8f9fa')
|
||||
sizer.Add(guide_text, 1, wx.EXPAND | wx.ALL, 10)
|
||||
|
||||
# Buttons
|
||||
btn_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
online_btn = wx.Button(panel, label='Detaillierte Anleitung online')
|
||||
online_btn.Bind(wx.EVT_BUTTON, lambda e: webbrowser.open("https://git.file-archive.de/webfarben/pdf_to_ics"))
|
||||
btn_sizer.Add(online_btn, 0, wx.ALL, 5)
|
||||
|
||||
close_btn = wx.Button(panel, wx.ID_CLOSE, 'Schließen')
|
||||
close_btn.Bind(wx.EVT_BUTTON, lambda e: guide_window.Close())
|
||||
btn_sizer.Add(close_btn, 0, wx.ALL, 5)
|
||||
|
||||
sizer.Add(btn_sizer, 0, wx.ALIGN_CENTER | wx.ALL, 10)
|
||||
|
||||
panel.SetSizer(sizer)
|
||||
guide_window.ShowModal()
|
||||
guide_window.Destroy()
|
||||
|
||||
def show_about_dialog(self, event=None):
|
||||
"""Zeige About-Dialog mit Programminformationen"""
|
||||
version = get_current_version()
|
||||
|
||||
info = wx.adv.AboutDialogInfo()
|
||||
info.SetName("PDF zu ICS Konverter")
|
||||
info.SetVersion(f"Version {version}")
|
||||
info.SetDescription(
|
||||
"Ein Programm zur Konvertierung von Dienstplan-PDFs "
|
||||
"zu ICS-Kalenderdateien für einfaches Importieren "
|
||||
"in Kalenderprogramme."
|
||||
)
|
||||
info.SetWebSite("https://git.file-archive.de/webfarben/pdf_to_ics")
|
||||
info.AddDeveloper("Sebastian Köhler - Webfarben")
|
||||
info.SetLicence("Proprietär")
|
||||
|
||||
wx.adv.AboutBox(info)
|
||||
|
||||
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:
|
||||
wx.CallAfter(self.show_update_dialog, new_version, download_url)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def show_update_dialog(self, new_version, download_url):
|
||||
"""Zeige Update-Dialog"""
|
||||
current_version = get_current_version()
|
||||
|
||||
result = wx.MessageBox(
|
||||
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?",
|
||||
"Update verfügbar",
|
||||
wx.YES_NO | wx.ICON_INFORMATION
|
||||
)
|
||||
|
||||
if result == wx.YES:
|
||||
webbrowser.open(download_url)
|
||||
|
||||
def on_closing(self, event=None):
|
||||
"""Handle für Fenster schließen"""
|
||||
self.save_config()
|
||||
self.Destroy()
|
||||
|
||||
|
||||
def main():
|
||||
"""Hauptfunktion"""
|
||||
app = wx.App()
|
||||
frame = PDFtoICSFrame()
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
54
install.sh
54
install.sh
@@ -96,40 +96,6 @@ else
|
||||
print_success "venv ist bereits installiert"
|
||||
fi
|
||||
|
||||
# Prüfe und installiere Tkinter wenn nötig
|
||||
print_step "Prüfe Tkinter-Installation..."
|
||||
if ! python3 -c "import tkinter" 2>/dev/null; then
|
||||
print_warning "Tkinter ist nicht installiert. Installation wird versucht..."
|
||||
|
||||
# Erkenne Distribution
|
||||
if [ -f /etc/debian_version ]; then
|
||||
echo "Debian/Ubuntu erkannt. Installiere python3-tk..."
|
||||
if command -v sudo &> /dev/null; then
|
||||
sudo apt-get update && sudo apt-get install -y python3-tk
|
||||
else
|
||||
print_error "sudo nicht verfügbar. Bitte installieren Sie python3-tk manuell:"
|
||||
echo " apt-get install python3-tk"
|
||||
exit 1
|
||||
fi
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
echo "Fedora erkannt. Installiere python3-tkinter..."
|
||||
sudo dnf install -y python3-tkinter
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
echo "Arch Linux erkannt. Installiere tk..."
|
||||
sudo pacman -S --noconfirm tk
|
||||
else
|
||||
print_warning "Distribution nicht erkannt. Bitte installieren Sie Tkinter manuell."
|
||||
echo "Möchten Sie trotzdem fortfahren? (y/n)"
|
||||
read -r response
|
||||
if [[ ! "$response" =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
print_success "Tkinter installiert"
|
||||
else
|
||||
print_success "Tkinter ist bereits installiert"
|
||||
fi
|
||||
|
||||
# Erstelle Installationsverzeichnis
|
||||
print_step "Erstelle Installationsverzeichnis..."
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
@@ -151,7 +117,19 @@ print_success "Virtual Environment erstellt"
|
||||
print_step "Installiere Python-Abhängigkeiten..."
|
||||
.venv/bin/pip install -q --upgrade pip
|
||||
.venv/bin/pip install -q pdfplumber icalendar pypdf2 pytz packaging
|
||||
.venv/bin/pip install -q tkinterdnd2 2>/dev/null || print_warning "tkinterdnd2 optional nicht installiert (kein Problem)"
|
||||
|
||||
print_step "Installiere wxPython..."
|
||||
if .venv/bin/pip install wxPython; then
|
||||
print_success "wxPython installiert"
|
||||
else
|
||||
print_error "wxPython konnte nicht installiert werden."
|
||||
print_warning "Auf Linux fehlen ggf. Build-Abhängigkeiten. Unter Debian/Ubuntu/Mint oft hilfreich:"
|
||||
echo " sudo apt-get update"
|
||||
echo " sudo apt-get install -y build-essential python3-dev libgtk-3-dev libglib2.0-dev libjpeg-dev libtiff-dev libpng-dev"
|
||||
echo "Danach die Installation erneut starten: ./install.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_success "Abhängigkeiten installiert"
|
||||
|
||||
# Erstelle Launcher-Script
|
||||
@@ -161,7 +139,7 @@ cat > "$LAUNCHER" << 'EOF'
|
||||
# PDF zu ICS Konverter Launcher
|
||||
INSTALL_DIR="$HOME/.local/share/pdf-to-ics"
|
||||
cd "$INSTALL_DIR"
|
||||
exec .venv/bin/python gui.py
|
||||
exec .venv/bin/python gui_wxpython.py
|
||||
EOF
|
||||
chmod +x "$LAUNCHER"
|
||||
print_success "Launcher erstellt: $LAUNCHER"
|
||||
@@ -208,8 +186,8 @@ print_success "Die Anwendung wurde installiert!"
|
||||
echo ""
|
||||
echo "Sie können die Anwendung nun starten:"
|
||||
echo ""
|
||||
echo " 1. ${BLUE}Über das Anwendungsmenü${NC} (suchen Sie nach 'PDF zu ICS')"
|
||||
echo " 2. ${BLUE}Über die Kommandozeile:${NC} pdf-to-ics"
|
||||
echo -e " 1. ${BLUE}Über das Anwendungsmenü${NC} (suchen Sie nach 'PDF zu ICS')"
|
||||
echo -e " 2. ${BLUE}Über die Kommandozeile:${NC} pdf-to-ics"
|
||||
echo ""
|
||||
echo "Installation Details:"
|
||||
echo " • Installationsverzeichnis: $INSTALL_DIR"
|
||||
|
||||
142
pdf_to_ics.py
142
pdf_to_ics.py
@@ -154,7 +154,7 @@ def parse_dienstplan_table(table, month_start_str):
|
||||
return events
|
||||
|
||||
|
||||
def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False):
|
||||
def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False, exclude_vacation=False):
|
||||
"""
|
||||
Erstellt eine ICS-Datei aus den Dienstplan-Daten
|
||||
|
||||
@@ -162,6 +162,7 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
|
||||
dienstplan: Dictionary mit Dienstplan-Daten
|
||||
output_path: Pfad für Output-Datei
|
||||
exclude_rest: Wenn True, werden Ruhepausen nicht exportiert
|
||||
exclude_vacation: Wenn True, wird Urlaub (060/0060) nicht exportiert
|
||||
"""
|
||||
# Erstelle Calendar
|
||||
cal = Calendar()
|
||||
@@ -182,12 +183,13 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
|
||||
continue
|
||||
|
||||
service_type = event_data['service']
|
||||
normalized_service_type = service_type.lstrip('0') or '0'
|
||||
|
||||
event = Event()
|
||||
|
||||
# Titel - nur den Dienstart
|
||||
# Spezielle Service-Typen mit aussagekräftigen Namen
|
||||
if service_type == '0060':
|
||||
if normalized_service_type == '60':
|
||||
title = "Urlaub"
|
||||
elif service_type in rest_types:
|
||||
title = "Ruhe"
|
||||
@@ -198,6 +200,10 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
|
||||
if exclude_rest and title == "Ruhe":
|
||||
continue
|
||||
|
||||
# Überspringe Urlaub wenn gewünscht (060/0060)
|
||||
if exclude_vacation and title == "Urlaub":
|
||||
continue
|
||||
|
||||
event.add('summary', title)
|
||||
|
||||
# Beschreibung
|
||||
@@ -255,39 +261,145 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
|
||||
|
||||
def main():
|
||||
"""
|
||||
Hauptfunktion
|
||||
Hauptfunktion mit CLI-Argumenten
|
||||
"""
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
# Finde alle PDF-Dateien im aktuellen Verzeichnis
|
||||
pdf_files = list(Path('.').glob('*.pdf'))
|
||||
parser = argparse.ArgumentParser(
|
||||
description='PDF zu ICS Konverter - Konvertiere Dienstplan-PDFs zu iCalendar-Dateien',
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog="""
|
||||
Beispiele:
|
||||
python3 pdf_to_ics.py # Konvertiere alle PDFs im aktuellen Verzeichnis
|
||||
python3 pdf_to_ics.py --input ./pdfs --output ./ics # PDFs aus ./pdfs → ICS zu ./ics
|
||||
python3 pdf_to_ics.py --input ./pdfs --exclude-rest # Schließe Ruhetage aus
|
||||
python3 pdf_to_ics.py --input ./pdfs --exclude-vacation # Schließe Urlaub (060) aus
|
||||
python3 pdf_to_ics.py file.pdf # Konvertiere einzelne Datei
|
||||
"""
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'pdf_file',
|
||||
nargs='?',
|
||||
help='Einzelne PDF-Datei zum Konvertieren (optional)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-i', '--input',
|
||||
type=str,
|
||||
default='.',
|
||||
help='Eingabe-Verzeichnis mit PDF-Dateien (Standard: aktuelles Verzeichnis)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-o', '--output',
|
||||
type=str,
|
||||
help='Ausgabe-Verzeichnis für ICS-Dateien (Standard: Eingabe-Verzeichnis)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-e', '--exclude-rest',
|
||||
action='store_true',
|
||||
help='Ruhetage ausschließen (Ruhe, R56, R36, vRWF48, RWE, vR48)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-u', '--exclude-vacation',
|
||||
action='store_true',
|
||||
help='Urlaub ausschließen (060, 0060)'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
action='store_true',
|
||||
help='Detaillierte Ausgabe'
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Bestimme Eingabe-Verzeichnis
|
||||
if args.pdf_file:
|
||||
# Einzelne Datei
|
||||
pdf_file = Path(args.pdf_file)
|
||||
if not pdf_file.exists():
|
||||
print(f"✗ Fehler: Datei nicht gefunden: {pdf_file}")
|
||||
sys.exit(1)
|
||||
pdf_files = [pdf_file]
|
||||
input_dir = pdf_file.parent
|
||||
else:
|
||||
# Verzeichnis
|
||||
input_dir = Path(args.input)
|
||||
if not input_dir.exists():
|
||||
print(f"✗ Fehler: Verzeichnis nicht gefunden: {input_dir}")
|
||||
sys.exit(1)
|
||||
pdf_files = sorted(input_dir.glob('*.pdf'))
|
||||
|
||||
# Bestimme Ausgabe-Verzeichnis
|
||||
output_dir = Path(args.output) if args.output else input_dir
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if not pdf_files:
|
||||
print("Keine PDF-Dateien gefunden!")
|
||||
print(f"⚠ Keine PDF-Dateien gefunden in: {input_dir}")
|
||||
return
|
||||
|
||||
if args.verbose:
|
||||
print(f"📂 Eingabe-Verzeichnis: {input_dir}")
|
||||
print(f"📂 Ausgabe-Verzeichnis: {output_dir}")
|
||||
print(f"📄 PDF-Dateien gefunden: {len(pdf_files)}")
|
||||
if args.exclude_rest:
|
||||
print("🧘 Ruhetage werden ausgeschlossen")
|
||||
if args.exclude_vacation:
|
||||
print("🏖️ Urlaub (060) wird ausgeschlossen")
|
||||
print()
|
||||
|
||||
success_count = 0
|
||||
error_count = 0
|
||||
|
||||
for pdf_file in pdf_files:
|
||||
print(f"\nVerarbeite: {pdf_file}")
|
||||
print(f"\n▶ Verarbeite: {pdf_file.name}")
|
||||
|
||||
try:
|
||||
# Extrahiere Daten
|
||||
dienstplan = extract_dienstplan_data(str(pdf_file))
|
||||
|
||||
print(f"Name: {dienstplan['vorname']} {dienstplan['name']}")
|
||||
print(f"Personalnummer: {dienstplan['personalnummer']}")
|
||||
print(f"Betriebshof: {dienstplan['betriebshof']}")
|
||||
print(f"Anzahl der Events: {len(dienstplan['events'])}")
|
||||
if args.verbose:
|
||||
print(f" Name: {dienstplan['vorname']} {dienstplan['name']}")
|
||||
print(f" Personalnummer: {dienstplan['personalnummer']}")
|
||||
print(f" Betriebshof: {dienstplan['betriebshof']}")
|
||||
print(f" Anzahl der Events: {len(dienstplan['events'])}")
|
||||
|
||||
if not dienstplan['events']:
|
||||
print(f" ⚠️ Warnung: Keine Events gefunden!")
|
||||
error_count += 1
|
||||
continue
|
||||
|
||||
# Erstelle ICS-Datei
|
||||
ics_path = pdf_file.with_suffix('.ics')
|
||||
create_ics_from_dienstplan(dienstplan, str(ics_path))
|
||||
ics_filename = pdf_file.stem + '.ics'
|
||||
ics_path = output_dir / ics_filename
|
||||
create_ics_from_dienstplan(
|
||||
dienstplan,
|
||||
str(ics_path),
|
||||
exclude_rest=args.exclude_rest,
|
||||
exclude_vacation=args.exclude_vacation
|
||||
)
|
||||
|
||||
print(f"✓ ICS-Datei erstellt: {ics_path}")
|
||||
print(f" ✓ ICS erstellt: {ics_path}")
|
||||
success_count += 1
|
||||
|
||||
except Exception as e:
|
||||
print(f"✗ Fehler bei {pdf_file}: {e}")
|
||||
print(f" ✗ Fehler: {str(e)}")
|
||||
if args.verbose:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
error_count += 1
|
||||
|
||||
# Zusammenfassung
|
||||
print("\n" + "="*50)
|
||||
print(f"✅ Fertig!")
|
||||
print(f" Erfolgreich: {success_count}")
|
||||
print(f" Fehler: {error_count}")
|
||||
print("="*50)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,7 +10,7 @@ REM Überprüfe, ob venv existiert
|
||||
if not exist ".venv" (
|
||||
echo Python-Umgebung wird eingerichtet...
|
||||
python3 -m venv .venv
|
||||
call .venv\Scripts\pip.exe install -q pdfplumber icalendar pypdf2 pytz
|
||||
call .venv\Scripts\pip.exe install -q pdfplumber icalendar pypdf2 pytz packaging
|
||||
)
|
||||
|
||||
REM Starte das Menü
|
||||
|
||||
4
start.sh
4
start.sh
@@ -36,7 +36,7 @@ if ! $PYTHON_VENV -c "import pdfplumber" 2>/dev/null; then
|
||||
echo "📚 Installiere Abhängigkeiten..."
|
||||
|
||||
# Nutze python -m pip statt pip direkt
|
||||
if $PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz 2>/dev/null; then
|
||||
if $PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz packaging 2>/dev/null; then
|
||||
echo "✓ Abhängigkeiten installiert"
|
||||
else
|
||||
echo "❌ Installation fehlgeschlagen"
|
||||
@@ -46,7 +46,7 @@ if ! $PYTHON_VENV -c "import pdfplumber" 2>/dev/null; then
|
||||
echo "❌ venv konnte nicht neu erstellt werden"
|
||||
exit 1
|
||||
}
|
||||
$PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz || {
|
||||
$PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz packaging || {
|
||||
echo "❌ Abhängigkeiten konnten nicht installiert werden"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -19,13 +19,28 @@ REM Überprüfe, ob Abhängigkeiten installiert sind
|
||||
.venv\Scripts\python.exe -c "import pdfplumber" 2>nul
|
||||
if errorlevel 1 (
|
||||
echo 📚 Installiere Abhängigkeiten...
|
||||
call .venv\Scripts\python.exe -m pip install -q pdfplumber icalendar pypdf2 pytz
|
||||
call .venv\Scripts\python.exe -m pip install -q pdfplumber icalendar pypdf2 pytz packaging
|
||||
echo ✓ Abhängigkeiten installiert
|
||||
)
|
||||
|
||||
REM Überprüfe, ob wxPython installiert ist
|
||||
.venv\Scripts\python.exe -c "import wx" 2>nul
|
||||
if errorlevel 1 (
|
||||
echo 📚 Installiere wxPython...
|
||||
call .venv\Scripts\python.exe -m pip install -q wxPython
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo ❌ wxPython konnte nicht installiert werden.
|
||||
echo Bitte installieren Sie Visual C++ Build Tools und versuchen Sie es erneut.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo ✓ wxPython installiert
|
||||
)
|
||||
|
||||
REM Starte die GUI
|
||||
echo 🎨 Starte GUI...
|
||||
call .venv\Scripts\pythonw.exe gui.py
|
||||
call .venv\Scripts\pythonw.exe gui_wxpython.py
|
||||
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
|
||||
27
start_gui.sh
27
start_gui.sh
@@ -31,11 +31,11 @@ fi
|
||||
# Nutze Python aus venv
|
||||
PYTHON_VENV=".venv/bin/python"
|
||||
|
||||
# Überprüfe, ob Abhängigkeiten installiert sind
|
||||
if ! $PYTHON_VENV -c "import pdfplumber" 2>/dev/null; then
|
||||
# Überprüfe, ob Kern-Abhängigkeiten installiert sind
|
||||
if ! $PYTHON_VENV -c "import pdfplumber, icalendar, pypdf2, pytz, packaging" 2>/dev/null; then
|
||||
echo "📚 Installiere Abhängigkeiten..."
|
||||
|
||||
if $PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz 2>/dev/null; then
|
||||
if $PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz packaging 2>/dev/null; then
|
||||
echo "✓ Abhängigkeiten installiert"
|
||||
else
|
||||
echo "❌ Installation fehlgeschlagen"
|
||||
@@ -45,7 +45,7 @@ if ! $PYTHON_VENV -c "import pdfplumber" 2>/dev/null; then
|
||||
echo "❌ venv konnte nicht neu erstellt werden"
|
||||
exit 1
|
||||
}
|
||||
$PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz || {
|
||||
$PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz packaging || {
|
||||
echo "❌ Abhängigkeiten konnten nicht installiert werden"
|
||||
exit 1
|
||||
}
|
||||
@@ -53,16 +53,25 @@ if ! $PYTHON_VENV -c "import pdfplumber" 2>/dev/null; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Versuche tkinterdnd2 zu installieren (optional für Drag & Drop)
|
||||
if ! $PYTHON_VENV -c "import tkinterdnd2" 2>/dev/null; then
|
||||
echo "💡 Installiere tkinterdnd2 für Drag & Drop (optional)..."
|
||||
$PYTHON_VENV -m pip install -q tkinterdnd2 2>/dev/null && echo "✓ Drag & Drop aktiviert" || echo "ℹ️ Drag & Drop nicht verfügbar (kein Problem)"
|
||||
# Überprüfe, ob wxPython installiert ist
|
||||
if ! $PYTHON_VENV -c "import wx" 2>/dev/null; then
|
||||
echo "📚 Installiere wxPython..."
|
||||
if $PYTHON_VENV -m pip install wxPython; then
|
||||
echo "✓ wxPython installiert"
|
||||
else
|
||||
echo "❌ wxPython konnte nicht installiert werden"
|
||||
echo "💡 Auf Linux fehlen ggf. Build-Abhängigkeiten. Unter Debian/Ubuntu/Mint oft hilfreich:"
|
||||
echo " sudo apt-get update"
|
||||
echo " sudo apt-get install -y build-essential python3-dev libgtk-3-dev libglib2.0-dev libjpeg-dev libtiff-dev libpng-dev"
|
||||
echo " rm -rf .venv && ./start_gui.sh"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Starte die GUI
|
||||
echo "🎨 Starte GUI..."
|
||||
if [ -f "$PYTHON_VENV" ]; then
|
||||
$PYTHON_VENV gui.py
|
||||
$PYTHON_VENV gui_wxpython.py
|
||||
else
|
||||
echo "❌ Fehler: Python-Umgebung ist beschädigt"
|
||||
echo "📁 Bitte löschen Sie das .venv Verzeichnis und versuchen Sie erneut:"
|
||||
|
||||
@@ -7,7 +7,11 @@ Prüft auf Updates über Gitea API
|
||||
import urllib.request
|
||||
import json
|
||||
from pathlib import Path
|
||||
from packaging import version as pkg_version
|
||||
|
||||
try:
|
||||
from packaging import version as pkg_version
|
||||
except Exception: # pragma: no cover - packaging may be missing in user envs
|
||||
pkg_version = None
|
||||
|
||||
# Gitea-Konfiguration
|
||||
GITEA_URL = "https://git.file-archive.de"
|
||||
@@ -81,14 +85,53 @@ def check_for_updates():
|
||||
|
||||
try:
|
||||
# Vergleiche Versionen
|
||||
if pkg_version is not None:
|
||||
if pkg_version.parse(latest) > pkg_version.parse(current):
|
||||
return True, latest, url
|
||||
else:
|
||||
if _simple_version_compare(latest, current) > 0:
|
||||
return True, latest, url
|
||||
except Exception as e:
|
||||
print(f"Warnung: Versionenvergleich fehlgeschlagen: {e}")
|
||||
|
||||
return False, None, None
|
||||
|
||||
|
||||
def _simple_version_compare(left, right):
|
||||
"""
|
||||
Fallback-Versionsvergleich ohne externe Abhaengigkeiten.
|
||||
Gibt 1 zurueck wenn left > right, -1 wenn left < right, sonst 0.
|
||||
"""
|
||||
def to_parts(value):
|
||||
parts = []
|
||||
for item in value.replace("v", "").split("."):
|
||||
try:
|
||||
parts.append(int(item))
|
||||
except ValueError:
|
||||
parts.append(item)
|
||||
return parts
|
||||
|
||||
left_parts = to_parts(left)
|
||||
right_parts = to_parts(right)
|
||||
max_len = max(len(left_parts), len(right_parts))
|
||||
|
||||
for i in range(max_len):
|
||||
l_val = left_parts[i] if i < len(left_parts) else 0
|
||||
r_val = right_parts[i] if i < len(right_parts) else 0
|
||||
if l_val == r_val:
|
||||
continue
|
||||
try:
|
||||
return 1 if l_val > r_val else -1
|
||||
except TypeError:
|
||||
l_str = str(l_val)
|
||||
r_str = str(r_val)
|
||||
if l_str == r_str:
|
||||
continue
|
||||
return 1 if l_str > r_str else -1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Test
|
||||
current = get_current_version()
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.0
|
||||
1.2.2
|
||||
|
||||
Reference in New Issue
Block a user