Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60f4b7dcef | |||
| 40b778b41b | |||
| 6fcf706d96 | |||
| 8b29214abd | |||
| ac654a6f7c | |||
| cedd9bfa0f | |||
| 62d0af9fe3 | |||
| b30bb0ed2d | |||
| 5ecad6ce89 | |||
| 2daa77e85d |
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"enabledPlugins": {
|
|
||||||
"feature-dev@claude-plugins-official": true
|
|
||||||
},
|
|
||||||
"permissions": {
|
|
||||||
"allow": [
|
|
||||||
"Bash(uv version)",
|
|
||||||
"Bash(uv run ruff check)",
|
|
||||||
"Bash(uv run ruff check *)",
|
|
||||||
"Bash(uv tree)"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
---
|
|
||||||
name: dep-update-check
|
|
||||||
description: Prüft manuell, ob Python-Version und Projekt-Dependencies aktualisiert werden können, und testet die Kompatibilität. Verwende diesen Skill AUSSCHLIESSLICH wenn der Benutzer explizit danach fragt – z.B. '/dep-update-check', 'Prüfe Dependencies', 'Sind Updates verfügbar?', 'Kann ich Python updaten?'. Niemals automatisch auslösen.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Dependency & Python Update Check
|
|
||||||
|
|
||||||
Dieser Skill prüft systematisch, welche Updates für das DocuMentor-Projekt verfügbar sind und ob sie kompatibel miteinander sind. Verwendete Werkzeuge: `uv`, `pyproject.toml`.
|
|
||||||
|
|
||||||
## Ablauf
|
|
||||||
|
|
||||||
Führe alle Schritte der Reihe nach aus und erstelle am Ende einen übersichtlichen Report.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Schritt 1: Python-Versionscheck
|
|
||||||
|
|
||||||
Lies die Python-Constraint aus `pyproject.toml` (Feld `requires-python`).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
grep "requires-python" pyproject.toml
|
|
||||||
```
|
|
||||||
|
|
||||||
Prüfe dann, welche stabilen Python-Versionen im erlaubten Bereich verfügbar sind:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv python list
|
|
||||||
```
|
|
||||||
|
|
||||||
**Stabile Versionen** sind jene ohne Suffix wie `b1`, `rc1`, `a1` oder `+freethreaded`. Filtere Beta- und Release-Candidate-Versionen heraus.
|
|
||||||
|
|
||||||
Vergleiche:
|
|
||||||
- Aktuell verwendete Version: `uv run python --version`
|
|
||||||
- Neueste stabile verfügbare Version innerhalb der Constraints
|
|
||||||
|
|
||||||
Falls eine neuere stabile Version verfügbar ist, notiere dies für den Report.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Schritt 2: Veraltete Dependencies ermitteln
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv tree --outdated
|
|
||||||
```
|
|
||||||
|
|
||||||
Extrahiere daraus die **direkten** Projektabhängigkeiten (aus `pyproject.toml`, Abschnitte `[project] dependencies` und `[dependency-groups]`) und trenne sie von transitiven Abhängigkeiten.
|
|
||||||
|
|
||||||
Erstelle eine strukturierte Liste:
|
|
||||||
- Direkte Dependencies: Name, aktuelle Version, neueste Version
|
|
||||||
- Transitive Dependencies mit Updates (nur zur Information)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Schritt 3: Kompatibilitätstest
|
|
||||||
|
|
||||||
Sichere zunächst die aktuelle Lock-Datei:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp uv.lock uv.lock.backup
|
|
||||||
```
|
|
||||||
|
|
||||||
Versuche dann, alle Dependencies auf die neuesten kompatiblen Versionen aufzulösen:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv lock --upgrade 2>&1
|
|
||||||
```
|
|
||||||
|
|
||||||
**Interpretation:**
|
|
||||||
- `Resolved X packages` ohne Fehler → alle Updates sind kompatibel
|
|
||||||
- Fehlermeldungen über Versionskonflikte → notiere welche Pakete sich gegenseitig blockieren
|
|
||||||
- Prüfe ob `uv.lock` verändert wurde: `diff uv.lock.backup uv.lock | head -50`
|
|
||||||
|
|
||||||
Stelle die Lock-Datei wieder her (wir wollen die Umgebung nicht tatsächlich ändern):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mv uv.lock.backup uv.lock
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Schritt 4: Report erstellen
|
|
||||||
|
|
||||||
Gib den Report im folgenden Format aus:
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 🐍 Python-Version
|
|
||||||
|
|
||||||
| | Version |
|
|
||||||
|---|---|
|
|
||||||
| Aktuell in Verwendung | z.B. 3.13.11 |
|
|
||||||
| Neueste stabile im erlaubten Bereich | z.B. 3.13.13 |
|
|
||||||
| Update empfohlen? | Ja / Nein |
|
|
||||||
|
|
||||||
Falls ein Python-Update verfügbar ist, zeige den Befehl:
|
|
||||||
```bash
|
|
||||||
uv python install 3.X.Y
|
|
||||||
# Dann in pyproject.toml requires-python anpassen falls nötig
|
|
||||||
# Danach: uv sync
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 📦 Direkte Dependencies
|
|
||||||
|
|
||||||
Tabelle mit Spalten: Paket | Aktuell | Verfügbar | Status
|
|
||||||
|
|
||||||
Status-Symbole:
|
|
||||||
- ✅ Aktuell
|
|
||||||
- ⬆️ Update verfügbar
|
|
||||||
- ⚠️ Update verfügbar, aber Kompatibilitätsproblem
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 🔗 Transitive Dependencies (Auswahl)
|
|
||||||
|
|
||||||
Nur falls es relevante Updates gibt, kurze Liste.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 🔄 Kompatibilitäts-Ergebnis
|
|
||||||
|
|
||||||
Klares Fazit:
|
|
||||||
- Können alle direkten Dependencies gleichzeitig aktualisiert werden? Ja/Nein
|
|
||||||
- Falls Nein: Welche Konflikte bestehen und warum?
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 📋 Empfohlene Aktion
|
|
||||||
|
|
||||||
Falls Updates verfügbar und kompatibel:
|
|
||||||
```bash
|
|
||||||
uv sync --upgrade
|
|
||||||
```
|
|
||||||
|
|
||||||
Falls nur einzelne Pakete aktualisiert werden sollen:
|
|
||||||
```bash
|
|
||||||
uv add paketname>=neue.version
|
|
||||||
```
|
|
||||||
|
|
||||||
Falls Python aktualisiert werden soll (nur wenn innerhalb der Constraints):
|
|
||||||
```bash
|
|
||||||
uv python install 3.X.Y
|
|
||||||
uv sync
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Hinweise
|
|
||||||
|
|
||||||
- **Nie `uv sync --upgrade` automatisch ausführen** – nur im Report vorschlagen, der Benutzer entscheidet.
|
|
||||||
- Beta/RC-Python-Versionen werden nicht empfohlen (erkennbar an Suffixen wie `b1`, `rc1`).
|
|
||||||
- `pyarrow` und andere native Pakete können bei Python-Upgrades besondere Anforderungen haben – darauf hinweisen falls relevant.
|
|
||||||
- Wenn der `uv lock --upgrade`-Test fehlschlägt, die Lock-Datei **immer** aus dem Backup wiederherstellen.
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
---
|
|
||||||
name: license-check
|
|
||||||
description: "Prüft und aktualisiert THIRD_PARTY_LICENSES.txt bei Dependency-Änderungen. Verwende diesen Skill IMMER zusammen mit dem version-bump Skill wenn der Benutzer einen Git-Commit erstellen möchte, 'commit' erwähnt, oder nach /commit fragt. Der Skill erkennt automatisch ob sich Dependencies in pyproject.toml geändert haben und aktualisiert die Lizenzdatei entsprechend."
|
|
||||||
---
|
|
||||||
|
|
||||||
# License Check Skill
|
|
||||||
|
|
||||||
Dieser Skill stellt sicher, dass die Datei `THIRD_PARTY_LICENSES.txt` immer synchron mit den tatsächlichen Dependencies in `pyproject.toml` bleibt. Er wird automatisch als Teil des Commit-Workflows ausgeführt, parallel zum version-bump Skill.
|
|
||||||
|
|
||||||
## Warum das wichtig ist
|
|
||||||
|
|
||||||
DocuMentor listet alle verwendeten Drittanbieter-Bibliotheken mit Lizenzinformationen in `THIRD_PARTY_LICENSES.txt` auf. Wenn Dependencies hinzugefügt oder entfernt werden, muss diese Datei aktualisiert werden — sonst sind die Lizenzangaben unvollständig oder veraltet, was rechtliche Konsequenzen haben kann.
|
|
||||||
|
|
||||||
## Ablauf
|
|
||||||
|
|
||||||
### Schritt 1: Prüfskript ausführen
|
|
||||||
|
|
||||||
Führe das gebündelte Prüfskript aus:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python .claude/skills/license-check/scripts/check_licenses.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Das Skript gibt JSON aus mit:
|
|
||||||
- `missing`: Dependencies in pyproject.toml die in THIRD_PARTY_LICENSES.txt fehlen
|
|
||||||
- `removed`: Einträge in THIRD_PARTY_LICENSES.txt die nicht mehr in pyproject.toml stehen
|
|
||||||
- `info`: Automatisch ermittelte Lizenz-Metadaten für fehlende Pakete
|
|
||||||
|
|
||||||
### Schritt 2: Ergebnis auswerten
|
|
||||||
|
|
||||||
- Wenn `missing` und `removed` beide leer sind: **Keine Aktion nötig.** Fahre direkt mit dem Commit fort.
|
|
||||||
- Wenn es Änderungen gibt: Zeige dem Benutzer eine Zusammenfassung und frage ob die Lizenzdatei aktualisiert werden soll.
|
|
||||||
|
|
||||||
Beispiel-Zusammenfassung:
|
|
||||||
```
|
|
||||||
Lizenzdatei-Prüfung:
|
|
||||||
+ lxml (BSD License) — neu hinzuzufügen
|
|
||||||
- some-old-lib — aus Lizenzdatei zu entfernen
|
|
||||||
```
|
|
||||||
|
|
||||||
### Schritt 3: THIRD_PARTY_LICENSES.txt aktualisieren
|
|
||||||
|
|
||||||
#### Neue Dependencies hinzufügen
|
|
||||||
|
|
||||||
Füge neue Einträge in die passende Sektion ein (Python-Abhängigkeiten oder Eingebettete Bibliotheken). Verwende das bestehende Format:
|
|
||||||
|
|
||||||
```
|
|
||||||
N. PaketName
|
|
||||||
Version: >=X.Y.Z
|
|
||||||
Lizenz: Lizenzname
|
|
||||||
Webseite: https://...
|
|
||||||
GitHub: https://github.com/...
|
|
||||||
Beschreibung: Kurzbeschreibung auf Englisch
|
|
||||||
Copyright: Copyright (c) Jahr Autor
|
|
||||||
```
|
|
||||||
|
|
||||||
Dabei gilt:
|
|
||||||
- Die Nummerierung fortlaufend innerhalb der Sektion
|
|
||||||
- Dev-Dependencies bekommen den Suffix `(Development)` im Namen
|
|
||||||
- Transitive Dependencies bekommen den Suffix `(via HauptPaket)` im Namen
|
|
||||||
- Die Lizenzinfos aus dem `info`-Feld des Skripts verwenden
|
|
||||||
- Wenn das Skript keine Info liefert (Paket nicht installiert), recherchiere via Web
|
|
||||||
|
|
||||||
#### Sortierung
|
|
||||||
|
|
||||||
Die Reihenfolge der Einträge folgt der logischen Gruppierung:
|
|
||||||
1. Haupt-Dependencies (Runtime)
|
|
||||||
2. Transitive Dependencies direkt nach ihrem Eltern-Paket (z.B. ConnectorX nach Polars)
|
|
||||||
3. Dev-Dependencies am Ende der Python-Sektion
|
|
||||||
|
|
||||||
#### Entfernte Dependencies löschen
|
|
||||||
|
|
||||||
Entferne den kompletten Block (Name, Version, Lizenz, etc.) des entfernten Pakets und nummeriere die verbleibenden Einträge neu.
|
|
||||||
|
|
||||||
#### Neue Lizenztypen
|
|
||||||
|
|
||||||
Wenn eine neue Dependency eine Lizenz verwendet, die noch nicht im Abschnitt "Lizenztexte" am Ende der Datei aufgeführt ist, füge den Lizenztext dort hinzu. Gängige Lizenztexte (MIT, Apache 2.0, BSD-3-Clause) sind bereits vorhanden.
|
|
||||||
|
|
||||||
### Schritt 4: KNOWN_ALIASES aktualisieren
|
|
||||||
|
|
||||||
Wenn neue Dependencies hinzugefügt werden, prüfe ob das `KNOWN_ALIASES`-Dict in `.claude/skills/license-check/scripts/check_licenses.py` aktualisiert werden muss:
|
|
||||||
|
|
||||||
- Wenn der Paketname in pyproject.toml anders ist als in THIRD_PARTY_LICENSES.txt (z.B. durch Suffixe wie "(Development)" oder "(via X)")
|
|
||||||
- Wenn eine Dependency transitive Dependencies hat, die separat gelistet werden
|
|
||||||
|
|
||||||
### Schritt 5: Commit fortsetzen
|
|
||||||
|
|
||||||
Füge die geänderte `THIRD_PARTY_LICENSES.txt` (und ggf. `check_licenses.py`) zum Staging-Bereich hinzu und fahre mit dem normalen Commit-Workflow fort.
|
|
||||||
|
|
||||||
## Wichtige Hinweise
|
|
||||||
|
|
||||||
- Das Skript prüft nur **Python-Abhängigkeiten** und **eingebettete Bibliotheken** — externe Tools (Saxon, FOP, diff-pdf) werden ignoriert
|
|
||||||
- Die Lizenzdatei enthält auch den Abschnitt "Stand: Monat Jahr" am Ende — diesen bei Änderungen auf den aktuellen Monat aktualisieren
|
|
||||||
- `uv.lock` nicht manuell ändern — wird durch `uv sync` automatisch aktualisiert
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Vergleicht die Dependencies aus pyproject.toml mit den Einträgen in THIRD_PARTY_LICENSES.txt.
|
|
||||||
|
|
||||||
Gibt eine JSON-Ausgabe mit:
|
|
||||||
- missing: Dependencies die in pyproject.toml stehen aber nicht in THIRD_PARTY_LICENSES.txt
|
|
||||||
- removed: Einträge in THIRD_PARTY_LICENSES.txt die nicht mehr in pyproject.toml stehen
|
|
||||||
- version_changed: Dependencies deren Mindestversion sich geändert hat
|
|
||||||
- info: Metadaten zu fehlenden Paketen (Lizenz, Homepage, etc.)
|
|
||||||
"""
|
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import tomllib
|
|
||||||
from importlib.metadata import PackageNotFoundError, metadata
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
def parse_pyproject(pyproject_path: Path) -> dict[str, str]:
|
|
||||||
"""Parst pyproject.toml und extrahiert Dependencies mit Mindestversionen."""
|
|
||||||
with open(pyproject_path, "rb") as f:
|
|
||||||
data = tomllib.load(f)
|
|
||||||
|
|
||||||
deps: dict[str, str] = {}
|
|
||||||
|
|
||||||
# dependencies-Sektion
|
|
||||||
for dep_str in data.get("project", {}).get("dependencies", []):
|
|
||||||
m = re.match(r"([a-zA-Z0-9_-]+)(?:\[.*?\])?(?:>=([0-9.]+))?", dep_str)
|
|
||||||
if m:
|
|
||||||
deps[m.group(1).lower()] = m.group(2) or ""
|
|
||||||
|
|
||||||
# dependency-groups dev
|
|
||||||
for dep_str in data.get("dependency-groups", {}).get("dev", []):
|
|
||||||
if isinstance(dep_str, str):
|
|
||||||
m = re.match(r"([a-zA-Z0-9_-]+)(?:\[.*?\])?(?:>=([0-9.]+))?", dep_str)
|
|
||||||
if m:
|
|
||||||
deps[m.group(1).lower()] = m.group(2) or ""
|
|
||||||
|
|
||||||
return deps
|
|
||||||
|
|
||||||
|
|
||||||
def parse_licenses_file(licenses_path: Path) -> tuple[dict[str, str], dict[str, str]]:
|
|
||||||
"""Parst THIRD_PARTY_LICENSES.txt und extrahiert Paketnamen nach Sektion.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple[dict, dict]: (python_deps, embedded_libs) — jeweils lowercase key -> original name
|
|
||||||
"""
|
|
||||||
content = licenses_path.read_text(encoding="utf-8")
|
|
||||||
python_deps: dict[str, str] = {}
|
|
||||||
embedded_libs: dict[str, str] = {}
|
|
||||||
current_section = None
|
|
||||||
current_target = None
|
|
||||||
|
|
||||||
for line in content.splitlines():
|
|
||||||
if "Python-Abhängigkeiten" in line:
|
|
||||||
current_section = "python"
|
|
||||||
current_target = python_deps
|
|
||||||
continue
|
|
||||||
if "Eingebettete Bibliotheken" in line:
|
|
||||||
current_section = "embedded"
|
|
||||||
current_target = embedded_libs
|
|
||||||
continue
|
|
||||||
if "Externe Tools" in line or "Lizenztexte" in line:
|
|
||||||
current_section = None
|
|
||||||
current_target = None
|
|
||||||
continue
|
|
||||||
if current_target is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Nummerierter Eintrag: "1. PaketName" oder "1. PaketName (via X)"
|
|
||||||
entry_match = re.match(r"\s*\d+\.\s+(.+?)(?:\s+\(.*\))?\s*$", line)
|
|
||||||
if entry_match:
|
|
||||||
name = entry_match.group(1).strip()
|
|
||||||
current_target[name.lower()] = name
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Version-Zeile: " Version: >=X.Y.Z"
|
|
||||||
version_match = re.match(r"\s+Version:\s*>=?([\d.]+)", line)
|
|
||||||
if version_match and current_target:
|
|
||||||
last_key = list(current_target.keys())[-1]
|
|
||||||
current_target[last_key] = current_target[last_key] + "|" + version_match.group(1)
|
|
||||||
|
|
||||||
return python_deps, embedded_libs
|
|
||||||
|
|
||||||
|
|
||||||
# Mapping: pyproject-Name -> zugehörige Einträge in THIRD_PARTY_LICENSES.txt
|
|
||||||
# Deckt transitive Dependencies und Aliase mit Suffixen ab.
|
|
||||||
KNOWN_ALIASES = {
|
|
||||||
"pyside6": ["pyside6"],
|
|
||||||
"pydantic-settings": ["pydantic-settings", "pydantic"], # pydantic ist transitive Dep
|
|
||||||
"pydantic-yaml": ["pydantic-yaml"],
|
|
||||||
"polars": ["polars", "connectorx (via polars)", "pyarrow (via polars)"],
|
|
||||||
"connectorx": ["connectorx (via polars)"],
|
|
||||||
"psutil": ["psutil"],
|
|
||||||
"lxml": ["lxml"], # BSD-3-Clause, XML/XSLT-Parsing
|
|
||||||
"ruff": ["ruff (development)"],
|
|
||||||
"pyinstaller": ["pyinstaller (development)"],
|
|
||||||
"pillow": ["pillow (development)"],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def get_package_info(pkg_name: str) -> dict:
|
|
||||||
"""Holt Paket-Metadaten via importlib.metadata."""
|
|
||||||
info = {"name": pkg_name, "installed": False}
|
|
||||||
try:
|
|
||||||
m = metadata(pkg_name)
|
|
||||||
info["installed"] = True
|
|
||||||
info["version"] = m.get("Version", "")
|
|
||||||
info["summary"] = m.get("Summary", "")
|
|
||||||
|
|
||||||
# Lizenz ermitteln
|
|
||||||
license_expr = m.get("License-Expression") or ""
|
|
||||||
if not license_expr:
|
|
||||||
classifiers = [c for c in (m.get_all("Classifier") or []) if "License" in c]
|
|
||||||
if classifiers:
|
|
||||||
license_expr = classifiers[0].split(" :: ")[-1]
|
|
||||||
else:
|
|
||||||
lic_text = m.get("License") or ""
|
|
||||||
if "MIT" in lic_text:
|
|
||||||
license_expr = "MIT License"
|
|
||||||
elif "BSD" in lic_text:
|
|
||||||
license_expr = "BSD License"
|
|
||||||
elif "Apache" in lic_text:
|
|
||||||
license_expr = "Apache License 2.0"
|
|
||||||
elif "LGPL" in lic_text or "GPL" in lic_text:
|
|
||||||
license_expr = lic_text[:80]
|
|
||||||
else:
|
|
||||||
license_expr = lic_text[:80] if lic_text else "Unbekannt"
|
|
||||||
info["license"] = license_expr
|
|
||||||
|
|
||||||
# Homepage/GitHub
|
|
||||||
urls = m.get_all("Project-URL") or []
|
|
||||||
for url_entry in urls:
|
|
||||||
if "," in url_entry:
|
|
||||||
label, url = url_entry.split(",", 1)
|
|
||||||
label = label.strip().lower()
|
|
||||||
url = url.strip()
|
|
||||||
if "homepage" in label or "home-page" in label:
|
|
||||||
info["homepage"] = url
|
|
||||||
elif "repository" in label or "github" in label or "source" in label:
|
|
||||||
info["github"] = url
|
|
||||||
if "homepage" not in info:
|
|
||||||
homepage = m.get("Home-page")
|
|
||||||
if homepage:
|
|
||||||
info["homepage"] = homepage
|
|
||||||
|
|
||||||
# Author/Copyright
|
|
||||||
author = m.get("Author") or m.get("Author-email") or ""
|
|
||||||
info["author"] = author
|
|
||||||
|
|
||||||
except PackageNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return info
|
|
||||||
|
|
||||||
|
|
||||||
def normalize_name(name: str) -> str:
|
|
||||||
"""Normalisiert Paketnamen für Vergleich."""
|
|
||||||
return re.sub(r"[-_.]+", "-", name).lower().strip()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
project_root = Path(__file__).resolve().parents[4] # .claude/skills/license-check/scripts -> root
|
|
||||||
pyproject_path = project_root / "pyproject.toml"
|
|
||||||
licenses_path = project_root / "THIRD_PARTY_LICENSES.txt"
|
|
||||||
|
|
||||||
if not pyproject_path.exists():
|
|
||||||
print(json.dumps({"error": f"pyproject.toml nicht gefunden: {pyproject_path}"}))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if not licenses_path.exists():
|
|
||||||
print(json.dumps({"error": f"THIRD_PARTY_LICENSES.txt nicht gefunden: {licenses_path}"}))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
pyproject_deps = parse_pyproject(pyproject_path)
|
|
||||||
python_entries, embedded_entries = parse_licenses_file(licenses_path)
|
|
||||||
|
|
||||||
# Normalisiere Python-License-Entry-Keys
|
|
||||||
normalized_license_names = {}
|
|
||||||
for key in python_entries:
|
|
||||||
clean = re.sub(r"\s*\(.*?\)", "", key).strip()
|
|
||||||
normalized_license_names[normalize_name(clean)] = key
|
|
||||||
|
|
||||||
result = {
|
|
||||||
"pyproject_deps": {k: v for k, v in sorted(pyproject_deps.items())},
|
|
||||||
"python_license_entries": list(python_entries.keys()),
|
|
||||||
"embedded_license_entries": list(embedded_entries.keys()),
|
|
||||||
"missing": [],
|
|
||||||
"removed": [],
|
|
||||||
"info": {},
|
|
||||||
}
|
|
||||||
|
|
||||||
# Finde fehlende Dependencies
|
|
||||||
covered_in_licenses = set()
|
|
||||||
for dep_name in pyproject_deps:
|
|
||||||
norm = normalize_name(dep_name)
|
|
||||||
if norm in normalized_license_names:
|
|
||||||
covered_in_licenses.add(norm)
|
|
||||||
elif dep_name in KNOWN_ALIASES:
|
|
||||||
found = False
|
|
||||||
for alias in KNOWN_ALIASES[dep_name]:
|
|
||||||
alias_norm = normalize_name(re.sub(r"\s*\(.*?\)", "", alias))
|
|
||||||
if alias_norm in normalized_license_names:
|
|
||||||
found = True
|
|
||||||
covered_in_licenses.add(alias_norm)
|
|
||||||
if not found:
|
|
||||||
result["missing"].append(dep_name)
|
|
||||||
result["info"][dep_name] = get_package_info(dep_name)
|
|
||||||
else:
|
|
||||||
result["missing"].append(dep_name)
|
|
||||||
result["info"][dep_name] = get_package_info(dep_name)
|
|
||||||
|
|
||||||
# Finde entfernte Einträge (nur Python-Abhängigkeiten, NICHT eingebettete)
|
|
||||||
for norm_name, orig_key in normalized_license_names.items():
|
|
||||||
if norm_name not in covered_in_licenses:
|
|
||||||
# Prüfe ob es ein "via"-Eintrag ist
|
|
||||||
if "(via" in orig_key:
|
|
||||||
parent = re.search(r"\(via\s+(\w+)\)", orig_key)
|
|
||||||
if parent and normalize_name(parent.group(1)) in {normalize_name(d) for d in pyproject_deps}:
|
|
||||||
continue
|
|
||||||
# Prüfe ob es über KNOWN_ALIASES abgedeckt ist
|
|
||||||
is_alias = False
|
|
||||||
for dep, aliases in KNOWN_ALIASES.items():
|
|
||||||
if dep in pyproject_deps:
|
|
||||||
for alias in aliases:
|
|
||||||
if normalize_name(re.sub(r"\s*\(.*?\)", "", alias)) == norm_name:
|
|
||||||
is_alias = True
|
|
||||||
break
|
|
||||||
if is_alias:
|
|
||||||
break
|
|
||||||
if not is_alias:
|
|
||||||
result["removed"].append(orig_key)
|
|
||||||
|
|
||||||
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
---
|
|
||||||
name: version-bump
|
|
||||||
description: "Versionsverwaltung für DocuMentor-Commits. Verwende diesen Skill IMMER wenn der Benutzer einen Git-Commit erstellen möchte, 'commit' erwähnt, oder nach /commit fragt. Der Skill fragt vor dem Commit, ob die Programmversion aktualisiert werden soll, und aktualisiert alle versionsbezogenen Dateien einheitlich."
|
|
||||||
---
|
|
||||||
|
|
||||||
# Version Bump Skill
|
|
||||||
|
|
||||||
Dieser Skill stellt sicher, dass bei jedem Commit die Programmversion bewusst behandelt wird. Bevor der eigentliche Commit erstellt wird, wird der Benutzer gefragt, ob und wie die Version angepasst werden soll.
|
|
||||||
|
|
||||||
## Warum das wichtig ist
|
|
||||||
|
|
||||||
DocuMentor speichert die Version an mehreren Stellen gleichzeitig (pyproject.toml, Installer-Dateien, Lizenz-Footer). Wenn diese aus dem Takt geraten, entstehen inkonsistente Builds. Dieser Skill verhindert das, indem er alle Stellen auf einmal aktualisiert.
|
|
||||||
|
|
||||||
## Ablauf
|
|
||||||
|
|
||||||
### Schritt 1: Benutzer fragen
|
|
||||||
|
|
||||||
Bevor du den Commit erstellst, frage den Benutzer mit dem AskUserQuestion-Tool:
|
|
||||||
|
|
||||||
**Frage:** "Soll die Programmversion aktualisiert werden?"
|
|
||||||
|
|
||||||
Optionen:
|
|
||||||
- **Patch (X.Y.Z+1)** — Bugfix, kleine Änderung
|
|
||||||
- **Minor (X.Y+1.0)** — Neues Feature, Erweiterung
|
|
||||||
- **Major (X+1.0.0)** — Breaking Change, großer Meilenstein
|
|
||||||
- **Nein, Version beibehalten** — Keine Versionsänderung
|
|
||||||
|
|
||||||
Zeige dabei die aktuelle Version aus `pyproject.toml` in der Frage an.
|
|
||||||
|
|
||||||
### Schritt 2: Version aktualisieren (falls gewünscht)
|
|
||||||
|
|
||||||
Wenn der Benutzer eine Versionserhöhung wählt:
|
|
||||||
|
|
||||||
1. **`pyproject.toml`** — über `uv version --bump` aktualisieren (niemals direkt bearbeiten):
|
|
||||||
```bash
|
|
||||||
uv version --bump patch # für Patch
|
|
||||||
uv version --bump minor # für Minor
|
|
||||||
uv version --bump major # für Major
|
|
||||||
```
|
|
||||||
Nach dem Befehl die neue Version aus `pyproject.toml` auslesen — sie ist die Single Source of Truth.
|
|
||||||
|
|
||||||
2. **`DocuMentor.wxs`** — WiX Installer (z. B. Zeile mit `Version=`):
|
|
||||||
```xml
|
|
||||||
Version="X.Y.Z"
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **`installer.iss`** — Inno Setup (z. B. Zeile mit `#define MyAppVersion`):
|
|
||||||
```
|
|
||||||
#define MyAppVersion "X.Y.Z"
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **`THIRD_PARTY_LICENSES.txt`** — Lizenz-Footer (letzte Zeile):
|
|
||||||
```
|
|
||||||
Erstellt für: DocuMentor vX.Y.Z
|
|
||||||
```
|
|
||||||
|
|
||||||
Führe zuerst `uv version --bump` aus, lese danach die neue Version aus `pyproject.toml`, und aktualisiere dann die übrigen drei Dateien auf diesen Wert.
|
|
||||||
|
|
||||||
### Schritt 3: Commit erstellen
|
|
||||||
|
|
||||||
Nachdem die Versionsdateien aktualisiert wurden (oder der Benutzer "Nein" gewählt hat), erstelle den Commit ganz normal nach den üblichen Commit-Konventionen. Falls die Version geändert wurde, füge die geänderten Versionsdateien zum Commit hinzu.
|
|
||||||
|
|
||||||
## Wichtige Hinweise
|
|
||||||
|
|
||||||
- `pyproject.toml` **niemals direkt bearbeiten** — immer `uv version --bump` verwenden
|
|
||||||
- Die Version in `pyproject.toml` ist die Single Source of Truth; nach dem Bump dort auslesen
|
|
||||||
- `create_version_info.py` liest automatisch aus `pyproject.toml` — diese Datei muss nicht manuell angepasst werden
|
|
||||||
- `uv.lock` wird durch `uv sync` automatisch aktualisiert — nicht manuell ändern
|
|
||||||
- Wenn der Benutzer "Nein" wählt, einfach normal mit dem Commit fortfahren
|
|
||||||
@@ -6,20 +6,5 @@ dist/
|
|||||||
wheels/
|
wheels/
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
|
||||||
# PyInstaller
|
|
||||||
*.spec.bak
|
|
||||||
*.manifest
|
|
||||||
*.log
|
|
||||||
version_info.txt
|
|
||||||
|
|
||||||
# Generierte Icons (optional - entfernen falls Icons versioniert werden sollen)
|
|
||||||
# resources/icon.ico
|
|
||||||
|
|
||||||
# Virtual environments
|
# Virtual environments
|
||||||
.venv
|
.venv
|
||||||
|
|
||||||
# WiX Installer Build-Artefakte
|
|
||||||
ProductFiles.wxs
|
|
||||||
*.msi
|
|
||||||
*.wixpdb
|
|
||||||
.wix/
|
|
||||||
|
|||||||
@@ -1,404 +0,0 @@
|
|||||||
# DocuMentor Build-Anleitung
|
|
||||||
|
|
||||||
## Voraussetzungen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Dependencies installieren (inkl. Pillow für Icon-Generierung und PyInstaller)
|
|
||||||
uv sync --all-groups
|
|
||||||
```
|
|
||||||
|
|
||||||
Für MSI-Installer zusätzlich:
|
|
||||||
- **WiX Toolset v6**: `dotnet tool install --global wix --version 6.*`
|
|
||||||
> **Hinweis**: WiX v7+ erfordert die Akzeptanz der OSMF-EULA (`wix eula accept`). WiX v6 vermeidet diese Einschränkung.
|
|
||||||
|
|
||||||
Für Setup.exe zusätzlich:
|
|
||||||
- **Inno Setup**: https://jrsoftware.org/isdl.php
|
|
||||||
|
|
||||||
## Schnellstart: ZIP-Distribution erstellen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Automatischer Build (empfohlen)
|
|
||||||
uv run python build_windows.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Dies erstellt automatisch:
|
|
||||||
1. **Icon** (falls nicht vorhanden): `resources/icon.ico`
|
|
||||||
2. **Versionsinformationen**: `version_info.txt`
|
|
||||||
3. **Executable**: `dist/DocuMentor/DocuMentor.exe` (mit Icon und Versionsinformationen)
|
|
||||||
4. **ZIP-Archiv**: `dist/DocuMentor-YYYYMMDD-Windows.zip`
|
|
||||||
|
|
||||||
### Manuelle Build-Schritte
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Cleanup
|
|
||||||
rm -rf build/ dist/
|
|
||||||
|
|
||||||
# 2. PyInstaller ausführen
|
|
||||||
uv run pyinstaller --clean DocuMentor.spec
|
|
||||||
|
|
||||||
# 3. Testen
|
|
||||||
# Auf Windows: dist/DocuMentor/DocuMentor.exe
|
|
||||||
# Mit Wine: wine dist/DocuMentor/DocuMentor.exe
|
|
||||||
```
|
|
||||||
|
|
||||||
## MSI-Installer erstellen (WiX Toolset)
|
|
||||||
|
|
||||||
### Schritt 1: PyInstaller Build erstellen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python build_windows.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Schritt 2: ProductFiles.wxs generieren
|
|
||||||
|
|
||||||
**WICHTIG**: WiX v6 hat das `heat` Tool entfernt. Stattdessen wird ein Python-Skript verwendet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Generiert automatisch ProductFiles.wxs mit allen Dateien aus dist/DocuMentor
|
|
||||||
uv run python generate_wix_files.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Schritt 3: MSI kompilieren
|
|
||||||
|
|
||||||
```bash
|
|
||||||
wix build DocuMentor.wxs ProductFiles.wxs -o DocuMentor.msi
|
|
||||||
```
|
|
||||||
|
|
||||||
### Schritt 4: MSI testen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Installation (als Administrator)
|
|
||||||
msiexec /i DocuMentor.msi
|
|
||||||
|
|
||||||
# Silent Installation für Deployment
|
|
||||||
msiexec /i DocuMentor.msi /quiet /qn /norestart
|
|
||||||
|
|
||||||
# Deinstallation
|
|
||||||
msiexec /x DocuMentor.msi
|
|
||||||
```
|
|
||||||
|
|
||||||
### MSI-Vorteile
|
|
||||||
|
|
||||||
- Windows-Standard (`.msi` Format)
|
|
||||||
- Gruppen-Richtlinien-Deployment (GPO) für Enterprise
|
|
||||||
- Silent Installation (`msiexec /quiet`)
|
|
||||||
- Windows Installer Transaktionen und Rollback
|
|
||||||
- Patch-Unterstützung (.msp für Updates)
|
|
||||||
- Versionsupgrades automatisch verwaltet
|
|
||||||
|
|
||||||
### MSI-Build automatisieren
|
|
||||||
|
|
||||||
Alternativ zu den manuellen Schritten kann ein `build_msi.py` Skript verwendet werden:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python build_msi.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Dieses Skript führt `generate_wix_files.py` und `wix build` automatisch nacheinander aus.
|
|
||||||
|
|
||||||
## Setup.exe erstellen (Inno Setup)
|
|
||||||
|
|
||||||
1. **GUID generieren** für `installer.iss` (nur beim ersten Mal!):
|
|
||||||
```bash
|
|
||||||
uv run python generate_guid.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Kopiere die generierte GUID und füge sie in `installer.iss` bei `AppId` ein (Zeile ~22).
|
|
||||||
|
|
||||||
**WICHTIG**: Die GUID nur EINMAL generieren! Bei Updates dieselbe GUID verwenden.
|
|
||||||
|
|
||||||
2. **Windows-Build erstellen**:
|
|
||||||
```bash
|
|
||||||
uv run python build_windows.py
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Installer kompilieren**:
|
|
||||||
```bash
|
|
||||||
iscc installer.iss
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Ergebnis**:
|
|
||||||
- `dist/installer/DocuMentor-Setup-0.1.0.exe` (mit Icon und Versionsinformationen)
|
|
||||||
|
|
||||||
## Konfiguration anpassen
|
|
||||||
|
|
||||||
### Icon anpassen
|
|
||||||
|
|
||||||
**Option 1: Standard-Icon generieren**
|
|
||||||
```bash
|
|
||||||
uv run python create_icon.py
|
|
||||||
```
|
|
||||||
|
|
||||||
**Option 2: Eigenes Icon aus PNG erstellen**
|
|
||||||
```bash
|
|
||||||
uv run python create_icon.py ihr-logo.png
|
|
||||||
```
|
|
||||||
|
|
||||||
**Option 3: Manuell ICO-Datei platzieren**
|
|
||||||
1. Icon erstellen oder downloaden (`.ico` Format mit mehreren Größen)
|
|
||||||
2. Als `resources/icon.ico` speichern
|
|
||||||
3. Beim nächsten Build wird es automatisch verwendet
|
|
||||||
|
|
||||||
Das Icon wird automatisch verwendet für:
|
|
||||||
- Windows-Executable (DocuMentor.exe)
|
|
||||||
- Inno Setup Installer
|
|
||||||
- Desktop-Verknüpfungen
|
|
||||||
|
|
||||||
**Anforderungen:**
|
|
||||||
- Multi-Size ICO (16x16 bis 256x256 Pixel)
|
|
||||||
- Das `create_icon.py` Skript erstellt alle Größen automatisch
|
|
||||||
|
|
||||||
### Versionsinformationen
|
|
||||||
|
|
||||||
Versionsinformationen werden automatisch aus `pyproject.toml` generiert:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python create_version_info.py
|
|
||||||
```
|
|
||||||
|
|
||||||
**Version ändern:**
|
|
||||||
|
|
||||||
In `pyproject.toml`:
|
|
||||||
```toml
|
|
||||||
version = "0.2.0"
|
|
||||||
```
|
|
||||||
|
|
||||||
Auch aktualisieren in:
|
|
||||||
- `installer.iss` (Zeile 13: `#define MyAppVersion`)
|
|
||||||
|
|
||||||
Dann Versionsinformationen neu generieren:
|
|
||||||
```bash
|
|
||||||
uv run python create_version_info.py
|
|
||||||
```
|
|
||||||
|
|
||||||
**Was enthalten die Versionsinformationen:**
|
|
||||||
- Dateiversion und Produktversion
|
|
||||||
- Beschreibung und Copyright
|
|
||||||
- Anwendungsname
|
|
||||||
- Wird in Windows Explorer angezeigt (Rechtsklick → Eigenschaften → Details)
|
|
||||||
|
|
||||||
### Build-Größe reduzieren
|
|
||||||
|
|
||||||
In `DocuMentor.spec` Module ausschließen:
|
|
||||||
```python
|
|
||||||
excludes=[
|
|
||||||
'tkinter',
|
|
||||||
'matplotlib',
|
|
||||||
'test',
|
|
||||||
'unittest',
|
|
||||||
],
|
|
||||||
```
|
|
||||||
|
|
||||||
### One-File Build (alles in einer .exe)
|
|
||||||
|
|
||||||
In `DocuMentor.spec` ändern:
|
|
||||||
```python
|
|
||||||
exe = EXE(
|
|
||||||
pyz,
|
|
||||||
a.scripts,
|
|
||||||
a.binaries, # Uncomment
|
|
||||||
a.zipfiles, # Uncomment
|
|
||||||
a.datas, # Uncomment
|
|
||||||
[], # Comment out
|
|
||||||
exclude_binaries=False, # Ändern
|
|
||||||
# ...
|
|
||||||
name='DocuMentor',
|
|
||||||
onefile=True, # Hinzufügen
|
|
||||||
)
|
|
||||||
|
|
||||||
# COLLECT auskommentieren oder entfernen
|
|
||||||
```
|
|
||||||
|
|
||||||
**Achtung**: One-File ist langsamer beim Start (3-5 Sekunden).
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
### Lokales Testing (Linux/WSL)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build erstellen
|
|
||||||
uv run python build_windows.py
|
|
||||||
|
|
||||||
# Mit Wine testen
|
|
||||||
wine dist/DocuMentor/DocuMentor.exe
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing auf Windows
|
|
||||||
|
|
||||||
1. ZIP-Datei auf Windows-System kopieren
|
|
||||||
2. Entpacken
|
|
||||||
3. `DocuMentor.exe` starten
|
|
||||||
4. Features testen:
|
|
||||||
- [ ] Programmstart
|
|
||||||
- [ ] Einstellungsdialog öffnet beim ersten Start
|
|
||||||
- [ ] Projekt öffnen/erstellen
|
|
||||||
- [ ] Tree-Navigation
|
|
||||||
- [ ] XSL/XML-Dateien hinzufügen
|
|
||||||
- [ ] PDF-Generierung (mit konfigurierten Tools)
|
|
||||||
- [ ] PDF-Vergleich
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### "Module not found" beim Start
|
|
||||||
|
|
||||||
**Lösung A** — Einfache Python-Module: Hidden imports in `DocuMentor.spec` ergänzen:
|
|
||||||
```python
|
|
||||||
hiddenimports=[
|
|
||||||
'missing_module',
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
**Lösung B** — Packages mit nativen Extensions (Rust/C, z.B. `connectorx`):
|
|
||||||
`hiddenimports` allein reicht nicht, da PyInstaller die `__init__.py` ins PYZ-Archiv packt, aber die `.pyd`-Extension separat im Dateisystem erwartet. Stattdessen `collect_all` verwenden:
|
|
||||||
```python
|
|
||||||
from PyInstaller.utils.hooks import collect_all
|
|
||||||
cx_datas, cx_binaries, cx_hiddenimports = collect_all('problematic_package')
|
|
||||||
|
|
||||||
a = Analysis(
|
|
||||||
# ...
|
|
||||||
binaries=cx_binaries,
|
|
||||||
datas=cx_datas,
|
|
||||||
hiddenimports=cx_hiddenimports,
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Antivirus blockiert die .exe
|
|
||||||
|
|
||||||
**Ursache**: Unsigned executables werden oft als verdächtig eingestuft.
|
|
||||||
|
|
||||||
**Lösungen**:
|
|
||||||
1. Code-Signing-Zertifikat kaufen und verwenden
|
|
||||||
2. Bei Microsoft SmartScreen einreichen
|
|
||||||
3. Exception in Antivirus eintragen (für Tests)
|
|
||||||
|
|
||||||
### Executable ist zu groß (>200 MB)
|
|
||||||
|
|
||||||
**Lösungen**:
|
|
||||||
1. UPX-Kompression ist bereits aktiv
|
|
||||||
2. Ungenutzte Module excluden (siehe oben)
|
|
||||||
3. Virtual Environment aufräumen: `uv sync --no-dev`
|
|
||||||
|
|
||||||
### UI-Dateien nicht gefunden
|
|
||||||
|
|
||||||
**Problem**: `.ui` Dateien werden nicht gefunden.
|
|
||||||
|
|
||||||
**Lösung**: In `DocuMentor.spec` prüfen:
|
|
||||||
```python
|
|
||||||
datas=ui_files, # Muss gesetzt sein
|
|
||||||
```
|
|
||||||
|
|
||||||
Im Code müssen Ressource-Pfade PyInstaller-kompatibel aufgelöst werden:
|
|
||||||
```python
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
|
||||||
res_path = Path(sys._MEIPASS) / "res" / "data.sql"
|
|
||||||
else:
|
|
||||||
res_path = Path(__file__).parents[3] / "src" / "res" / "data.sql"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Automatisierung
|
|
||||||
|
|
||||||
### GitHub Actions (CI/CD)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Build Windows Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v1
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: uv run python build_windows.py
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
files: dist/*.zip
|
|
||||||
```
|
|
||||||
|
|
||||||
### Lokales Release-Skript
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/bash
|
|
||||||
# release.sh - Erstellt vollständiges Release
|
|
||||||
|
|
||||||
VERSION="0.1.0"
|
|
||||||
|
|
||||||
echo "Building DocuMentor v$VERSION..."
|
|
||||||
|
|
||||||
# 1. Build
|
|
||||||
uv run python build_windows.py
|
|
||||||
|
|
||||||
# 2. Installer (falls Inno Setup installiert)
|
|
||||||
if command -v iscc &> /dev/null; then
|
|
||||||
iscc installer.iss
|
|
||||||
echo "✓ Installer erstellt"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Release v$VERSION fertig!"
|
|
||||||
echo " • ZIP: dist/DocuMentor-*-Windows.zip"
|
|
||||||
echo " • Setup: dist/installer/DocuMentor-Setup-$VERSION.exe"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Distributions-Formate im Vergleich
|
|
||||||
|
|
||||||
| | ZIP | Setup.exe (Inno Setup) | MSI (WiX) |
|
|
||||||
|---|---|---|---|
|
|
||||||
| **Portabel** | Ja | Nein | Nein |
|
|
||||||
| **Installation nötig** | Nein | Ja | Ja |
|
|
||||||
| **Deinstallation** | Nein | Ja | Ja |
|
|
||||||
| **Start-Menü** | Nein | Ja | Ja |
|
|
||||||
| **GPO-Deployment** | Nein | Nein | Ja |
|
|
||||||
| **Silent Install** | — | Ja | Ja |
|
|
||||||
| **Rollback** | — | Nein | Ja |
|
|
||||||
| **Patch-Support** | — | Nein | Ja (.msp) |
|
|
||||||
|
|
||||||
## Externe Abhängigkeiten
|
|
||||||
|
|
||||||
DocuMentor benötigt diese Tools (NICHT im Installer enthalten):
|
|
||||||
|
|
||||||
1. **Java Runtime Environment (JRE) 11+** — Für Saxon und Apache FOP (https://adoptium.net/)
|
|
||||||
2. **Apache FOP** — XSL-FO zu PDF Konvertierung (https://xmlgraphics.apache.org/fop/)
|
|
||||||
3. **Saxon XSLT Prozessor** — XSLT 2.0/3.0 Transformationen (https://www.saxonica.com/)
|
|
||||||
4. **diff-pdf** — PDF-Vergleich (https://vslavik.github.io/diff-pdf/)
|
|
||||||
|
|
||||||
Nach der Installation müssen die Pfade zu diesen Tools in den DocuMentor-Einstellungen konfiguriert werden.
|
|
||||||
|
|
||||||
## Dokumentation für Endbenutzer
|
|
||||||
|
|
||||||
Die `dist/DocuMentor/README.txt` wird automatisch erstellt und enthält:
|
|
||||||
- Installationsanweisungen
|
|
||||||
- Liste der externen Abhängigkeiten
|
|
||||||
- Konfigurationshinweise
|
|
||||||
|
|
||||||
## Versionierung
|
|
||||||
|
|
||||||
Version in folgenden Dateien aktualisieren:
|
|
||||||
1. `pyproject.toml` — `version = "X.Y.Z"`
|
|
||||||
2. `installer.iss` — `#define MyAppVersion "X.Y.Z"`
|
|
||||||
|
|
||||||
Dann Versionsinformationen neu generieren:
|
|
||||||
```bash
|
|
||||||
uv run python create_version_info.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Lizenz und Rechtliches
|
|
||||||
|
|
||||||
- PySide6 (LGPL): Dynamische Verlinkung ist OK
|
|
||||||
- Polars (MIT): Unproblematisch
|
|
||||||
- Pydantic (MIT): Unproblematisch
|
|
||||||
|
|
||||||
Externe Tools (Saxon, FOP) haben eigene Lizenzen und müssen separat installiert werden.
|
|
||||||
@@ -6,24 +6,11 @@ Spreche mit mir auf Deutsch! (Communicate with me in German!)
|
|||||||
|
|
||||||
DocuMentor (ehemals xsl-validator) ist eine PySide6-basierte Desktop-Anwendung zur Verwaltung und Validierung von XSL-Transformationen mit XML-Dateien. Sie bietet eine GUI zur Konfiguration von Transformations-Toolchains (Saxon, Apache FOP, diff-pdf) und zur Verwaltung von PDF-Generierungsprojekten mit PostgreSQL-Datenbankintegration.
|
DocuMentor (ehemals xsl-validator) ist eine PySide6-basierte Desktop-Anwendung zur Verwaltung und Validierung von XSL-Transformationen mit XML-Dateien. Sie bietet eine GUI zur Konfiguration von Transformations-Toolchains (Saxon, Apache FOP, diff-pdf) und zur Verwaltung von PDF-Generierungsprojekten mit PostgreSQL-Datenbankintegration.
|
||||||
|
|
||||||
## Anvisiertes Nutzungsszenario
|
## PySide6-GUI
|
||||||
Der primäre Einsatz ist die kontinuierliche Weiterentwicklung von PDF-Dokumenten in Flexnow (Software zur Prüfungsverwaltung). Dabei handelt es sich beispielsweise um amtliche Urkunden, Zeugnisse und Bescheide.
|
- Beim Erstellen neuer Dialoge sollte immer eine passende UI-Datei erstellt werden
|
||||||
|
- Der Entwickler sollte später in der Lage sein, den neuen Dialog über die UI-Datei zu gestalten
|
||||||
Die Basis bilden etwa 100 XSL-Dateien. Die meisten sind mittels `<xsl:import/>` bzw. `<xsl:include/>` miteinander verknüpft (ähnlich der Klassen-Vererbung). Daher können sich Änderungen in einer XSL-Datei auf (unerwartet) viele andere auswirken. Um diese Auswirkungen im Auge zu behalten, wird DocuMentor entwickelt.
|
- Aus der UI-Datei wird in Visual Studio Code über eine Erweiterung automatisch eine .py-Datei erzeugt
|
||||||
|
- Die automatisch generierte .py-Datei muss in den Code eingebunden und verwendet werden
|
||||||
**Typischer Workflow:**
|
|
||||||
1. Entwickler führt benötigte Änderungen an den XSL-Dateien durch
|
|
||||||
2. Entwickler startet die Transformation im DocuMentor und begutachtet die generierte PDF-Diff
|
|
||||||
3. Prüfung: Wurden die richtigen PDF-Dateien geändert?
|
|
||||||
4. Prüfung: Hat die Änderung der XSL-Dateien die erhoffte Änderung in den PDF-Dateien ergeben?
|
|
||||||
|
|
||||||
Diese Schritte können sich mehrfach wiederholen.
|
|
||||||
|
|
||||||
Da der DocuMentor permanent im Hintergrund läuft, ist ein sparsamer Umgang mit RAM wichtig:
|
|
||||||
- Worker-Pools nach Verwendung herunterfahren
|
|
||||||
- Große Datenstrukturen frühzeitig freigeben
|
|
||||||
- Polars DataFrames statt Pandas (geringerer RAM-Verbrauch)
|
|
||||||
- Lazy Loading wo möglich
|
|
||||||
|
|
||||||
## Entwicklungskommandos
|
## Entwicklungskommandos
|
||||||
|
|
||||||
@@ -32,6 +19,7 @@ Dieses Projekt verwendet den `uv` Paketmanager (nicht pip oder poetry):
|
|||||||
```bash
|
```bash
|
||||||
uv sync # Abhängigkeiten installieren
|
uv sync # Abhängigkeiten installieren
|
||||||
uv run python src/main.py # Anwendung starten
|
uv run python src/main.py # Anwendung starten
|
||||||
|
uv run python test_hash_implementation.py # Hash-Tests ausführen
|
||||||
```
|
```
|
||||||
|
|
||||||
### Linting
|
### Linting
|
||||||
@@ -40,136 +28,6 @@ uv run ruff check # Code-Style prüfen (Zeilenlänge: 120)
|
|||||||
uv run ruff format # Code formatieren
|
uv run ruff format # Code formatieren
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tests
|
|
||||||
Dieses Projekt verwendet KEINE pytest/unittest-Frameworks. Tests sind standalone Python-Skripte:
|
|
||||||
```bash
|
|
||||||
uv run python test_hash_implementation.py # Hash-Tests
|
|
||||||
uv run python test_xml_hash_duplicate_detection.py # Duplikatserkennung
|
|
||||||
```
|
|
||||||
|
|
||||||
### Commit
|
|
||||||
Jedes mal bei Commit diese Skills nutzen:
|
|
||||||
|
|
||||||
- /license-check
|
|
||||||
- /version-bump
|
|
||||||
|
|
||||||
## Code-Style-Richtlinien
|
|
||||||
|
|
||||||
### Import-Organisation
|
|
||||||
|
|
||||||
Reihenfolge (keine Leerzeilen zwischen Gruppen):
|
|
||||||
```python
|
|
||||||
# 1. Standard Library
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import logging
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
# 2. Drittanbieter
|
|
||||||
from PySide6.QtCore import Qt, QThread, Signal
|
|
||||||
from PySide6.QtWidgets import QDialog, QMainWindow
|
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
# 3. Lokale Imports (IMMER absolute Imports, KEINE relativen .imports)
|
|
||||||
from conf import app_settings, TreeNode, XslFile
|
|
||||||
from ui.MainWindow import MainWindow
|
|
||||||
```
|
|
||||||
|
|
||||||
- `TYPE_CHECKING` für zirkuläre Import-Vermeidung nutzen
|
|
||||||
- Keine relativen Imports (`.` oder `..`)
|
|
||||||
|
|
||||||
### Type Annotations
|
|
||||||
|
|
||||||
Moderne Union-Syntax verwenden:
|
|
||||||
```python
|
|
||||||
# RICHTIG
|
|
||||||
def transform(xml_path: Path, params: dict[str, str]) -> tuple[bool, str]:
|
|
||||||
result: str | None = None
|
|
||||||
files: list[Path] = []
|
|
||||||
|
|
||||||
# FALSCH
|
|
||||||
def transform(xml_path, params): # Keine Annotations
|
|
||||||
result: Optional[str] = None # Alte Union-Syntax
|
|
||||||
files: List[Path] = [] # Großgeschriebene Types
|
|
||||||
```
|
|
||||||
|
|
||||||
### Naming Conventions
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Klassen: PascalCase
|
|
||||||
class SaxonWorkerPool:
|
|
||||||
|
|
||||||
# Funktionen/Methoden: snake_case
|
|
||||||
def transform_saxon(xml_file: Path) -> bool:
|
|
||||||
|
|
||||||
# Private Methoden: _snake_case mit Unterstrich
|
|
||||||
def _create_tree_item(self, node: TreeNode):
|
|
||||||
|
|
||||||
# Konstanten: UPPER_CASE
|
|
||||||
SAXON_WORKER_JAVA = """..."""
|
|
||||||
```
|
|
||||||
|
|
||||||
### Formatierung
|
|
||||||
- **Zeilenlänge:** 120 Zeichen (via Ruff konfiguriert)
|
|
||||||
- **Strings:** Bevorzugt Double-Quotes `"..."`, aber konsistent im File
|
|
||||||
- **Trailing Commas:** Bei mehrzeiligen Strukturen verwenden
|
|
||||||
|
|
||||||
### Error Handling
|
|
||||||
|
|
||||||
IMMER Logging statt `print()` verwenden:
|
|
||||||
```python
|
|
||||||
import logging
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
def transform(xml_path: Path) -> tuple[bool, str]:
|
|
||||||
try:
|
|
||||||
logger.info(f"Transformation gestartet: {xml_path}")
|
|
||||||
result = do_transform(xml_path)
|
|
||||||
return True, "Erfolg"
|
|
||||||
except FileNotFoundError as e:
|
|
||||||
error_msg = f"XML-Datei nicht gefunden: {xml_path}"
|
|
||||||
logger.error(error_msg)
|
|
||||||
return False, error_msg
|
|
||||||
except Exception as e:
|
|
||||||
error_msg = f"Fehler bei Transformation: {str(e)}"
|
|
||||||
logger.exception(error_msg) # Mit Stack Trace
|
|
||||||
return False, error_msg
|
|
||||||
```
|
|
||||||
|
|
||||||
- `logger.debug()` für Debugging-Infos
|
|
||||||
- `logger.info()` für normale Operationen
|
|
||||||
- `logger.warning()` für Warnungen
|
|
||||||
- `logger.error()` für Fehler ohne Stack Trace
|
|
||||||
- `logger.exception()` für Fehler MIT Stack Trace
|
|
||||||
- Fehlermeldungen auf Deutsch
|
|
||||||
|
|
||||||
### Docstrings
|
|
||||||
|
|
||||||
Google-Style auf Deutsch:
|
|
||||||
```python
|
|
||||||
def transform_xml_to_pdf(xml_path: Path, xsl_path: Path, output_dir: Path) -> tuple[bool, str]:
|
|
||||||
"""
|
|
||||||
Transformiert eine XML-Datei mit XSL zu PDF.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
xml_path: Pfad zur XML-Eingabedatei
|
|
||||||
xsl_path: Pfad zum XSL-Stylesheet
|
|
||||||
output_dir: Zielverzeichnis für PDF-Ausgabe
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple[bool, str]: (Erfolg, Fehlermeldung oder Info-Text)
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
FileNotFoundError: Wenn XML- oder XSL-Datei nicht existiert
|
|
||||||
"""
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pfadbehandlung
|
|
||||||
- Immer `pathlib.Path`-Objekte verwenden, keine Strings
|
|
||||||
- `expanduser()` und `expandvars()` für Benutzer-/Umgebungspfade verwenden
|
|
||||||
- Projektrelative Pfade werden als relativ gespeichert, zur Laufzeit gegen `project_dir` aufgelöst
|
|
||||||
|
|
||||||
## Architektur
|
## Architektur
|
||||||
|
|
||||||
### Konfigurationssystem (src/conf.py)
|
### Konfigurationssystem (src/conf.py)
|
||||||
@@ -223,24 +81,6 @@ Beim Erstellen neuer Dialoge:
|
|||||||
- Die UI-Datei wird automatisch als `.py`-Datei von einer VS Code Extension generiert
|
- Die UI-Datei wird automatisch als `.py`-Datei von einer VS Code Extension generiert
|
||||||
- Die generierte UI-Klasse in der Implementierungsdatei importieren und verwenden
|
- Die generierte UI-Klasse in der Implementierungsdatei importieren und verwenden
|
||||||
|
|
||||||
**UI-Import-Pattern:**
|
|
||||||
```python
|
|
||||||
from PySide6.QtWidgets import QDialog
|
|
||||||
from ui.JavaVmConfigDialog_ui import Ui_JavaVmConfigDialog
|
|
||||||
|
|
||||||
class JavaVmConfigDialog(QDialog):
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
super().__init__(parent)
|
|
||||||
self.ui = Ui_JavaVmConfigDialog()
|
|
||||||
self.ui.setupUi(self)
|
|
||||||
# Signale NACH setupUi() verbinden
|
|
||||||
self.ui.browseButton.clicked.connect(self._browse_file)
|
|
||||||
```
|
|
||||||
|
|
||||||
- UI-Klassen NIEMALS direkt erben, nur als `self.ui` Member
|
|
||||||
- Alle Widgets über `self.ui.widgetName` zugreifen
|
|
||||||
- Signal-Verbindungen immer NACH `setupUi()` aufrufen
|
|
||||||
|
|
||||||
### Hauptfenster (src/ui/MainWindow.py)
|
### Hauptfenster (src/ui/MainWindow.py)
|
||||||
|
|
||||||
Zentrale Schaltstelle der Anwendung mit mehreren wichtigen Verantwortlichkeiten:
|
Zentrale Schaltstelle der Anwendung mit mehreren wichtigen Verantwortlichkeiten:
|
||||||
@@ -262,13 +102,6 @@ Zentrale Schaltstelle der Anwendung mit mehreren wichtigen Verantwortlichkeiten:
|
|||||||
- `XmlHashCalculatorThread`: Hintergrund-blake2b-Hash-Berechnung für XML-Dateien
|
- `XmlHashCalculatorThread`: Hintergrund-blake2b-Hash-Berechnung für XML-Dateien
|
||||||
- `DatabaseTestThread` (in PostgreSqlConfigDialog): Asynchrones Testen von Datenbankverbindungen
|
- `DatabaseTestThread` (in PostgreSqlConfigDialog): Asynchrones Testen von Datenbankverbindungen
|
||||||
|
|
||||||
### XSL-Abhängigkeitsgraph (src/ui/XslDependencyDialog.py)
|
|
||||||
|
|
||||||
Interaktiver Dialog zur Visualisierung von `<xsl:import/>`- und `<xsl:include/>`-Abhängigkeiten zwischen XSL-Dateien:
|
|
||||||
- Sidebar mit Suchfilter zur Navigation
|
|
||||||
- Abhängigkeitsgraph-Darstellung via vis.js
|
|
||||||
- Parsing der XSL-Dateien mit lxml
|
|
||||||
|
|
||||||
### Hash-Berechnungssystem
|
### Hash-Berechnungssystem
|
||||||
|
|
||||||
Die Anwendung verwendet blake2b-Hashing zur Verfolgung von XML-Dateiänderungen:
|
Die Anwendung verwendet blake2b-Hashing zur Verfolgung von XML-Dateiänderungen:
|
||||||
@@ -284,40 +117,15 @@ Die Anwendung verwendet blake2b-Hashing zur Verfolgung von XML-Dateiänderungen:
|
|||||||
Die Anwendung unterstützt mehrere Qt-Themes:
|
Die Anwendung unterstützt mehrere Qt-Themes:
|
||||||
- Theme-Auswahlmenü wird dynamisch aus `QStyleFactory.keys()` befüllt
|
- Theme-Auswahlmenü wird dynamisch aus `QStyleFactory.keys()` befüllt
|
||||||
- Theme-Präferenz wird in `AppSettings.theme` gespeichert
|
- Theme-Präferenz wird in `AppSettings.theme` gespeichert
|
||||||
|
- Dark-Theme-Unterstützung via `qdarktheme` Paket (aktuell in main.py auskommentiert)
|
||||||
|
|
||||||
### Datenbankintegration
|
### Datenbankintegration
|
||||||
|
|
||||||
PostgreSQL-Integration mit Polars und ConnectorX:
|
PostgreSQL-Integration mit Polars und ConnectorX:
|
||||||
- Konfiguration wird im `PostgreSqlDb`-Modell mit SSL-Modus-Unterstützung gespeichert
|
- Konfiguration wird im `PostgreSqlDb`-Modell mit SSL-Modus-Unterstützung gespeichert
|
||||||
- SQL-Abfragen werden asynchron via `DatabaseQueryThread` im `DatabaseMixin` ausgeführt
|
- SQL-Abfragen werden via `_execute_sql_query()` im MainWindow ausgeführt
|
||||||
- Ergebnisse werden in Polars DataFrames geladen
|
- Ergebnisse werden in Polars DataFrames geladen
|
||||||
|
|
||||||
### Thread-basierte Operationen
|
|
||||||
|
|
||||||
```python
|
|
||||||
from PySide6.QtCore import QThread, Signal
|
|
||||||
|
|
||||||
class HashCalculatorThread(QThread):
|
|
||||||
progress = Signal(int)
|
|
||||||
finished = Signal(dict)
|
|
||||||
|
|
||||||
def __init__(self, files: list[Path]):
|
|
||||||
super().__init__()
|
|
||||||
self.files = files
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
for i, file_path in enumerate(self.files):
|
|
||||||
hash_value = calculate_hash(file_path)
|
|
||||||
self.progress.emit(i + 1)
|
|
||||||
self.finished.emit(results)
|
|
||||||
|
|
||||||
# Verwendung
|
|
||||||
thread = HashCalculatorThread(xml_files)
|
|
||||||
thread.progress.connect(self._on_progress)
|
|
||||||
thread.finished.connect(self._on_finished)
|
|
||||||
thread.start() # NICHT run() direkt aufrufen!
|
|
||||||
```
|
|
||||||
|
|
||||||
## Wichtige Konventionen
|
## Wichtige Konventionen
|
||||||
|
|
||||||
### Deutsche Sprache
|
### Deutsche Sprache
|
||||||
@@ -327,6 +135,11 @@ Die Codebasis verwendet Deutsch für:
|
|||||||
- Variablennamen wo kontextuell passend
|
- Variablennamen wo kontextuell passend
|
||||||
- Log-Meldungen
|
- Log-Meldungen
|
||||||
|
|
||||||
|
### Pfadbehandlung
|
||||||
|
- Immer `pathlib.Path`-Objekte verwenden, keine Strings
|
||||||
|
- `expanduser()` und `expandvars()` für Benutzer-/Umgebungspfade verwenden
|
||||||
|
- Projektrelative Pfade werden als relativ gespeichert, zur Laufzeit gegen `project_dir` aufgelöst
|
||||||
|
|
||||||
### ID-basierte Lookups
|
### ID-basierte Lookups
|
||||||
Konfigurationsentitäten (Tools, Datenbanken) werden in Projekten über ID referenziert. Die Hilfsmethoden des `Project`-Modells (`getXsl()`, `getJavaVm()`, etc.) verwenden, um IDs in Anzeigewerte aufzulösen.
|
Konfigurationsentitäten (Tools, Datenbanken) werden in Projekten über ID referenziert. Die Hilfsmethoden des `Project`-Modells (`getXsl()`, `getJavaVm()`, etc.) verwenden, um IDs in Anzeigewerte aufzulösen.
|
||||||
|
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
PyInstaller Konfiguration für DocuMentor
|
|
||||||
Erstellt eine eigenständige Windows-Executable ohne Python-Installation
|
|
||||||
"""
|
|
||||||
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
from importlib.metadata import PackageNotFoundError
|
|
||||||
from importlib.metadata import version as pkg_version
|
|
||||||
from pathlib import Path
|
|
||||||
from PyInstaller.utils.hooks import collect_all
|
|
||||||
|
|
||||||
block_cipher = None
|
|
||||||
|
|
||||||
# Projektpfad
|
|
||||||
project_root = Path(SPECPATH)
|
|
||||||
src_path = project_root / 'src'
|
|
||||||
|
|
||||||
# Versions-Snapshot erzeugen und ins Bundle einbetten
|
|
||||||
_packages_to_snapshot = [
|
|
||||||
"PySide6", "pydantic", "pydantic-settings", "pydantic-yaml",
|
|
||||||
"polars", "connectorx", "pyarrow", "psutil", "lxml",
|
|
||||||
"ruff", "pyinstaller", "pillow",
|
|
||||||
]
|
|
||||||
_versions_snapshot: dict[str, str] = {}
|
|
||||||
for _pkg in _packages_to_snapshot:
|
|
||||||
try:
|
|
||||||
_versions_snapshot[_pkg.lower()] = pkg_version(_pkg)
|
|
||||||
except PackageNotFoundError:
|
|
||||||
_versions_snapshot[_pkg.lower()] = ""
|
|
||||||
|
|
||||||
_versions_file = project_root / "versions.json"
|
|
||||||
_versions_file.write_text(json.dumps(_versions_snapshot), encoding="utf-8")
|
|
||||||
|
|
||||||
# connectorx komplett sammeln (Python-Code, native .pyd und Metadaten)
|
|
||||||
# PyInstaller erkennt connectorx nicht automatisch, da es zur Laufzeit
|
|
||||||
# von polars per importlib.import_module() geladen wird
|
|
||||||
cx_datas, cx_binaries, cx_hiddenimports = collect_all('connectorx')
|
|
||||||
|
|
||||||
# Alle UI-Dateien sammeln
|
|
||||||
ui_files = []
|
|
||||||
for ui_file in (src_path / 'ui').glob('*.ui'):
|
|
||||||
ui_files.append((str(ui_file), 'ui'))
|
|
||||||
|
|
||||||
# Ressource-Dateien (SQL, CSV) einbinden
|
|
||||||
res_files = []
|
|
||||||
for res_file in (src_path / 'res').glob('*'):
|
|
||||||
res_files.append((str(res_file), 'res'))
|
|
||||||
|
|
||||||
a = Analysis(
|
|
||||||
[str(src_path / 'main.py')],
|
|
||||||
pathex=[str(src_path)],
|
|
||||||
binaries=cx_binaries,
|
|
||||||
datas=ui_files + res_files + cx_datas + [
|
|
||||||
(str(project_root / 'pyproject.toml'), '.'),
|
|
||||||
(str(project_root / 'THIRD_PARTY_LICENSES.txt'), '.'),
|
|
||||||
(str(_versions_file), '.'),
|
|
||||||
(str(project_root / 'resources' / 'icon.ico'), 'resources'),
|
|
||||||
],
|
|
||||||
hiddenimports=[
|
|
||||||
'PySide6.QtCore',
|
|
||||||
'PySide6.QtGui',
|
|
||||||
'PySide6.QtWidgets',
|
|
||||||
'pydantic',
|
|
||||||
'pydantic_settings',
|
|
||||||
'pydantic_yaml',
|
|
||||||
'polars',
|
|
||||||
'pyarrow',
|
|
||||||
] + cx_hiddenimports,
|
|
||||||
hookspath=[],
|
|
||||||
hooksconfig={},
|
|
||||||
runtime_hooks=[],
|
|
||||||
excludes=[],
|
|
||||||
win_no_prefer_redirects=False,
|
|
||||||
win_private_assemblies=False,
|
|
||||||
cipher=block_cipher,
|
|
||||||
noarchive=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
|
||||||
|
|
||||||
exe = EXE(
|
|
||||||
pyz,
|
|
||||||
a.scripts,
|
|
||||||
[],
|
|
||||||
exclude_binaries=True,
|
|
||||||
name='DocuMentor',
|
|
||||||
debug=False,
|
|
||||||
bootloader_ignore_signals=False,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
console=False, # Keine Konsole anzeigen (GUI-Anwendung)
|
|
||||||
disable_windowed_traceback=False,
|
|
||||||
argv_emulation=False,
|
|
||||||
target_arch=None,
|
|
||||||
codesign_identity=None,
|
|
||||||
entitlements_file=None,
|
|
||||||
icon=str(project_root / 'resources' / 'icon.ico') if (project_root / 'resources' / 'icon.ico').exists() else None,
|
|
||||||
version=str(project_root / 'version_info.txt') if (project_root / 'version_info.txt').exists() else None,
|
|
||||||
)
|
|
||||||
|
|
||||||
coll = COLLECT(
|
|
||||||
exe,
|
|
||||||
a.binaries,
|
|
||||||
a.zipfiles,
|
|
||||||
a.datas,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
upx_exclude=[],
|
|
||||||
name='DocuMentor',
|
|
||||||
)
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
|
|
||||||
<!-- Paket-Definition (ersetzt Product in v4) -->
|
|
||||||
<Package
|
|
||||||
Name="DocuMentor"
|
|
||||||
Version="1.7.0"
|
|
||||||
Manufacturer="Vitali Graf / Software- und Datenbankentwicklung"
|
|
||||||
UpgradeCode="F498B66C-726D-44AA-95F4-CB4FBDCEF26E"
|
|
||||||
Language="1031"
|
|
||||||
Compressed="yes"
|
|
||||||
InstallerVersion="500">
|
|
||||||
|
|
||||||
<MajorUpgrade
|
|
||||||
DowngradeErrorMessage="Eine neuere Version ist bereits installiert."
|
|
||||||
AllowSameVersionUpgrades="yes" />
|
|
||||||
|
|
||||||
<!-- Media Template -->
|
|
||||||
<MediaTemplate EmbedCab="yes" />
|
|
||||||
|
|
||||||
<!-- Feature-Definition -->
|
|
||||||
<Feature Id="ProductFeature" Title="DocuMentor" Level="1">
|
|
||||||
<ComponentGroupRef Id="ProductComponents" />
|
|
||||||
<ComponentRef Id="ApplicationShortcut" />
|
|
||||||
<ComponentRef Id="DesktopShortcut" />
|
|
||||||
</Feature>
|
|
||||||
|
|
||||||
<!-- Minimal UI (Standard Windows Installer Dialog) -->
|
|
||||||
|
|
||||||
<!-- Icon -->
|
|
||||||
<Icon Id="icon.ico" SourceFile="resources\icon.ico"/>
|
|
||||||
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
|
|
||||||
<Property Id="ARPHELPLINK" Value="https://github.com/IhrRepo/DocuMentor" />
|
|
||||||
</Package>
|
|
||||||
|
|
||||||
<!-- Fragment: Verzeichnisstruktur -->
|
|
||||||
<Fragment>
|
|
||||||
<StandardDirectory Id="ProgramFilesFolder">
|
|
||||||
<Directory Id="INSTALLFOLDER" Name="DocuMentor" />
|
|
||||||
</StandardDirectory>
|
|
||||||
|
|
||||||
<StandardDirectory Id="ProgramMenuFolder">
|
|
||||||
<Directory Id="ApplicationProgramsFolder" Name="DocuMentor"/>
|
|
||||||
</StandardDirectory>
|
|
||||||
|
|
||||||
<StandardDirectory Id="DesktopFolder" />
|
|
||||||
</Fragment>
|
|
||||||
|
|
||||||
<!-- Fragment: Shortcuts -->
|
|
||||||
<Fragment>
|
|
||||||
<Component Id="ApplicationShortcut" Directory="ApplicationProgramsFolder" Guid="A498B66C-726D-44AA-95F4-CB4FBDCEF26E">
|
|
||||||
<Shortcut
|
|
||||||
Id="ApplicationStartMenuShortcut"
|
|
||||||
Name="DocuMentor"
|
|
||||||
Description="XSL-Transformations-Verwaltung"
|
|
||||||
Target="[INSTALLFOLDER]DocuMentor.exe"
|
|
||||||
WorkingDirectory="INSTALLFOLDER"
|
|
||||||
Icon="icon.ico" />
|
|
||||||
<RemoveFolder Id="CleanUpShortCut" On="uninstall"/>
|
|
||||||
<RegistryValue
|
|
||||||
Root="HKCU"
|
|
||||||
Key="Software\DocuMentor"
|
|
||||||
Name="installed"
|
|
||||||
Type="integer"
|
|
||||||
Value="1"
|
|
||||||
KeyPath="yes"/>
|
|
||||||
</Component>
|
|
||||||
|
|
||||||
<Component Id="DesktopShortcut" Directory="DesktopFolder" Guid="B498B66C-726D-44AA-95F4-CB4FBDCEF26E">
|
|
||||||
<Shortcut
|
|
||||||
Id="DesktopShortcutId"
|
|
||||||
Name="DocuMentor"
|
|
||||||
Target="[INSTALLFOLDER]DocuMentor.exe"
|
|
||||||
WorkingDirectory="INSTALLFOLDER"
|
|
||||||
Icon="icon.ico" />
|
|
||||||
<RegistryValue
|
|
||||||
Root="HKCU"
|
|
||||||
Key="Software\DocuMentor"
|
|
||||||
Name="desktopShortcut"
|
|
||||||
Type="integer"
|
|
||||||
Value="1"
|
|
||||||
KeyPath="yes"/>
|
|
||||||
</Component>
|
|
||||||
</Fragment>
|
|
||||||
|
|
||||||
</Wix>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2025 [Ihr Name / Your Name]
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,260 +0,0 @@
|
|||||||
# Lizenzübersicht für DocuMentor
|
|
||||||
|
|
||||||
## Verwendete Bibliotheken und ihre Lizenzen
|
|
||||||
|
|
||||||
### Python-Abhängigkeiten (aus pyproject.toml)
|
|
||||||
|
|
||||||
| Bibliothek | Version | Lizenz | Einschränkungen |
|
|
||||||
|------------|---------|--------|-----------------|
|
|
||||||
| **PySide6** | ≥6.9.1 | **LGPL-3.0 ODER GPL-2.0 ODER GPL-3.0** | ⚠️ Copyleft-Lizenz, siehe unten |
|
|
||||||
| Pydantic | ≥2.9.1 | MIT | ✅ Keine Einschränkungen |
|
|
||||||
| Pydantic-Settings | ≥2.9.1 | MIT | ✅ Keine Einschränkungen |
|
|
||||||
| Pydantic-YAML | ≥1.5.1 | MIT | ✅ Keine Einschränkungen |
|
|
||||||
| Polars | ≥1.31.0 | MIT | ✅ Keine Einschränkungen |
|
|
||||||
| ConnectorX | (via Polars) | MIT | ✅ Keine Einschränkungen |
|
|
||||||
| PyArrow | (via Polars) | Apache 2.0 | ✅ Keine Einschränkungen |
|
|
||||||
| pyqtdarktheme | ≥2.1.0 | MIT | ✅ Keine Einschränkungen |
|
|
||||||
| Ruff | ≥0.14.8 | MIT | ✅ Keine Einschränkungen (nur Dev) |
|
|
||||||
|
|
||||||
### Externe Tools (nicht in Python integriert)
|
|
||||||
|
|
||||||
| Tool | Lizenz | Verwendung | Einschränkungen |
|
|
||||||
|------|--------|------------|-----------------|
|
|
||||||
| **Saxon-HE** | Mozilla Public License 2.0 (MPL-2.0) | XSLT-Transformationen | ⚠️ Weak Copyleft |
|
|
||||||
| **Apache FOP** | Apache License 2.0 | PDF-Generierung | ✅ Keine Einschränkungen |
|
|
||||||
| diff-pdf | GPL-2.0 (vermutlich) | PDF-Vergleich | ⚠️ Nur externes Tool |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Kritische Lizenz: PySide6 (LGPL-3.0)
|
|
||||||
|
|
||||||
### Was bedeutet LGPL-3.0 für DocuMentor?
|
|
||||||
|
|
||||||
**LGPL (Lesser GNU Public License)** ist eine "schwächere" Version der GPL und wurde speziell für Bibliotheken entwickelt.
|
|
||||||
|
|
||||||
#### ✅ Was ist ERLAUBT:
|
|
||||||
- **Kommerzielle Nutzung** - Du kannst DocuMentor verkaufen
|
|
||||||
- **Proprietärer Code** - Dein Code muss NICHT Open Source sein
|
|
||||||
- **Private Nutzung** - Keine Verpflichtungen
|
|
||||||
- **Dynamisches Linking** - In Python automatisch gegeben (via pip/import)
|
|
||||||
|
|
||||||
#### ⚠️ Was ist ERFORDERLICH:
|
|
||||||
1. **LGPL-Lizenztext beilegen** - Du musst die LGPL-Lizenz mit verteilen
|
|
||||||
2. **Copyright-Hinweise** - Erwähne PySide6 und Qt in deiner Software
|
|
||||||
3. **Nutzern Bibliotheks-Austausch ermöglichen** - Bei Python automatisch erfüllt, da:
|
|
||||||
- Nutzer können `pip install pyside6==andere-version` ausführen
|
|
||||||
- Python-Module sind dynamisch geladen
|
|
||||||
4. **Änderungen an PySide6 veröffentlichen** - Falls du PySide6 selbst änderst (sehr unwahrscheinlich)
|
|
||||||
|
|
||||||
#### ❌ Was ist NICHT erforderlich:
|
|
||||||
- **Dein eigener Code** muss NICHT unter LGPL stehen
|
|
||||||
- **Dein Source Code** muss NICHT veröffentlicht werden
|
|
||||||
- **Deine Änderungen** an DocuMentor müssen NICHT Open Source sein
|
|
||||||
|
|
||||||
### Praktische Umsetzung für Python-Anwendungen
|
|
||||||
|
|
||||||
Da Python-Pakete über pip installiert werden und dynamisch importiert werden, sind die LGPL-Anforderungen bereits erfüllt:
|
|
||||||
- ✅ Dynamisches Linking durch `import PySide6`
|
|
||||||
- ✅ Nutzer können andere PySide6-Versionen installieren
|
|
||||||
- ✅ Keine statische Kompilierung in Binary
|
|
||||||
|
|
||||||
**Fazit:** Du kannst DocuMentor unter praktisch jeder Lizenz veröffentlichen, auch proprietär.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Empfohlene Lizenzen für DocuMentor
|
|
||||||
|
|
||||||
### Option 1: MIT License (EMPFOHLEN) ⭐
|
|
||||||
|
|
||||||
**Vorteile:**
|
|
||||||
- ✅ Einfachste und permissivste Lizenz
|
|
||||||
- ✅ Kompatibel mit LGPL und allen anderen verwendeten Lizenzen
|
|
||||||
- ✅ Erlaubt kommerzielle Nutzung ohne Einschränkungen
|
|
||||||
- ✅ Kurz und leicht verständlich
|
|
||||||
- ✅ Sehr verbreitet in der Open-Source-Community
|
|
||||||
- ✅ Gleiche Lizenz wie die meisten Dependencies (Pydantic, Polars, etc.)
|
|
||||||
|
|
||||||
**Nachteile:**
|
|
||||||
- Kein Patent-Schutz
|
|
||||||
- Keine Copyleft-Schutz (andere können proprietäre Forks erstellen)
|
|
||||||
|
|
||||||
**Wann verwenden:**
|
|
||||||
Wenn du maximale Freiheit für Nutzer möchtest und Open Source fördern willst, ohne strenge Bedingungen.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Option 2: Apache License 2.0
|
|
||||||
|
|
||||||
**Vorteile:**
|
|
||||||
- ✅ Kompatibel mit allen Dependencies
|
|
||||||
- ✅ Expliziter Patent-Schutz
|
|
||||||
- ✅ Erlaubt kommerzielle Nutzung
|
|
||||||
- ✅ Professioneller für größere Projekte
|
|
||||||
- ✅ Gleiche Lizenz wie Apache FOP
|
|
||||||
|
|
||||||
**Nachteile:**
|
|
||||||
- Etwas komplexer als MIT
|
|
||||||
- Erfordert NOTICE-Datei für Änderungen
|
|
||||||
|
|
||||||
**Wann verwenden:**
|
|
||||||
Wenn du Patent-Schutz möchtest und ein professionelleres Image für Enterprise-Nutzer brauchst.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Option 3: GPL-3.0 (Copyleft)
|
|
||||||
|
|
||||||
**Vorteile:**
|
|
||||||
- ✅ Kompatibel mit PySide6 (gleiche Lizenz)
|
|
||||||
- ✅ Starker Copyleft-Schutz - Alle Derivate müssen Open Source sein
|
|
||||||
- ✅ Schützt vor proprietären Forks
|
|
||||||
- ✅ Für reine Open-Source-Projekte ideal
|
|
||||||
|
|
||||||
**Nachteile:**
|
|
||||||
- ❌ Strenge Copyleft-Anforderungen
|
|
||||||
- ❌ Nutzer können DocuMentor nicht in proprietäre Software integrieren
|
|
||||||
- ❌ Weniger flexibel für kommerzielle Nutzung
|
|
||||||
|
|
||||||
**Wann verwenden:**
|
|
||||||
Wenn du sicherstellen willst, dass alle Modifikationen Open Source bleiben.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Option 4: LGPL-3.0
|
|
||||||
|
|
||||||
**Vorteile:**
|
|
||||||
- ✅ Gleiche Lizenz wie PySide6 (konsistent)
|
|
||||||
- ✅ Schwächerer Copyleft als GPL
|
|
||||||
- ✅ Erlaubt Verwendung in proprietärer Software
|
|
||||||
|
|
||||||
**Nachteile:**
|
|
||||||
- Komplexere Anforderungen als MIT/Apache
|
|
||||||
- Weniger verbreitet für Anwendungen (eher für Bibliotheken)
|
|
||||||
|
|
||||||
**Wann verwenden:**
|
|
||||||
Wenn du einen Kompromiss zwischen GPL und MIT möchtest.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Lizenz-Kompatibilitätsmatrix
|
|
||||||
|
|
||||||
```
|
|
||||||
DocuMentor Lizenz → Kompatibilität mit Dependencies
|
|
||||||
|
|
||||||
MIT ✅ Kompatibel mit allen
|
|
||||||
Apache 2.0 ✅ Kompatibel mit allen
|
|
||||||
GPL-3.0 ✅ Kompatibel mit allen
|
|
||||||
LGPL-3.0 ✅ Kompatibel mit allen
|
|
||||||
Proprietär ✅ Kompatibel mit allen (LGPL-Bedingungen beachten)
|
|
||||||
```
|
|
||||||
|
|
||||||
Alle genannten Lizenzen sind mit den verwendeten Bibliotheken kompatibel!
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Konkrete Empfehlung
|
|
||||||
|
|
||||||
### Für DocuMentor: **MIT License** ⭐
|
|
||||||
|
|
||||||
**Begründung:**
|
|
||||||
1. ✅ Die meisten Dependencies (Pydantic, Polars, pyqtdarktheme) sind MIT-lizenziert
|
|
||||||
2. ✅ LGPL-3.0 (PySide6) erlaubt die Verwendung in MIT-lizenzierter Software
|
|
||||||
3. ✅ Maximale Freiheit für Nutzer und Entwickler
|
|
||||||
4. ✅ Einfach und unkompliziert
|
|
||||||
5. ✅ Fördert Adoption und Beiträge
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Nächste Schritte
|
|
||||||
|
|
||||||
### 1. LICENSE-Datei erstellen
|
|
||||||
|
|
||||||
Erstelle eine `LICENSE` Datei im Root-Verzeichnis mit dem MIT-Lizenztext:
|
|
||||||
|
|
||||||
```
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2025 [Dein Name]
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. pyproject.toml aktualisieren
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[project]
|
|
||||||
name = "DocuMentor"
|
|
||||||
version = "0.1.0"
|
|
||||||
license = {text = "MIT"} # Füge diese Zeile hinzu
|
|
||||||
# ... rest bleibt gleich
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Copyright-Hinweise hinzufügen
|
|
||||||
|
|
||||||
Füge in jede Quellcode-Datei einen Header ein:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Copyright (c) 2025 [Dein Name]
|
|
||||||
# Licensed under the MIT License
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. THIRD_PARTY_LICENSES.txt erstellen
|
|
||||||
|
|
||||||
Erstelle eine Datei, die alle verwendeten Bibliotheken und ihre Lizenzen auflistet:
|
|
||||||
|
|
||||||
```
|
|
||||||
DocuMentor verwendet folgende Open-Source-Bibliotheken:
|
|
||||||
|
|
||||||
1. PySide6 - LGPL-3.0 OR GPL-2.0 OR GPL-3.0
|
|
||||||
https://www.qt.io/qt-for-python
|
|
||||||
|
|
||||||
2. Pydantic - MIT License
|
|
||||||
https://github.com/pydantic/pydantic
|
|
||||||
|
|
||||||
3. Polars - MIT License
|
|
||||||
https://github.com/pola-rs/polars
|
|
||||||
|
|
||||||
... (alle weiteren Bibliotheken)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Externe Tools (Saxon, Apache FOP)
|
|
||||||
|
|
||||||
**Wichtig:** Saxon-HE und Apache FOP sind **externe Programme**, die nicht in DocuMentor eingebettet sind.
|
|
||||||
|
|
||||||
- **Saxon-HE**: MPL-2.0 - Du darfst es verwenden, musst aber nicht deine Software unter MPL lizenzieren
|
|
||||||
- **Apache FOP**: Apache 2.0 - Kompatibel mit MIT
|
|
||||||
|
|
||||||
Da diese Tools nur **aufgerufen** werden (nicht eingebettet), hast du keine zusätzlichen Verpflichtungen.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Quellen
|
|
||||||
|
|
||||||
- [PySide6 License](https://doc.qt.io/qtforpython-6/licenses.html)
|
|
||||||
- [Pydantic MIT License](https://github.com/pydantic/pydantic/blob/main/LICENSE)
|
|
||||||
- [Polars License](https://github.com/pola-rs/polars)
|
|
||||||
- [PyQtDarkTheme License](https://github.com/5yutan5/PyQtDarkTheme)
|
|
||||||
- [Apache FOP License](https://xmlgraphics.apache.org/fop/license.html)
|
|
||||||
- [Saxon License](https://github.com/Saxonica/Saxon-HE)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Stand:** Januar 2025
|
|
||||||
**Autor:** Lizenzanalyse für DocuMentor
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
# DocuMentor
|
|
||||||
|
|
||||||
**Professionelle XSL-Transformations-Verwaltung und PDF-Generierung**
|
|
||||||
|
|
||||||
DocuMentor (ehemals xsl-validator) ist eine leistungsstarke PySide6-basierte Desktop-Anwendung zur Verwaltung und Validierung von XSL-Transformationen mit automatischer PDF-Generierung. Die Anwendung bietet eine intuitive GUI zur Konfiguration von Transformations-Toolchains (Saxon, Apache FOP, diff-pdf) und zur Verwaltung komplexer PDF-Generierungsprojekte mit PostgreSQL-Datenbankintegration.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
### 🌳 Hierarchische Projektverwaltung
|
|
||||||
- Organisieren Sie Ihre XSL-Transformationen in einer übersichtlichen Baumstruktur
|
|
||||||
- Flexible Workflow-Definitionen mit verschachtelten Knoten
|
|
||||||
- Projektspezifische Konfiguration mit `project.yaml`
|
|
||||||
|
|
||||||
### ⚡ Asynchrone Batch-Verarbeitung
|
|
||||||
- Verarbeiten Sie große Mengen von XML-Dateien im Hintergrund
|
|
||||||
- Fortschrittsanzeige für lange Transformationen
|
|
||||||
- 4x schnellere XSLT-Transformationen durch Worker-Pool-Architektur
|
|
||||||
|
|
||||||
### 🔍 Intelligente Duplikatserkennung
|
|
||||||
- Automatische Hash-basierte Erkennung von identischen XML-Dateien (Blake2b)
|
|
||||||
- Verhindert Redundanzen und spart Speicherplatz
|
|
||||||
- Asynchrone Hash-Berechnung im Hintergrund
|
|
||||||
|
|
||||||
### 📄 PDF-Vergleichsansicht
|
|
||||||
- Drei-Panel-Ansicht (Referenz, Diff, Neu)
|
|
||||||
- Alpha-Blending für visuellen Vergleich
|
|
||||||
- Zoom- und Pan-Funktionalität
|
|
||||||
|
|
||||||
### 🗄️ PostgreSQL-Integration
|
|
||||||
- Nahtlose Datenbankanbindung mit Polars und ConnectorX
|
|
||||||
- Performante SQL-Abfragen und Datenverarbeitung
|
|
||||||
- SSL-Modus-Unterstützung
|
|
||||||
|
|
||||||
### 🛠️ Konfigurierbare Toolchains
|
|
||||||
- Flexible Verwaltung von Saxon, Apache FOP und diff-pdf
|
|
||||||
- Versionierung von Tools
|
|
||||||
- Plattformübergreifende Unterstützung (Linux, Windows, macOS)
|
|
||||||
|
|
||||||
### 🎨 Modernes UI
|
|
||||||
- Dark-Theme-Unterstützung via `qdarktheme`
|
|
||||||
- Drag-and-Drop für XML-Dateien
|
|
||||||
- Responsive und intuitive Benutzeroberfläche
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Voraussetzungen
|
|
||||||
|
|
||||||
- Python 3.13 oder höher
|
|
||||||
- [uv](https://github.com/astral-sh/uv) Paketmanager
|
|
||||||
|
|
||||||
### Abhängigkeiten installieren
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Mit uv (empfohlen)
|
|
||||||
uv sync
|
|
||||||
|
|
||||||
# Oder mit pip
|
|
||||||
pip install -e .
|
|
||||||
```
|
|
||||||
|
|
||||||
### Externe Tools (optional)
|
|
||||||
|
|
||||||
Für die volle Funktionalität benötigen Sie:
|
|
||||||
|
|
||||||
- **Saxon-HE**: XSLT 3.0 Prozessor ([Download](https://www.saxonica.com/download/))
|
|
||||||
- **Apache FOP**: PDF-Generierung aus XSL-FO ([Download](https://xmlgraphics.apache.org/fop/download.html))
|
|
||||||
- **diff-pdf**: PDF-Vergleich ([GitHub](https://github.com/vslavik/diff-pdf))
|
|
||||||
|
|
||||||
## Verwendung
|
|
||||||
|
|
||||||
### Anwendung starten
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python src/main.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Projekt erstellen
|
|
||||||
|
|
||||||
1. Legen Sie ein neues Projekt an
|
|
||||||
2. Konfigurieren Sie Ihre Tools (Saxon, Apache FOP) in den Einstellungen
|
|
||||||
3. Organisieren Sie XSL-Stylesheets und XML-Dateien in der Baumstruktur
|
|
||||||
4. Führen Sie Transformationen aus
|
|
||||||
|
|
||||||
### Konfiguration
|
|
||||||
|
|
||||||
Die Anwendung speichert Konfigurationsdateien an folgenden Orten:
|
|
||||||
|
|
||||||
- **Linux**: `~/.config/DocuMentor/config.json`
|
|
||||||
- **Windows**: `%APPDATA%\DocuMentor\config.json`
|
|
||||||
- **macOS**: `~/Library/Application Support/DocuMentor/config.json`
|
|
||||||
|
|
||||||
Projektdaten werden in `project.yaml` im jeweiligen Projektverzeichnis gespeichert.
|
|
||||||
|
|
||||||
## Entwicklung
|
|
||||||
|
|
||||||
### Code-Qualität
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Code-Style prüfen
|
|
||||||
uv run ruff check
|
|
||||||
|
|
||||||
# Code formatieren
|
|
||||||
uv run ruff format
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tests
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Hash-Implementierung testen
|
|
||||||
uv run python test_hash_implementation.py
|
|
||||||
|
|
||||||
# Duplikatserkennung testen
|
|
||||||
uv run python test_xml_hash_duplicate_detection.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Architektur
|
|
||||||
|
|
||||||
- **PySide6**: Native Qt-basierte GUI
|
|
||||||
- **Pydantic**: Typsichere Konfigurationsverwaltung
|
|
||||||
- **Polars**: Lightning-fast DataFrame-Verarbeitung
|
|
||||||
- **Blake2b**: Kryptographische Hash-Funktion für Integritätsprüfung
|
|
||||||
|
|
||||||
Siehe [CLAUDE.md](CLAUDE.md) für detaillierte Entwicklerdokumentation.
|
|
||||||
|
|
||||||
## Lizenz
|
|
||||||
|
|
||||||
DocuMentor ist unter der [MIT License](LICENSE) lizenziert.
|
|
||||||
|
|
||||||
### Third-Party-Lizenzen
|
|
||||||
|
|
||||||
Diese Software verwendet folgende Open-Source-Bibliotheken:
|
|
||||||
|
|
||||||
- **PySide6** - LGPL-3.0 OR GPL-2.0 OR GPL-3.0
|
|
||||||
- **Pydantic** - MIT License
|
|
||||||
- **Polars** - MIT License
|
|
||||||
- **pyqtdarktheme** - MIT License
|
|
||||||
- Weitere siehe [THIRD_PARTY_LICENSES.txt](THIRD_PARTY_LICENSES.txt)
|
|
||||||
|
|
||||||
Externe Tools (separat zu installieren):
|
|
||||||
- **Saxon-HE** - Mozilla Public License 2.0
|
|
||||||
- **Apache FOP** - Apache License 2.0
|
|
||||||
|
|
||||||
Vollständige Lizenzanalyse: [LICENSES.md](LICENSES.md)
|
|
||||||
|
|
||||||
## Danksagungen
|
|
||||||
|
|
||||||
Vielen Dank an alle Entwickler der verwendeten Open-Source-Bibliotheken!
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**DocuMentor** - Professionelle XSL-Transformations-Verwaltung für anspruchsvolle Projekte
|
|
||||||
|
|||||||
@@ -1,267 +0,0 @@
|
|||||||
================================================================================
|
|
||||||
THIRD PARTY LICENSES
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
DocuMentor verwendet die folgenden Open-Source-Bibliotheken und Tools.
|
|
||||||
Vielen Dank an alle Entwickler und Maintainer dieser Projekte!
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
Python-Abhängigkeiten
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
1. PySide6
|
|
||||||
Version: >=6.10.1
|
|
||||||
Lizenz: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
|
||||||
Webseite: https://www.qt.io/qt-for-python
|
|
||||||
GitHub: https://github.com/qt/pyside-pyside-setup
|
|
||||||
Beschreibung: Qt for Python - Official Python bindings for Qt
|
|
||||||
Copyright: Copyright (C) The Qt Company Ltd.
|
|
||||||
|
|
||||||
2. Pydantic
|
|
||||||
Version: >=2.12.0
|
|
||||||
Lizenz: MIT License
|
|
||||||
Webseite: https://pydantic.dev
|
|
||||||
GitHub: https://github.com/pydantic/pydantic
|
|
||||||
Beschreibung: Data validation using Python type hints
|
|
||||||
Copyright: Copyright (c) 2017 to present Pydantic Services Inc.
|
|
||||||
|
|
||||||
3. Pydantic-Settings
|
|
||||||
Version: >=2.12.0
|
|
||||||
Lizenz: MIT License
|
|
||||||
GitHub: https://github.com/pydantic/pydantic-settings
|
|
||||||
Beschreibung: Settings management using Pydantic
|
|
||||||
Copyright: Copyright (c) 2023 Pydantic Services Inc.
|
|
||||||
|
|
||||||
4. Pydantic-YAML
|
|
||||||
Version: >=1.6.0
|
|
||||||
Lizenz: MIT License
|
|
||||||
GitHub: https://github.com/NowanIlfideme/pydantic-yaml
|
|
||||||
Beschreibung: YAML support for Pydantic models
|
|
||||||
Copyright: Copyright (c) 2020 Anatoly Makarevich
|
|
||||||
|
|
||||||
5. Polars
|
|
||||||
Version: >=1.37.0
|
|
||||||
Lizenz: MIT License
|
|
||||||
Webseite: https://pola.rs
|
|
||||||
GitHub: https://github.com/pola-rs/polars
|
|
||||||
Beschreibung: Lightning-fast DataFrame library
|
|
||||||
Copyright: Copyright (c) 2025 Ritchie Vink
|
|
||||||
|
|
||||||
6. ConnectorX (via Polars)
|
|
||||||
Lizenz: MIT License
|
|
||||||
GitHub: https://github.com/sfu-db/connector-x
|
|
||||||
Beschreibung: Fast database connector for DataFrames
|
|
||||||
Copyright: Copyright (c) 2021 SFU Database Group
|
|
||||||
|
|
||||||
7. PyArrow (via Polars)
|
|
||||||
Lizenz: Apache License 2.0
|
|
||||||
Webseite: https://arrow.apache.org/docs/python/
|
|
||||||
GitHub: https://github.com/apache/arrow
|
|
||||||
Beschreibung: Python library for Apache Arrow
|
|
||||||
Copyright: Copyright (c) 2016-2025 The Apache Software Foundation
|
|
||||||
|
|
||||||
8. psutil
|
|
||||||
Version: >=6.1.1
|
|
||||||
Lizenz: BSD-3-Clause License
|
|
||||||
GitHub: https://github.com/giampaolo/psutil
|
|
||||||
Beschreibung: Cross-platform lib for process and system monitoring
|
|
||||||
Copyright: Copyright (c) 2009 Giampaolo Rodola
|
|
||||||
|
|
||||||
9. lxml
|
|
||||||
Version: >=6.0.2
|
|
||||||
Lizenz: BSD-3-Clause License
|
|
||||||
Webseite: https://lxml.de/
|
|
||||||
GitHub: https://github.com/lxml/lxml
|
|
||||||
Beschreibung: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API
|
|
||||||
Copyright: Copyright (c) 2004 Infrae. All rights reserved.
|
|
||||||
|
|
||||||
10. Ruff (Development)
|
|
||||||
Version: >=0.14.11
|
|
||||||
Lizenz: MIT License
|
|
||||||
GitHub: https://github.com/astral-sh/ruff
|
|
||||||
Beschreibung: An extremely fast Python linter and code formatter
|
|
||||||
Copyright: Copyright (c) 2022 Charlie Marsh
|
|
||||||
|
|
||||||
11. PyInstaller (Development)
|
|
||||||
Version: >=6.0.0
|
|
||||||
Lizenz: GPL-2.0 mit Bootloader-Ausnahme
|
|
||||||
Webseite: https://pyinstaller.org
|
|
||||||
GitHub: https://github.com/pyinstaller/pyinstaller
|
|
||||||
Beschreibung: Bundles Python applications into stand-alone executables
|
|
||||||
Copyright: Copyright (c) 2010-2025 PyInstaller Development Team
|
|
||||||
|
|
||||||
12. Pillow (Development)
|
|
||||||
Version: >=10.0.0
|
|
||||||
Lizenz: HPND License (Historical Permission Notice and Disclaimer)
|
|
||||||
Webseite: https://python-pillow.org
|
|
||||||
GitHub: https://github.com/python-pillow/Pillow
|
|
||||||
Beschreibung: Python Imaging Library (Fork)
|
|
||||||
Copyright: Copyright (c) 2010-2025 Jeffrey A. Clark and contributors
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
Eingebettete Bibliotheken
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
Diese Bibliotheken sind direkt im Quellcode von DocuMentor enthalten.
|
|
||||||
|
|
||||||
1. vis-network (vis.js)
|
|
||||||
Version: 9.1.9
|
|
||||||
Lizenz: Apache License 2.0 ODER MIT License (Dual-Lizenz)
|
|
||||||
Webseite: https://visjs.github.io/vis-network/
|
|
||||||
GitHub: https://github.com/visjs/vis-network
|
|
||||||
Beschreibung: A dynamic, browser-based network visualization library
|
|
||||||
Copyright: Copyright (c) 2011-2017 Almende B.V, http://almende.com
|
|
||||||
Copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
|
|
||||||
Datei: src/res/vis-network.min.js
|
|
||||||
Hinweis: Wird inline in QWebEngineView für den XSL-Abhängigkeitsgraph verwendet
|
|
||||||
|
|
||||||
2. Feather Icons
|
|
||||||
Version: 4.29.2
|
|
||||||
Lizenz: MIT License
|
|
||||||
Webseite: https://feathericons.com
|
|
||||||
GitHub: https://github.com/feathericons/feather
|
|
||||||
Beschreibung: Simply beautiful open source icons
|
|
||||||
Copyright: Copyright (c) 2013-2017 Cole Bemis
|
|
||||||
Datei: src/res/icons/, src/res/resources_rc.py
|
|
||||||
Hinweis: SVG-Icons werden via Qt-Ressourcensystem eingebettet; Farbe wird zur Laufzeit aus der Qt-Palette gesetzt
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
Externe Tools (nicht eingebettet)
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
Diese Tools werden als externe Programme aufgerufen und sind nicht
|
|
||||||
Bestandteil der DocuMentor-Distribution. Sie müssen separat installiert werden.
|
|
||||||
|
|
||||||
1. Saxon-HE (Home Edition)
|
|
||||||
Lizenz: Mozilla Public License 2.0 (MPL-2.0)
|
|
||||||
Webseite: https://www.saxonica.com/
|
|
||||||
GitHub: https://github.com/Saxonica/Saxon-HE
|
|
||||||
Beschreibung: XSLT 3.0 and XQuery 3.1 processor
|
|
||||||
Copyright: Copyright (c) Saxonica Limited
|
|
||||||
Hinweis: Für XSLT-Transformationen verwendet
|
|
||||||
|
|
||||||
2. Apache FOP (Formatting Objects Processor)
|
|
||||||
Lizenz: Apache License 2.0
|
|
||||||
Webseite: https://xmlgraphics.apache.org/fop/
|
|
||||||
Beschreibung: XSL-FO to PDF converter
|
|
||||||
Copyright: Copyright (c) 1999-2025 The Apache Software Foundation
|
|
||||||
Hinweis: Für PDF-Generierung verwendet
|
|
||||||
|
|
||||||
3. diff-pdf
|
|
||||||
Lizenz: GPL-2.0 (vermutlich)
|
|
||||||
GitHub: https://github.com/vslavik/diff-pdf
|
|
||||||
Beschreibung: Tool for visually comparing PDF files
|
|
||||||
Hinweis: Optional für PDF-Vergleich verwendet
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
Lizenztexte
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
MIT License
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
Apache License 2.0
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
BSD-3-Clause License (psutil)
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
3. Neither the name of the copyright holder nor the names of its contributors
|
|
||||||
may be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
LGPL-3.0 / GPL-2.0 / GPL-3.0 (PySide6)
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
PySide6 ist unter LGPL-3.0, GPL-2.0 oder GPL-3.0 lizenziert.
|
|
||||||
Die vollständigen Lizenztexte finden Sie unter:
|
|
||||||
|
|
||||||
LGPL-3.0: https://www.gnu.org/licenses/lgpl-3.0.html
|
|
||||||
GPL-2.0: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
GPL-3.0: https://www.gnu.org/licenses/gpl-3.0.html
|
|
||||||
|
|
||||||
Weitere Informationen: https://doc.qt.io/qtforpython-6/licenses.html
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
Mozilla Public License 2.0 (Saxon-HE)
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Der vollständige Lizenztext der Mozilla Public License 2.0 ist verfügbar unter:
|
|
||||||
https://www.mozilla.org/en-US/MPL/2.0/
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
HINWEISE
|
|
||||||
================================================================================
|
|
||||||
|
|
||||||
1. PySide6 (LGPL-3.0):
|
|
||||||
DocuMentor verwendet PySide6 über dynamisches Linking (Python import).
|
|
||||||
Nutzer können die PySide6-Version über pip austauschen.
|
|
||||||
Der Quellcode von DocuMentor muss nicht unter LGPL veröffentlicht werden.
|
|
||||||
|
|
||||||
2. Externe Tools:
|
|
||||||
Saxon-HE, Apache FOP und diff-pdf sind separate Programme, die von
|
|
||||||
DocuMentor aufgerufen werden, aber nicht in die Distribution eingebettet sind.
|
|
||||||
Nutzer müssen diese Tools selbst installieren.
|
|
||||||
|
|
||||||
3. Aktualisierungen:
|
|
||||||
Bitte überprüfen Sie regelmäßig die Lizenzen der verwendeten Bibliotheken,
|
|
||||||
da sich diese ändern können.
|
|
||||||
|
|
||||||
================================================================================
|
|
||||||
Stand: April 2026
|
|
||||||
Erstellt für: DocuMentor v1.7.0
|
|
||||||
================================================================================
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
"""
|
|
||||||
WiX MSI Build-Skript für DocuMentor (WiX v6)
|
|
||||||
|
|
||||||
Erstellt einen MSI-Installer aus dem PyInstaller Build.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import tomllib
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
def get_version(project_root: Path) -> str:
|
|
||||||
"""Liest die Versionsnummer aus pyproject.toml."""
|
|
||||||
pyproject_path = project_root / "pyproject.toml"
|
|
||||||
with pyproject_path.open("rb") as f:
|
|
||||||
data = tomllib.load(f)
|
|
||||||
return data["project"]["version"]
|
|
||||||
|
|
||||||
|
|
||||||
def build_msi():
|
|
||||||
"""Erstellt MSI-Installer mit WiX v6."""
|
|
||||||
project_root = Path(__file__).parent
|
|
||||||
dist_dir = project_root / "dist" / "DocuMentor"
|
|
||||||
|
|
||||||
if not dist_dir.exists():
|
|
||||||
print("FEHLER: PyInstaller Build nicht gefunden!")
|
|
||||||
print("Bitte zuerst ausführen: uv run python build_windows.py")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
version = get_version(project_root)
|
|
||||||
msi_output = project_root / "dist" / f"DocuMentor-{version}.msi"
|
|
||||||
|
|
||||||
print(f"DocuMentor Build gefunden: {dist_dir}")
|
|
||||||
print(f"Version: {version}")
|
|
||||||
print(f"MSI-Ausgabe: {msi_output}")
|
|
||||||
print()
|
|
||||||
|
|
||||||
# Schritt 1: ProductFiles.wxs generieren (ersetzt WiX heat)
|
|
||||||
print("Schritt 1/2: Generiere ProductFiles.wxs...")
|
|
||||||
result = subprocess.run(["uv", "run", "python", "generate_wix_files.py"], check=False)
|
|
||||||
|
|
||||||
if result.returncode != 0:
|
|
||||||
print("\nFEHLER: ProductFiles.wxs Generierung fehlgeschlagen!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print()
|
|
||||||
|
|
||||||
# Schritt 2: MSI kompilieren mit WiX v6
|
|
||||||
print("Schritt 2/2: Kompiliere MSI-Installer...")
|
|
||||||
try:
|
|
||||||
result = subprocess.run(
|
|
||||||
["wix", "build", "DocuMentor.wxs", "ProductFiles.wxs", "-o", str(msi_output)],
|
|
||||||
check=False,
|
|
||||||
)
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("\nFEHLER: 'wix' wurde nicht gefunden!")
|
|
||||||
print("WiX v6 muss installiert sein. Installationsschritte:")
|
|
||||||
print(" 1. .NET SDK installieren: https://dot.net")
|
|
||||||
print(" 2. WiX als dotnet tool installieren:")
|
|
||||||
print(" dotnet tool install --global wix --version 6.*")
|
|
||||||
print(" 3. Neues Terminal öffnen (PATH aktualisieren)")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if result.returncode != 0:
|
|
||||||
print("\nFEHLER: MSI-Kompilierung fehlgeschlagen!")
|
|
||||||
print("Stelle sicher, dass WiX v6 installiert ist:")
|
|
||||||
print(" dotnet tool install --global wix --version 6.*")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print()
|
|
||||||
print(f"[OK] MSI erfolgreich erstellt: {msi_output}")
|
|
||||||
print()
|
|
||||||
print("Installation testen mit:")
|
|
||||||
print(f" msiexec /i \"{msi_output}\"")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
build_msi()
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Build-Skript für Windows-Distribution von DocuMentor
|
|
||||||
|
|
||||||
Erstellt:
|
|
||||||
1. Eigenständige Executable mit PyInstaller
|
|
||||||
2. Optional: ZIP-Archiv für portable Distribution
|
|
||||||
"""
|
|
||||||
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import tomllib
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
def get_version(project_root: Path) -> str:
|
|
||||||
"""Liest die Versionsnummer aus pyproject.toml."""
|
|
||||||
with (project_root / "pyproject.toml").open("rb") as f:
|
|
||||||
return tomllib.load(f)["project"]["version"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
project_root = Path(__file__).parent
|
|
||||||
dist_dir = project_root / "dist"
|
|
||||||
build_dir = project_root / "build"
|
|
||||||
resources_dir = project_root / "resources"
|
|
||||||
icon_path = resources_dir / "icon.ico"
|
|
||||||
version_info_path = project_root / "version_info.txt"
|
|
||||||
|
|
||||||
print("=" * 60)
|
|
||||||
print("DocuMentor Windows Build")
|
|
||||||
print("=" * 60)
|
|
||||||
|
|
||||||
# 1. Icon und Versionsinformationen generieren
|
|
||||||
print("\n[1/6] Icon und Versionsinformationen generieren...")
|
|
||||||
|
|
||||||
# Icon erstellen falls nicht vorhanden
|
|
||||||
if not icon_path.exists():
|
|
||||||
print(" Erstelle Standard-Icon...")
|
|
||||||
try:
|
|
||||||
subprocess.run([sys.executable, "create_icon.py"], check=True, cwd=project_root)
|
|
||||||
print(" ✓ Icon erstellt")
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print(f" ✗ Icon-Erstellung fehlgeschlagen: {e}")
|
|
||||||
print(" ⚠ Fahre ohne Icon fort...")
|
|
||||||
else:
|
|
||||||
print(f" ✓ Icon vorhanden: {icon_path.name}")
|
|
||||||
|
|
||||||
# Versionsinformationen erstellen
|
|
||||||
print(" Erstelle Versionsinformationen...")
|
|
||||||
try:
|
|
||||||
subprocess.run([sys.executable, "create_version_info.py"], check=True, cwd=project_root)
|
|
||||||
print(" ✓ Versionsinformationen erstellt")
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print(f" ✗ Versionsinformationen-Erstellung fehlgeschlagen: {e}")
|
|
||||||
print(" ⚠ Fahre ohne Versionsinformationen fort...")
|
|
||||||
|
|
||||||
# 2. Cleanup alter Builds
|
|
||||||
print("\n[2/6] Cleanup alter Builds...")
|
|
||||||
if dist_dir.exists():
|
|
||||||
shutil.rmtree(dist_dir)
|
|
||||||
print(" ✓ dist/ gelöscht")
|
|
||||||
if build_dir.exists():
|
|
||||||
shutil.rmtree(build_dir)
|
|
||||||
print(" ✓ build/ gelöscht")
|
|
||||||
|
|
||||||
# 3. PyInstaller ausführen
|
|
||||||
print("\n[3/6] PyInstaller Build starten...")
|
|
||||||
try:
|
|
||||||
subprocess.run(
|
|
||||||
["pyinstaller", "--clean", "DocuMentor.spec"],
|
|
||||||
check=True,
|
|
||||||
cwd=project_root
|
|
||||||
)
|
|
||||||
print(" ✓ Build erfolgreich")
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print(f" ✗ Build fehlgeschlagen: {e}")
|
|
||||||
return 1
|
|
||||||
|
|
||||||
# 4. README für Distribution erstellen
|
|
||||||
print("\n[4/6] README erstellen...")
|
|
||||||
readme_content = """DocuMentor - XSL-Transformations-Verwaltung
|
|
||||||
============================================
|
|
||||||
|
|
||||||
Installation:
|
|
||||||
1. Entpacken Sie dieses Archiv in ein Verzeichnis Ihrer Wahl
|
|
||||||
2. Führen Sie DocuMentor.exe aus
|
|
||||||
|
|
||||||
Externe Abhängigkeiten (separat zu installieren):
|
|
||||||
- Java Runtime Environment (JRE) oder JDK
|
|
||||||
- Apache FOP (für PDF-Generierung)
|
|
||||||
- Saxon XSLT-Prozessor (JAR-Datei)
|
|
||||||
- diff-pdf (für PDF-Vergleiche)
|
|
||||||
|
|
||||||
Beim ersten Start werden Sie aufgefordert, die Pfade zu diesen
|
|
||||||
Tools in den Programmeinstellungen zu konfigurieren.
|
|
||||||
|
|
||||||
Konfiguration und Logs:
|
|
||||||
- Windows: %APPDATA%\\DocuMentor\\
|
|
||||||
- Konfiguration: config.json
|
|
||||||
- Logs: logs\\
|
|
||||||
|
|
||||||
Support:
|
|
||||||
Bei Fragen oder Problemen erstellen Sie bitte ein Issue auf GitHub.
|
|
||||||
"""
|
|
||||||
|
|
||||||
readme_path = dist_dir / "DocuMentor" / "README.txt"
|
|
||||||
readme_path.write_text(readme_content, encoding='utf-8')
|
|
||||||
print(" ✓ README.txt erstellt")
|
|
||||||
|
|
||||||
# 5. Icon ins dist-Verzeichnis kopieren (für Installer)
|
|
||||||
print("\n[5/6] Icon für Installer vorbereiten...")
|
|
||||||
if icon_path.exists():
|
|
||||||
dist_icon = dist_dir / "DocuMentor" / "icon.ico"
|
|
||||||
shutil.copy2(icon_path, dist_icon)
|
|
||||||
print(" ✓ Icon kopiert")
|
|
||||||
else:
|
|
||||||
print(" ⚠ Kein Icon vorhanden")
|
|
||||||
|
|
||||||
# 6. ZIP-Archiv erstellen
|
|
||||||
print("\n[6/6] ZIP-Archiv erstellen...")
|
|
||||||
version = get_version(project_root)
|
|
||||||
zip_name = f"DocuMentor-{version}"
|
|
||||||
zip_path = dist_dir / zip_name
|
|
||||||
|
|
||||||
shutil.make_archive(
|
|
||||||
str(zip_path),
|
|
||||||
'zip',
|
|
||||||
dist_dir,
|
|
||||||
'DocuMentor'
|
|
||||||
)
|
|
||||||
print(f" ✓ {zip_name}.zip erstellt")
|
|
||||||
|
|
||||||
print("\n" + "=" * 60)
|
|
||||||
print("Build abgeschlossen!")
|
|
||||||
print("=" * 60)
|
|
||||||
print(f"\nErgebnisse:")
|
|
||||||
print(f" • Executable: dist/DocuMentor/DocuMentor.exe")
|
|
||||||
print(f" • ZIP-Archiv: dist/{zip_name}.zip")
|
|
||||||
print("\nNächste Schritte:")
|
|
||||||
print(" 1. Testen Sie DocuMentor.exe auf einem Windows-System")
|
|
||||||
print(" 2. Optional: Erstellen Sie einen Installer mit Inno Setup")
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Icon-Generator für DocuMentor
|
|
||||||
|
|
||||||
Erstellt ein Icon aus einem PNG oder generiert ein Standard-Icon.
|
|
||||||
Unterstützt Windows (.ico) und verschiedene Größen.
|
|
||||||
|
|
||||||
Verwendung:
|
|
||||||
python create_icon.py # Generiert Standard-Icon
|
|
||||||
python create_icon.py source.png # Konvertiert PNG zu ICO
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
try:
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
|
||||||
except ImportError:
|
|
||||||
print("Fehler: Pillow ist nicht installiert.")
|
|
||||||
print("Installation: uv pip install pillow")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def create_default_icon(output_path: Path):
|
|
||||||
"""Erstellt ein Standard-Icon mit DocuMentor-Branding."""
|
|
||||||
sizes = [256, 128, 64, 48, 32, 16]
|
|
||||||
images = []
|
|
||||||
|
|
||||||
for size in sizes:
|
|
||||||
# Neues Bild erstellen mit Farbverlauf
|
|
||||||
img = Image.new('RGB', (size, size), color='white')
|
|
||||||
draw = ImageDraw.Draw(img)
|
|
||||||
|
|
||||||
# Hintergrund: Blau-Verlauf (vereinfacht als solides Blau)
|
|
||||||
bg_color = (41, 128, 185) # Professionelles Blau
|
|
||||||
draw.rectangle([0, 0, size, size], fill=bg_color)
|
|
||||||
|
|
||||||
# Dokument-Symbol (vereinfachte Darstellung)
|
|
||||||
margin = size // 8
|
|
||||||
doc_left = margin
|
|
||||||
doc_top = margin
|
|
||||||
doc_right = size - margin
|
|
||||||
doc_bottom = size - margin
|
|
||||||
|
|
||||||
# Weißes Dokument
|
|
||||||
draw.rectangle(
|
|
||||||
[doc_left, doc_top, doc_right, doc_bottom],
|
|
||||||
fill='white',
|
|
||||||
outline=(52, 73, 94),
|
|
||||||
width=max(1, size // 64)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Ecke umgeknickt (rechts oben)
|
|
||||||
fold_size = size // 6
|
|
||||||
points = [
|
|
||||||
(doc_right - fold_size, doc_top),
|
|
||||||
(doc_right, doc_top + fold_size),
|
|
||||||
(doc_right - fold_size, doc_top + fold_size),
|
|
||||||
]
|
|
||||||
draw.polygon(points, fill=(220, 220, 220), outline=(52, 73, 94))
|
|
||||||
|
|
||||||
# Text-Linien im Dokument (nur bei größeren Icons)
|
|
||||||
if size >= 32:
|
|
||||||
line_margin = doc_left + size // 12
|
|
||||||
line_width = doc_right - doc_left - size // 6
|
|
||||||
line_count = min(3, size // 32)
|
|
||||||
line_spacing = (doc_bottom - doc_top - fold_size) // (line_count + 2)
|
|
||||||
|
|
||||||
for i in range(line_count):
|
|
||||||
y = doc_top + fold_size + line_spacing * (i + 1)
|
|
||||||
draw.rectangle(
|
|
||||||
[line_margin, y, line_margin + line_width, y + max(1, size // 128)],
|
|
||||||
fill=(52, 73, 94)
|
|
||||||
)
|
|
||||||
|
|
||||||
# "M" für Mentor (nur bei großen Icons)
|
|
||||||
if size >= 64:
|
|
||||||
try:
|
|
||||||
# Versuche System-Font zu verwenden
|
|
||||||
font_size = size // 4
|
|
||||||
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", font_size)
|
|
||||||
except:
|
|
||||||
# Fallback auf Default-Font
|
|
||||||
font = ImageFont.load_default()
|
|
||||||
|
|
||||||
text = "M"
|
|
||||||
# Zentrieren (grobe Schätzung)
|
|
||||||
bbox = draw.textbbox((0, 0), text, font=font)
|
|
||||||
text_width = bbox[2] - bbox[0]
|
|
||||||
text_height = bbox[3] - bbox[1]
|
|
||||||
text_x = (size - text_width) // 2
|
|
||||||
text_y = doc_bottom - text_height - margin // 2
|
|
||||||
|
|
||||||
draw.text((text_x, text_y), text, fill=bg_color, font=font)
|
|
||||||
|
|
||||||
images.append(img)
|
|
||||||
|
|
||||||
# Als ICO speichern
|
|
||||||
images[0].save(
|
|
||||||
output_path,
|
|
||||||
format='ICO',
|
|
||||||
sizes=[(img.width, img.height) for img in images],
|
|
||||||
append_images=images[1:]
|
|
||||||
)
|
|
||||||
print(f"✓ Standard-Icon erstellt: {output_path}")
|
|
||||||
|
|
||||||
|
|
||||||
def convert_png_to_ico(source_path: Path, output_path: Path):
|
|
||||||
"""Konvertiert ein PNG-Bild zu einem Multi-Size ICO."""
|
|
||||||
try:
|
|
||||||
img = Image.open(source_path)
|
|
||||||
|
|
||||||
# Zu RGBA konvertieren falls nötig
|
|
||||||
if img.mode != 'RGBA':
|
|
||||||
img = img.convert('RGBA')
|
|
||||||
|
|
||||||
# Verschiedene Größen erstellen
|
|
||||||
sizes = [256, 128, 64, 48, 32, 16]
|
|
||||||
images = []
|
|
||||||
|
|
||||||
for size in sizes:
|
|
||||||
resized = img.resize((size, size), Image.Resampling.LANCZOS)
|
|
||||||
images.append(resized)
|
|
||||||
|
|
||||||
# Als ICO speichern
|
|
||||||
images[0].save(
|
|
||||||
output_path,
|
|
||||||
format='ICO',
|
|
||||||
sizes=[(img.width, img.height) for img in images],
|
|
||||||
append_images=images[1:]
|
|
||||||
)
|
|
||||||
print(f"✓ Icon erstellt aus {source_path.name}: {output_path}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ Fehler beim Konvertieren: {e}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
project_root = Path(__file__).parent
|
|
||||||
resources_dir = project_root / "resources"
|
|
||||||
resources_dir.mkdir(exist_ok=True)
|
|
||||||
|
|
||||||
output_ico = resources_dir / "icon.ico"
|
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
# PNG zu ICO konvertieren
|
|
||||||
source_path = Path(sys.argv[1])
|
|
||||||
if not source_path.exists():
|
|
||||||
print(f"Fehler: Datei nicht gefunden: {source_path}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
convert_png_to_ico(source_path, output_ico)
|
|
||||||
else:
|
|
||||||
# Standard-Icon generieren
|
|
||||||
print("Erstelle Standard-Icon...")
|
|
||||||
create_default_icon(output_ico)
|
|
||||||
|
|
||||||
print(f"\nIcon gespeichert: {output_ico}")
|
|
||||||
print("Das Icon wird automatisch von PyInstaller und Inno Setup verwendet.")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Generiert Windows-Versionsinformationen für PyInstaller
|
|
||||||
|
|
||||||
Liest Version aus pyproject.toml und erstellt version_info.txt
|
|
||||||
"""
|
|
||||||
|
|
||||||
import tomllib
|
|
||||||
from pathlib import Path
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
|
|
||||||
def parse_version(version_str: str) -> tuple[int, int, int, int]:
|
|
||||||
"""Parst Version-String (z.B. '0.1.0') zu Tuple (0, 1, 0, 0)."""
|
|
||||||
parts = version_str.split('.')
|
|
||||||
major = int(parts[0]) if len(parts) > 0 else 0
|
|
||||||
minor = int(parts[1]) if len(parts) > 1 else 0
|
|
||||||
patch = int(parts[2]) if len(parts) > 2 else 0
|
|
||||||
build = 0 # Könnte aus Git-Commit-Count generiert werden
|
|
||||||
return (major, minor, patch, build)
|
|
||||||
|
|
||||||
|
|
||||||
def create_version_info(project_root: Path):
|
|
||||||
"""Erstellt version_info.txt für PyInstaller."""
|
|
||||||
|
|
||||||
# pyproject.toml lesen
|
|
||||||
pyproject_path = project_root / "pyproject.toml"
|
|
||||||
with open(pyproject_path, 'rb') as f:
|
|
||||||
pyproject = tomllib.load(f)
|
|
||||||
|
|
||||||
project = pyproject['project']
|
|
||||||
version = project['version']
|
|
||||||
name = project['name']
|
|
||||||
description = project['description']
|
|
||||||
|
|
||||||
# Version parsen
|
|
||||||
file_version = parse_version(version)
|
|
||||||
product_version = file_version
|
|
||||||
|
|
||||||
# Jahr für Copyright
|
|
||||||
year = datetime.now().year
|
|
||||||
|
|
||||||
# version_info.txt Content
|
|
||||||
version_info_content = f"""# UTF-8
|
|
||||||
#
|
|
||||||
# Generiert automatisch von create_version_info.py
|
|
||||||
# NICHT manuell bearbeiten!
|
|
||||||
#
|
|
||||||
|
|
||||||
VSVersionInfo(
|
|
||||||
ffi=FixedFileInfo(
|
|
||||||
# filevers und prodvers als Tuple: (1, 0, 0, 0)
|
|
||||||
filevers={file_version},
|
|
||||||
prodvers={product_version},
|
|
||||||
# Maske für gültige Bits in filevers und prodvers
|
|
||||||
mask=0x3f,
|
|
||||||
# Flags - kann VS_FF_DEBUG, VS_FF_PRERELEASE, etc. enthalten
|
|
||||||
flags=0x0,
|
|
||||||
# Betriebssystem - VOS_NT_WINDOWS32
|
|
||||||
OS=0x40004,
|
|
||||||
# Dateityp - VFT_APP (Anwendung)
|
|
||||||
fileType=0x1,
|
|
||||||
# Subtyp (nicht verwendet für VFT_APP)
|
|
||||||
subtype=0x0,
|
|
||||||
# Datumsstempel
|
|
||||||
date=(0, 0)
|
|
||||||
),
|
|
||||||
kids=[
|
|
||||||
StringFileInfo(
|
|
||||||
[
|
|
||||||
StringTable(
|
|
||||||
'040904B0', # Deutsch (0x0409 = Englisch, 0x0407 = Deutsch), Unicode
|
|
||||||
[StringStruct('CompanyName', 'Vitali Graf / Software- und Datenbankentwicklung'),
|
|
||||||
StringStruct('FileDescription', '{description}'),
|
|
||||||
StringStruct('FileVersion', '{version}'),
|
|
||||||
StringStruct('InternalName', '{name}'),
|
|
||||||
StringStruct('LegalCopyright', '© {year} Vitali Graf. Alle Rechte vorbehalten.'),
|
|
||||||
StringStruct('OriginalFilename', '{name}.exe'),
|
|
||||||
StringStruct('ProductName', '{name}'),
|
|
||||||
StringStruct('ProductVersion', '{version}')])
|
|
||||||
]),
|
|
||||||
VarFileInfo([VarStruct('Translation', [1033, 1200])]) # Englisch, Unicode
|
|
||||||
]
|
|
||||||
)
|
|
||||||
"""
|
|
||||||
|
|
||||||
# version_info.txt schreiben
|
|
||||||
version_info_path = project_root / "version_info.txt"
|
|
||||||
version_info_path.write_text(version_info_content, encoding='utf-8')
|
|
||||||
|
|
||||||
print("✓ version_info.txt erstellt")
|
|
||||||
print(f" Version: {version}")
|
|
||||||
print(f" Datei: {version_info_path}")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
project_root = Path(__file__).parent
|
|
||||||
create_version_info(project_root)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
# Transformation ohne Force — Entscheidungslogik
|
|
||||||
|
|
||||||
Die zentrale Methode ist `is_up_to_date()` in transform.py:155-180. Sie basiert auf Modifikationszeiten (mtime), nicht auf Hashes.
|
|
||||||
|
|
||||||
## Ablauf
|
|
||||||
Die Prüfung erfolgt an zwei Stellen in der Pipeline:
|
|
||||||
1. Vor Saxon-Transformation (`transform_saxon()`) — transform.py:192-194
|
|
||||||
2. Vor PDF-Build (`build_pdf()`) — transform.py:322-324
|
|
||||||
|
|
||||||
Beide rufen `is_up_to_date()` auf, die prüft:
|
|
||||||
- Existiert die New-PDF?
|
|
||||||
- Ist die XML-Datei neuer als die New-PDF?
|
|
||||||
- Ist die XSL-Datei neuer als die New-PDF?
|
|
||||||
|
|
||||||
Wenn die New-PDF existiert und älter als alle Inputs ist → Transformation wird übersprungen mit `(True, "Übersprungen (aktuell)")`.
|
|
||||||
|
|
||||||
## Mermaid-Diagramm
|
|
||||||
```mermaid
|
|
||||||
flowchart TD
|
|
||||||
A["Transformation gestartet<br/>(force=False)"] --> B{"force == True?"}
|
|
||||||
B -- Ja --> EXEC["Transformation ausführen"]
|
|
||||||
B -- Nein --> C{"New-PDF existiert?"}
|
|
||||||
C -- Nein --> EXEC
|
|
||||||
C -- Ja --> D["mtime der New-PDF ermitteln"]
|
|
||||||
D --> E{"XML-Datei neuer<br/>als New-PDF?"}
|
|
||||||
E -- Ja --> EXEC
|
|
||||||
E -- Nein --> F{"XSL-Datei neuer<br/>als New-PDF?"}
|
|
||||||
F -- Ja --> EXEC
|
|
||||||
F -- Nein --> SKIP["Übersprungen (aktuell)<br/>return (True, 'Übersprungen')"]
|
|
||||||
|
|
||||||
EXEC --> S1["Schritt 1: Saxon<br/>XML → FO"]
|
|
||||||
S1 --> S1OK{"Saxon erfolgreich?"}
|
|
||||||
S1OK -- Nein --> FAIL["Pipeline abgebrochen"]
|
|
||||||
S1OK -- Ja --> S2CHECK{"force == True?<br/>(erneute Prüfung<br/>für build_pdf)"}
|
|
||||||
S2CHECK -- Ja --> S2["Schritt 2: FOP<br/>FO → PDF"]
|
|
||||||
S2CHECK -- Nein --> S2UP{"is_up_to_date()?"}
|
|
||||||
S2UP -- Ja --> S2SKIP["PDF-Build übersprungen"]
|
|
||||||
S2UP -- Nein --> S2
|
|
||||||
S2 --> S3["Schritt 3: diff-pdf<br/>PDF-Vergleich"]
|
|
||||||
S3 --> DONE["Pipeline abgeschlossen"]
|
|
||||||
|
|
||||||
style SKIP fill:#4CAF50,color:#fff
|
|
||||||
style EXEC fill:#2196F3,color:#fff
|
|
||||||
style FAIL fill:#f44336,color:#fff
|
|
||||||
style DONE fill:#4CAF50,color:#fff
|
|
||||||
style S2SKIP fill:#4CAF50,color:#fff
|
|
||||||
```
|
|
||||||
## Wichtige Details
|
|
||||||
- Keine Hash-basierte Prüfung: Die Skip-Logik nutzt ausschließlich `mtime`-Vergleiche, nicht die blake2b-Hashes (die werden nur für Änderungsverfolgung in der UI verwendet).
|
|
||||||
- Doppelte Prüfung: `is_up_to_date()` wird sowohl vor Saxon als auch vor FOP aufgerufen — theoretisch könnte Saxon ausgeführt, aber der PDF-Build übersprungen werden.
|
|
||||||
- Skip = Erfolg: Ein übersprungener Schritt gilt als erfolgreich `(True, ...)`, die Pipeline läuft weiter.
|
|
||||||
- Force-Aufruf: Über das Kontextmenü gibt es explizite Force-Methoden wie `_transform_all_xml_files_force()` in transformation.py.
|
|
||||||
|
|
||||||
|
|
||||||
## Erweiterung
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart TD
|
|
||||||
LOAD["Projekt geladen"] --> BUILD["XSL-Abhängigkeitsgraph aufbauen<br/>dict[Path, set[Path]]"]
|
|
||||||
BUILD --> CACHE["Im Speicher halten"]
|
|
||||||
|
|
||||||
TRANSFORM["is_up_to_date() aufgerufen"] --> CHECK{"Graph-Eintrag<br/>vorhanden?"}
|
|
||||||
CHECK -- Nein --> PARSE["XSL parsen, Imports auflösen,<br/>Eintrag erstellen"]
|
|
||||||
PARSE --> MTIME
|
|
||||||
CHECK -- Ja --> STALE{"mtime der XSL<br/>geändert seit letztem Parse?"}
|
|
||||||
STALE -- Ja --> PARSE
|
|
||||||
STALE -- Nein --> MTIME["mtime aller Abhängigkeiten<br/>gegen New-PDF prüfen"]
|
|
||||||
MTIME --> RESULT["Ergebnis"]
|
|
||||||
```
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
# Icon und Versionsinformationen für Windows-Build
|
|
||||||
|
|
||||||
## Übersicht
|
|
||||||
|
|
||||||
DocuMentor unterstützt professionelle Windows-Builds mit:
|
|
||||||
- **Anwendungs-Icon** in allen benötigten Größen
|
|
||||||
- **Windows-Versionsinformationen** (Datei-Eigenschaften)
|
|
||||||
- Automatische Integration in Build-Prozess
|
|
||||||
|
|
||||||
## Icon-System
|
|
||||||
|
|
||||||
### Automatische Icon-Generierung
|
|
||||||
|
|
||||||
Das Build-Skript generiert automatisch ein Standard-Icon, falls keins vorhanden ist:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python build_windows.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Falls `resources/icon.ico` nicht existiert, wird automatisch ein Standard-Icon mit DocuMentor-Branding erstellt.
|
|
||||||
|
|
||||||
### Manuelles Icon erstellen
|
|
||||||
|
|
||||||
#### Option 1: Standard-Icon
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python create_icon.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Erstellt ein einfaches Icon mit:
|
|
||||||
- Blauem Hintergrund (professionelles Blau: #2980B9)
|
|
||||||
- Weißem Dokument-Symbol
|
|
||||||
- "M" für Mentor (bei großen Icons)
|
|
||||||
- Umgeknickter Ecke
|
|
||||||
- Mehreren Größen (16×16 bis 256×256)
|
|
||||||
|
|
||||||
#### Option 2: Aus eigenem PNG
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python create_icon.py mein-logo.png
|
|
||||||
```
|
|
||||||
|
|
||||||
Konvertiert ein PNG-Bild zu einem Multi-Size Windows-Icon:
|
|
||||||
- Unterstützt Transparenz
|
|
||||||
- Erstellt alle benötigten Größen
|
|
||||||
- Optimiert für verschiedene Bildschirmauflösungen
|
|
||||||
|
|
||||||
**PNG-Anforderungen:**
|
|
||||||
- Idealerweise 256×256 Pixel oder größer
|
|
||||||
- Quadratisches Format
|
|
||||||
- PNG oder JPEG Format
|
|
||||||
- Transparenter Hintergrund empfohlen
|
|
||||||
|
|
||||||
### Icon-Größen
|
|
||||||
|
|
||||||
Das ICO-Format enthält folgende Auflösungen:
|
|
||||||
|
|
||||||
| Größe | Verwendung |
|
|
||||||
|---------|--------------------------------------|
|
|
||||||
| 256×256 | Windows 7+, Taskleiste, große Icons |
|
|
||||||
| 128×128 | Windows 7+, große Icons |
|
|
||||||
| 64×64 | Hohe DPI-Displays |
|
|
||||||
| 48×48 | Standard Desktop-Icon |
|
|
||||||
| 32×32 | Explorer Details-Ansicht |
|
|
||||||
| 16×16 | Kleinstes Icon, Titelleiste |
|
|
||||||
|
|
||||||
### Wo wird das Icon verwendet?
|
|
||||||
|
|
||||||
- **DocuMentor.exe** - Anwendungs-Icon
|
|
||||||
- **Setup.exe** - Installer-Icon (Inno Setup)
|
|
||||||
- **Desktop-Verknüpfung** - Erstellt beim Installieren
|
|
||||||
- **Start-Menü** - Windows-Programmgruppe
|
|
||||||
- **Taskleiste** - Beim Ausführen
|
|
||||||
- **Deinstallations-Programm** - System-Einstellungen
|
|
||||||
|
|
||||||
## Versionsinformationen
|
|
||||||
|
|
||||||
### Automatische Generierung
|
|
||||||
|
|
||||||
Versionsinformationen werden automatisch vom Build-Skript generiert:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python build_windows.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Manuelle Generierung
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python create_version_info.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Inhalt der Versionsinformationen
|
|
||||||
|
|
||||||
Die `version_info.txt` enthält:
|
|
||||||
|
|
||||||
```
|
|
||||||
FileVersion: 0.1.0.0
|
|
||||||
ProductVersion: 0.1.0.0
|
|
||||||
CompanyName: Ihr Name/Organisation
|
|
||||||
FileDescription: Professionelle XSL-Transformations-Verwaltung und PDF-Generierung
|
|
||||||
InternalName: DocuMentor
|
|
||||||
LegalCopyright: © 2026 Ihr Name. Alle Rechte vorbehalten.
|
|
||||||
OriginalFilename: DocuMentor.exe
|
|
||||||
ProductName: DocuMentor
|
|
||||||
```
|
|
||||||
|
|
||||||
### Version aus pyproject.toml
|
|
||||||
|
|
||||||
Die Version wird automatisch aus `pyproject.toml` gelesen:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[project]
|
|
||||||
name = "DocuMentor"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = "Professionelle XSL-Transformations-Verwaltung und PDF-Generierung"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Version ändern
|
|
||||||
|
|
||||||
**Schritt 1:** Version in `pyproject.toml` ändern:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
version = "0.2.0"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Schritt 2:** Version in `installer.iss` ändern (Zeile 13):
|
|
||||||
|
|
||||||
```iss
|
|
||||||
#define MyAppVersion "0.2.0"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Schritt 3:** Build neu ausführen:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
uv run python build_windows.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Die Versionsinformationen werden automatisch neu generiert.
|
|
||||||
|
|
||||||
### Versionsnummern-Schema
|
|
||||||
|
|
||||||
DocuMentor verwendet [Semantic Versioning](https://semver.org/lang/de/):
|
|
||||||
|
|
||||||
```
|
|
||||||
MAJOR.MINOR.PATCH
|
|
||||||
|
|
||||||
0.1.0 → Erste Beta-Version
|
|
||||||
1.0.0 → Erste stabile Version
|
|
||||||
1.1.0 → Neue Features
|
|
||||||
1.1.1 → Bugfixes
|
|
||||||
2.0.0 → Breaking Changes
|
|
||||||
```
|
|
||||||
|
|
||||||
### Windows-Eigenschaften anzeigen
|
|
||||||
|
|
||||||
Nach dem Build können Sie die Versionsinformationen in Windows anzeigen:
|
|
||||||
|
|
||||||
1. Rechtsklick auf `DocuMentor.exe`
|
|
||||||
2. **Eigenschaften** auswählen
|
|
||||||
3. Tab **Details** öffnen
|
|
||||||
|
|
||||||
Dort sehen Sie:
|
|
||||||
- Dateiversion
|
|
||||||
- Produktversion
|
|
||||||
- Beschreibung
|
|
||||||
- Copyright
|
|
||||||
- Produktname
|
|
||||||
- Original-Dateiname
|
|
||||||
|
|
||||||
## Integration in Build-Prozess
|
|
||||||
|
|
||||||
### DocuMentor.spec
|
|
||||||
|
|
||||||
```python
|
|
||||||
exe = EXE(
|
|
||||||
# ...
|
|
||||||
icon=str(project_root / 'resources' / 'icon.ico') if (project_root / 'resources' / 'icon.ico').exists() else None,
|
|
||||||
version=str(project_root / 'version_info.txt') if (project_root / 'version_info.txt').exists() else None,
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Automatische Erkennung:**
|
|
||||||
- Icon wird verwendet, falls vorhanden
|
|
||||||
- Versionsinformationen werden verwendet, falls vorhanden
|
|
||||||
- Build funktioniert auch ohne Icon/Version (mit Warnung)
|
|
||||||
|
|
||||||
### installer.iss
|
|
||||||
|
|
||||||
```iss
|
|
||||||
SetupIconFile=dist\DocuMentor\icon.ico
|
|
||||||
UninstallDisplayIcon={app}\DocuMentor.exe
|
|
||||||
```
|
|
||||||
|
|
||||||
Das Icon wird automatisch vom `build_windows.py` nach `dist/DocuMentor/` kopiert.
|
|
||||||
|
|
||||||
## Anpassungen
|
|
||||||
|
|
||||||
### Company Name / Copyright
|
|
||||||
|
|
||||||
In `create_version_info.py` (Zeile ~65):
|
|
||||||
|
|
||||||
```python
|
|
||||||
StringStruct('CompanyName', 'Ihr Name/Organisation'),
|
|
||||||
StringStruct('LegalCopyright', '© {year} Ihr Name. Alle Rechte vorbehalten.'),
|
|
||||||
```
|
|
||||||
|
|
||||||
Ändern Sie "Ihr Name/Organisation" auf Ihren tatsächlichen Namen oder Firmennamen.
|
|
||||||
|
|
||||||
### Icon-Design
|
|
||||||
|
|
||||||
Falls Sie das Standard-Icon anpassen möchten, bearbeiten Sie `create_icon.py`:
|
|
||||||
|
|
||||||
**Farben ändern** (Zeile ~31):
|
|
||||||
```python
|
|
||||||
bg_color = (41, 128, 185) # Blau - ändern Sie RGB-Werte
|
|
||||||
```
|
|
||||||
|
|
||||||
**Symbol ändern:**
|
|
||||||
- Bearbeiten Sie die `create_default_icon()` Funktion
|
|
||||||
- Oder erstellen Sie Ihr eigenes Icon in einem Grafikprogramm
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
### Icon-Design
|
|
||||||
|
|
||||||
1. **Einfach und klar**: Funktioniert auch bei 16×16 Pixel
|
|
||||||
2. **Hoher Kontrast**: Gut lesbar auf hellem und dunklem Hintergrund
|
|
||||||
3. **Professionell**: Passend zum Business-Kontext
|
|
||||||
4. **Wiedererkennbar**: Symbolisiert die Anwendung
|
|
||||||
|
|
||||||
### Versionierung
|
|
||||||
|
|
||||||
1. **Semantische Versionierung**: MAJOR.MINOR.PATCH
|
|
||||||
2. **Vor jedem Release aktualisieren**
|
|
||||||
3. **Git-Tags verwenden**: `git tag v0.1.0`
|
|
||||||
4. **GUID beibehalten**: Nie die Inno Setup GUID ändern bei Updates!
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Icon wird nicht angezeigt
|
|
||||||
|
|
||||||
**Problem**: DocuMentor.exe zeigt kein Icon
|
|
||||||
|
|
||||||
**Lösungen:**
|
|
||||||
1. Prüfen ob `resources/icon.ico` existiert
|
|
||||||
2. Build neu ausführen: `uv run python build_windows.py`
|
|
||||||
3. Windows Icon-Cache löschen und neu starten
|
|
||||||
|
|
||||||
### Versionsinformationen fehlen
|
|
||||||
|
|
||||||
**Problem**: Eigenschaften → Details zeigt keine Informationen
|
|
||||||
|
|
||||||
**Lösungen:**
|
|
||||||
1. Prüfen ob `version_info.txt` existiert
|
|
||||||
2. `uv run python create_version_info.py` ausführen
|
|
||||||
3. Build neu ausführen
|
|
||||||
|
|
||||||
### Pillow-Fehler beim Icon-Erstellen
|
|
||||||
|
|
||||||
**Problem**: `ImportError: No module named 'PIL'`
|
|
||||||
|
|
||||||
**Lösung:**
|
|
||||||
```bash
|
|
||||||
uv sync --all-groups
|
|
||||||
```
|
|
||||||
|
|
||||||
Dies installiert Pillow automatisch.
|
|
||||||
|
|
||||||
## Weiterführende Informationen
|
|
||||||
|
|
||||||
- **PyInstaller Icon-Dokumentation**: https://pyinstaller.org/en/stable/usage.html#icons
|
|
||||||
- **Windows ICO Format**: https://en.wikipedia.org/wiki/ICO_(file_format)
|
|
||||||
- **Semantic Versioning**: https://semver.org/lang/de/
|
|
||||||
- **Pillow Dokumentation**: https://pillow.readthedocs.io/
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
GUID-Generator für Inno Setup
|
|
||||||
|
|
||||||
Generiert eine eindeutige GUID für die AppId in installer.iss
|
|
||||||
"""
|
|
||||||
|
|
||||||
import uuid
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
# GUID generieren
|
|
||||||
guid = uuid.uuid4()
|
|
||||||
guid_str = f"{{{{{str(guid).upper()}}}}}"
|
|
||||||
|
|
||||||
print("=" * 60)
|
|
||||||
print("GUID für Inno Setup AppId")
|
|
||||||
print("=" * 60)
|
|
||||||
print()
|
|
||||||
print("Generierte GUID:")
|
|
||||||
print(f" {guid_str}")
|
|
||||||
print()
|
|
||||||
print("Anleitung:")
|
|
||||||
print("1. Kopieren Sie die GUID oben")
|
|
||||||
print("2. Öffnen Sie installer.iss")
|
|
||||||
print("3. Suchen Sie nach 'AppId={{' (Zeile ~22)")
|
|
||||||
print("4. Ersetzen Sie die Beispiel-GUID mit Ihrer neuen GUID")
|
|
||||||
print()
|
|
||||||
print("Beispiel:")
|
|
||||||
print(f" AppId={guid_str}")
|
|
||||||
print()
|
|
||||||
print("WICHTIG:")
|
|
||||||
print("- Die GUID sollte nur EINMAL beim ersten Setup generiert werden")
|
|
||||||
print("- Ändern Sie die GUID NICHT bei Updates, sonst wird die App")
|
|
||||||
print(" als separate Anwendung installiert!")
|
|
||||||
print("=" * 60)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
"""
|
|
||||||
WiX ProductFiles.wxs Generator
|
|
||||||
|
|
||||||
Generiert automatisch eine WXS-Datei mit allen Dateien aus dist/DocuMentor.
|
|
||||||
Ersetzt die veraltete 'wix heat' Funktionalität für WiX v6.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import uuid
|
|
||||||
from pathlib import Path
|
|
||||||
from xml.etree import ElementTree as ET
|
|
||||||
|
|
||||||
|
|
||||||
def generate_guid() -> str:
|
|
||||||
"""Generiert eine neue GUID."""
|
|
||||||
return str(uuid.uuid4()).upper()
|
|
||||||
|
|
||||||
|
|
||||||
def sanitize_id(name: str) -> str:
|
|
||||||
"""
|
|
||||||
Macht einen String WiX-konform für IDs.
|
|
||||||
|
|
||||||
WiX erlaubt nur: A-Z, a-z, 0-9, _, .
|
|
||||||
Darf nicht mit Zahl beginnen.
|
|
||||||
"""
|
|
||||||
# Ersetze illegale Zeichen
|
|
||||||
sanitized = name.replace("-", "_").replace(" ", "_").replace(".", "_")
|
|
||||||
|
|
||||||
# Entferne alle anderen nicht erlaubten Zeichen
|
|
||||||
allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"
|
|
||||||
sanitized = "".join(c if c in allowed else "_" for c in sanitized)
|
|
||||||
|
|
||||||
# Darf nicht mit Zahl beginnen
|
|
||||||
if sanitized and sanitized[0].isdigit():
|
|
||||||
sanitized = f"_{sanitized}"
|
|
||||||
|
|
||||||
return sanitized
|
|
||||||
|
|
||||||
|
|
||||||
def create_wix_fragment(dist_dir: Path) -> ET.Element:
|
|
||||||
"""
|
|
||||||
Erstellt ein WiX Fragment mit allen Dateien aus dem dist Verzeichnis.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
dist_dir: Pfad zum dist/DocuMentor Verzeichnis
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
ET.Element: Wix Root-Element mit Fragment
|
|
||||||
"""
|
|
||||||
# Namespace (WiX v4+)
|
|
||||||
ns = "http://wixtoolset.org/schemas/v4/wxs"
|
|
||||||
ET.register_namespace("", ns)
|
|
||||||
|
|
||||||
# Root Element
|
|
||||||
wix = ET.Element(f"{{{ns}}}Wix")
|
|
||||||
fragment = ET.SubElement(wix, f"{{{ns}}}Fragment")
|
|
||||||
component_group = ET.SubElement(
|
|
||||||
fragment, f"{{{ns}}}ComponentGroup", {"Id": "ProductComponents", "Directory": "INSTALLFOLDER"}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Sammle alle Dateien
|
|
||||||
all_files = sorted(dist_dir.rglob("*"))
|
|
||||||
files_only = [f for f in all_files if f.is_file()]
|
|
||||||
|
|
||||||
print(f"Gefunden: {len(files_only)} Dateien")
|
|
||||||
|
|
||||||
# Gruppiere nach Verzeichnis
|
|
||||||
dirs_dict: dict[Path, list[Path]] = {}
|
|
||||||
for file in files_only:
|
|
||||||
rel_dir = file.parent.relative_to(dist_dir)
|
|
||||||
if rel_dir not in dirs_dict:
|
|
||||||
dirs_dict[rel_dir] = []
|
|
||||||
dirs_dict[rel_dir].append(file)
|
|
||||||
|
|
||||||
# Erstelle Directory Fragments
|
|
||||||
dir_fragment = ET.SubElement(wix, f"{{{ns}}}Fragment")
|
|
||||||
|
|
||||||
# INSTALLFOLDER ist bereits in DocuMentor.wxs definiert
|
|
||||||
directory_ref = ET.SubElement(dir_fragment, f"{{{ns}}}DirectoryRef", {"Id": "INSTALLFOLDER"})
|
|
||||||
|
|
||||||
# Erstelle Verzeichnisstruktur
|
|
||||||
created_dirs = {"INSTALLFOLDER": directory_ref}
|
|
||||||
|
|
||||||
for rel_dir in sorted(dirs_dict.keys()):
|
|
||||||
if rel_dir == Path("."):
|
|
||||||
continue
|
|
||||||
|
|
||||||
parts = rel_dir.parts
|
|
||||||
parent_id = "INSTALLFOLDER"
|
|
||||||
|
|
||||||
for i, part in enumerate(parts):
|
|
||||||
current_path = Path(*parts[: i + 1])
|
|
||||||
dir_id = f"Dir_{sanitize_id(current_path.as_posix().replace('/', '_'))}"
|
|
||||||
|
|
||||||
if dir_id not in created_dirs:
|
|
||||||
parent_elem = created_dirs[parent_id]
|
|
||||||
new_dir = ET.SubElement(parent_elem, f"{{{ns}}}Directory", {"Id": dir_id, "Name": part})
|
|
||||||
created_dirs[dir_id] = new_dir
|
|
||||||
parent_id = dir_id
|
|
||||||
else:
|
|
||||||
parent_id = dir_id
|
|
||||||
|
|
||||||
# Füge Komponenten hinzu
|
|
||||||
component_counter = 0
|
|
||||||
|
|
||||||
for rel_dir, files in sorted(dirs_dict.items()):
|
|
||||||
if rel_dir == Path("."):
|
|
||||||
dir_id = "INSTALLFOLDER"
|
|
||||||
else:
|
|
||||||
dir_id = f"Dir_{sanitize_id(rel_dir.as_posix().replace('/', '_'))}"
|
|
||||||
|
|
||||||
# Erstelle eine Komponente pro Verzeichnis
|
|
||||||
component_id = f"Component_{sanitize_id(dir_id)}"
|
|
||||||
component_counter += 1
|
|
||||||
|
|
||||||
component = ET.SubElement(
|
|
||||||
component_group, f"{{{ns}}}Component", {"Id": component_id, "Directory": dir_id, "Guid": generate_guid()}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Füge alle Dateien des Verzeichnisses hinzu
|
|
||||||
for idx, file in enumerate(files):
|
|
||||||
file_id = f"File_{sanitize_id(component_id)}_{idx}"
|
|
||||||
# Absoluter Pfad für WiX
|
|
||||||
source_path = str(file).replace("/", "\\")
|
|
||||||
|
|
||||||
file_attribs = {"Id": file_id, "Source": source_path, "Name": file.name}
|
|
||||||
|
|
||||||
# Erste Datei ist KeyPath
|
|
||||||
if idx == 0:
|
|
||||||
file_attribs["KeyPath"] = "yes"
|
|
||||||
|
|
||||||
ET.SubElement(component, f"{{{ns}}}File", file_attribs)
|
|
||||||
|
|
||||||
print(f"Erstellt: {component_counter} Komponenten")
|
|
||||||
|
|
||||||
return wix
|
|
||||||
|
|
||||||
|
|
||||||
def format_xml(element: ET.Element, level: int = 0) -> None:
|
|
||||||
"""Formatiert XML mit Einrückungen (in-place)."""
|
|
||||||
indent = " "
|
|
||||||
i = f"\n{indent * level}"
|
|
||||||
|
|
||||||
if len(element):
|
|
||||||
if not element.text or not element.text.strip():
|
|
||||||
element.text = i + indent
|
|
||||||
if not element.tail or not element.tail.strip():
|
|
||||||
element.tail = i
|
|
||||||
last_child = None
|
|
||||||
for child in element:
|
|
||||||
format_xml(child, level + 1)
|
|
||||||
last_child = child
|
|
||||||
if last_child is not None and (not last_child.tail or not last_child.tail.strip()):
|
|
||||||
last_child.tail = i
|
|
||||||
else:
|
|
||||||
if level and (not element.tail or not element.tail.strip()):
|
|
||||||
element.tail = i
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Hauptfunktion."""
|
|
||||||
dist_dir = Path("dist/DocuMentor")
|
|
||||||
output_file = Path("ProductFiles.wxs")
|
|
||||||
|
|
||||||
if not dist_dir.exists():
|
|
||||||
print(f"FEHLER: {dist_dir} existiert nicht!")
|
|
||||||
print("Führe zuerst 'uv run pyinstaller DocuMentor.spec' aus.")
|
|
||||||
return
|
|
||||||
|
|
||||||
print(f"Generiere ProductFiles.wxs aus {dist_dir}...")
|
|
||||||
|
|
||||||
wix_root = create_wix_fragment(dist_dir)
|
|
||||||
format_xml(wix_root)
|
|
||||||
|
|
||||||
# Schreibe XML
|
|
||||||
tree = ET.ElementTree(wix_root)
|
|
||||||
tree.write(output_file, encoding="utf-8", xml_declaration=True)
|
|
||||||
|
|
||||||
print(f"[OK] {output_file} erfolgreich erstellt!")
|
|
||||||
print(f"\nNaechste Schritte:")
|
|
||||||
print(f"1. wix build DocuMentor.wxs ProductFiles.wxs -o DocuMentor.msi")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
; Inno Setup Konfiguration für DocuMentor
|
|
||||||
; Erstellt eine professionelle Setup.exe für Windows
|
|
||||||
;
|
|
||||||
; Installation von Inno Setup: https://jrsoftware.org/isdl.php
|
|
||||||
;
|
|
||||||
; WICHTIG: Vor dem ersten Build GUID generieren!
|
|
||||||
; python -c "import uuid; print(f'{{{{' + str(uuid.uuid4()).upper() + '}}}}')"
|
|
||||||
; Ergebnis in AppId unten einfügen
|
|
||||||
;
|
|
||||||
; Build-Befehl: iscc installer.iss
|
|
||||||
|
|
||||||
#define MyAppName "DocuMentor"
|
|
||||||
#define MyAppVersion "1.7.0"
|
|
||||||
#define MyAppPublisher "Ihr Name/Organisation"
|
|
||||||
#define MyAppURL "https://github.com/yourusername/xsl-validator"
|
|
||||||
#define MyAppExeName "DocuMentor.exe"
|
|
||||||
|
|
||||||
[Setup]
|
|
||||||
; Basis-Informationen
|
|
||||||
; WICHTIG: Ersetzen Sie die GUID mit einer eigenen generierten GUID!
|
|
||||||
; AppId={{BEISPIEL-GUID-HIER-EINFÜGEN}}
|
|
||||||
AppId={{A1B2C3D4-E5F6-4789-ABCD-EF0123456789}}
|
|
||||||
AppName={#MyAppName}
|
|
||||||
AppVersion={#MyAppVersion}
|
|
||||||
AppPublisher={#MyAppPublisher}
|
|
||||||
AppPublisherURL={#MyAppURL}
|
|
||||||
AppSupportURL={#MyAppURL}
|
|
||||||
AppUpdatesURL={#MyAppURL}
|
|
||||||
|
|
||||||
; Installation
|
|
||||||
DefaultDirName={autopf}\{#MyAppName}
|
|
||||||
DefaultGroupName={#MyAppName}
|
|
||||||
AllowNoIcons=yes
|
|
||||||
|
|
||||||
; Output
|
|
||||||
OutputDir=dist\installer
|
|
||||||
OutputBaseFilename=DocuMentor-Setup-{#MyAppVersion}
|
|
||||||
SetupIconFile=dist\DocuMentor\icon.ico
|
|
||||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
|
||||||
|
|
||||||
; Kompression
|
|
||||||
Compression=lzma
|
|
||||||
SolidCompression=yes
|
|
||||||
|
|
||||||
; Moderne UI
|
|
||||||
WizardStyle=modern
|
|
||||||
|
|
||||||
; Rechte (normal für User-Installation, admin für System-weite Installation)
|
|
||||||
PrivilegesRequired=lowest
|
|
||||||
PrivilegesRequiredOverridesAllowed=dialog
|
|
||||||
|
|
||||||
[Languages]
|
|
||||||
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
|
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
||||||
|
|
||||||
[Tasks]
|
|
||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
|
||||||
|
|
||||||
[Files]
|
|
||||||
; Alle Dateien aus dem PyInstaller-Build
|
|
||||||
Source: "dist\DocuMentor\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
||||||
|
|
||||||
[Icons]
|
|
||||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
|
||||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
|
||||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
|
||||||
|
|
||||||
[Run]
|
|
||||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
|
||||||
|
|
||||||
[Messages]
|
|
||||||
; Deutsche Anpassungen
|
|
||||||
german.WelcomeLabel2=Dies wird [name/ver] auf Ihrem Computer installieren.%n%nBitte stellen Sie sicher, dass folgende externe Tools installiert sind:%n• Java Runtime Environment (JRE)%n• Apache FOP%n• Saxon XSLT-Prozessor%n• diff-pdf
|
|
||||||
@@ -1,18 +1,15 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "DocuMentor"
|
name = "DocuMentor"
|
||||||
version = "1.7.0"
|
version = "0.1.0"
|
||||||
description = "Professionelle XSL-Transformations-Verwaltung und PDF-Generierung"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = {text = "MIT"}
|
requires-python = ">=3.13"
|
||||||
requires-python = ">=3.13,<3.15"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pydantic-settings>=2.12.0",
|
"pyqtdarktheme>=2.1.0",
|
||||||
"pyside6>=6.10.1",
|
"pydantic-settings>=2.9.1",
|
||||||
"polars[connectorx,pyarrow]>=1.37.0",
|
"pyside6>=6.9.1",
|
||||||
"connectorx>=0.4.0",
|
"polars[connectorx,pyarrow]>=1.31.0",
|
||||||
"pydantic-yaml>=1.6.0",
|
"pydantic-yaml>=1.5.1",
|
||||||
"psutil>=6.1.1",
|
|
||||||
"lxml>=6.0.2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
@@ -27,7 +24,5 @@ extend-exclude = ["*_ui.py"]
|
|||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
"ruff>=0.14.11",
|
"ruff>=0.14.8",
|
||||||
"pyinstaller>=6.0.0",
|
|
||||||
"pillow>=10.0.0",
|
|
||||||
]
|
]
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 678 KiB |
|
Before Width: | Height: | Size: 819 KiB |
@@ -1,64 +0,0 @@
|
|||||||
# Resources für DocuMentor
|
|
||||||
|
|
||||||
Dieses Verzeichnis enthält Ressourcen für den Windows-Build.
|
|
||||||
|
|
||||||
## Icon (icon.ico)
|
|
||||||
|
|
||||||
Das Icon wird verwendet für:
|
|
||||||
- Windows-Executable (DocuMentor.exe)
|
|
||||||
- Inno Setup Installer
|
|
||||||
- Desktop-Verknüpfungen
|
|
||||||
- Start-Menü-Einträge
|
|
||||||
|
|
||||||
### Icon erstellen
|
|
||||||
|
|
||||||
#### Automatisch (Standard-Icon):
|
|
||||||
```bash
|
|
||||||
python create_icon.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Dies erstellt ein einfaches Standard-Icon mit DocuMentor-Branding.
|
|
||||||
|
|
||||||
#### Aus eigenem PNG-Bild:
|
|
||||||
```bash
|
|
||||||
python create_icon.py mein-icon.png
|
|
||||||
```
|
|
||||||
|
|
||||||
Ihr PNG sollte idealerweise:
|
|
||||||
- Mindestens 256x256 Pixel groß sein
|
|
||||||
- Quadratisch sein
|
|
||||||
- Transparenten Hintergrund haben (optional)
|
|
||||||
|
|
||||||
### Icon-Anforderungen
|
|
||||||
|
|
||||||
Das `.ico`-Dateiformat enthält mehrere Auflösungen:
|
|
||||||
- 256x256 (Windows 7+, Taskleiste)
|
|
||||||
- 128x128
|
|
||||||
- 64x64
|
|
||||||
- 48x48 (Standard Desktop-Icon)
|
|
||||||
- 32x32 (Explorer Details)
|
|
||||||
- 16x16 (kleines Icon)
|
|
||||||
|
|
||||||
Das `create_icon.py` Skript erstellt automatisch alle diese Größen.
|
|
||||||
|
|
||||||
## Icon manuell ersetzen
|
|
||||||
|
|
||||||
1. Eigenes Icon als `resources/icon.ico` speichern
|
|
||||||
2. Oder mit einem Online-Tool PNG→ICO konvertieren
|
|
||||||
3. Build-Skript verwendet automatisch die vorhandene Datei
|
|
||||||
|
|
||||||
## Design-Richtlinien
|
|
||||||
|
|
||||||
Falls Sie ein eigenes Icon erstellen:
|
|
||||||
- **Einfach und klar**: Funktioniert auch in kleinen Größen (16x16)
|
|
||||||
- **Professionell**: Passend zum Business-Kontext
|
|
||||||
- **Wiedererkennbar**: DocuMentor steht für Dokumenten-Management
|
|
||||||
- **Kontrast**: Gut sichtbar auf hellem und dunklem Hintergrund
|
|
||||||
|
|
||||||
## Weitere Ressourcen
|
|
||||||
|
|
||||||
In diesem Verzeichnis können später weitere Ressourcen abgelegt werden:
|
|
||||||
- Splash-Screen-Bilder
|
|
||||||
- Toolbar-Icons
|
|
||||||
- Dokumentations-Bilder
|
|
||||||
- etc.
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
Erstelle ein professionelles Icon für eine Desktop-Anwendung namens "DocuMentor".
|
|
||||||
|
|
||||||
Die Anwendung wird verwendet für:
|
|
||||||
- Verwaltung von XSL-Transformationen
|
|
||||||
- Umwandlung von XML-Dokumenten zu PDF-Dateien
|
|
||||||
- Vergleich und Validierung von PDF-Dokumenten
|
|
||||||
|
|
||||||
Design-Anforderungen:
|
|
||||||
|
|
||||||
1. Stil: Minimalistisch, modern, professionell, business-orientiert
|
|
||||||
|
|
||||||
2. Farben:
|
|
||||||
- Hauptfarbe: Blau (#2980B9 oder ähnlich)
|
|
||||||
- Akzentfarbe: Weiß oder helles Grau
|
|
||||||
- Maximal 2-3 Farben insgesamt
|
|
||||||
|
|
||||||
3. Elemente (wähle eine Kombination):
|
|
||||||
- Dokument-Symbol (Papier/Seite)
|
|
||||||
- Transformation/Workflow-Element (Pfeil, Zahnrad)
|
|
||||||
- Optional: Stilisierter Buchstabe "M" oder "D"
|
|
||||||
|
|
||||||
4. Technische Anforderungen:
|
|
||||||
- Quadratisches Format
|
|
||||||
- Einfache, klare Linien
|
|
||||||
- Hoher Kontrast
|
|
||||||
- Muss auch bei 16x16 Pixel noch erkennbar sein
|
|
||||||
- Flat Design (keine 3D-Effekte)
|
|
||||||
- Keine Farbverläufe
|
|
||||||
|
|
||||||
5. Hintergrund:
|
|
||||||
- Transparent ODER
|
|
||||||
- Einfarbig (blau oder weiß)
|
|
||||||
|
|
||||||
6. Referenz-Stil:
|
|
||||||
- Ähnlich wie Microsoft Office Icons
|
|
||||||
- Ähnlich wie Visual Studio Code Icons
|
|
||||||
- Moderne SaaS-Anwendungs-Icons
|
|
||||||
|
|
||||||
Bitte erstelle ein Icon, das:
|
|
||||||
- Professionell und vertrauenswürdig wirkt
|
|
||||||
- Für technische Anwender geeignet ist
|
|
||||||
- Gut in einer Windows-Taskleiste aussieht
|
|
||||||
- Auch als Desktop-Verknüpfung funktioniert
|
|
||||||
|
|
||||||
Format: PNG oder SVG, mindestens 512x512 Pixel
|
|
||||||
|
Before Width: | Height: | Size: 38 KiB |
@@ -1,150 +0,0 @@
|
|||||||
# Icon-Prompt für Bild-Generierungs-KI
|
|
||||||
|
|
||||||
## DocuMentor Logo/Icon
|
|
||||||
|
|
||||||
### Deutsche Version (für deutsche KI-Tools)
|
|
||||||
|
|
||||||
```
|
|
||||||
Erstelle ein professionelles, minimalistisches SVG-Icon für eine Business-Software namens "DocuMentor".
|
|
||||||
|
|
||||||
Anwendungsbeschreibung:
|
|
||||||
DocuMentor ist eine Desktop-Anwendung zur Verwaltung und Validierung von XSL-Transformationen. Die Software wird von technischen Redakteuren und Entwicklern verwendet, um XML-Dokumente in PDF-Dateien zu transformieren und diese zu vergleichen.
|
|
||||||
|
|
||||||
Design-Anforderungen:
|
|
||||||
- Stil: Professionell, modern, technisch, business-orientiert
|
|
||||||
- Farben: Blaue Töne (z.B. #2980B9, #3498DB) kombiniert mit neutralen Grautönen oder Weiß
|
|
||||||
- Elemente: Kombination aus Dokumenten-Symbol und Transformations-/Workflow-Elementen
|
|
||||||
- Einfachheit: Muss auch in sehr kleinen Größen (16x16 Pixel) erkennbar sein
|
|
||||||
- Klare Linien und hoher Kontrast
|
|
||||||
|
|
||||||
Symbolik-Vorschläge:
|
|
||||||
- Ein Dokument mit Transformations-Pfeilen
|
|
||||||
- Gestapelte/verschachtelte Dokumente (XML → XSLT → PDF)
|
|
||||||
- Stilisiertes "D" oder "M" für DocuMentor
|
|
||||||
- Workflow-Diagramm mit Dokumenten-Symbolen
|
|
||||||
- Dokument mit Zahnrad (Verarbeitung/Transformation)
|
|
||||||
|
|
||||||
Format: Vektorgrafik (SVG), quadratisch (1:1 Verhältnis), 512x512 Pixel oder größer
|
|
||||||
Hintergrund: Transparent oder einfarbig (blau/weiß)
|
|
||||||
|
|
||||||
Stil-Referenzen: Microsoft Office Icons, Adobe Creative Cloud Icons, moderne SaaS-Anwendungen
|
|
||||||
```
|
|
||||||
|
|
||||||
### Englische Version (für internationale KI-Tools wie DALL-E, Midjourney, Stable Diffusion)
|
|
||||||
|
|
||||||
```
|
|
||||||
Create a professional, minimalist SVG icon for business software called "DocuMentor".
|
|
||||||
|
|
||||||
Application Description:
|
|
||||||
DocuMentor is a desktop application for managing and validating XSL transformations. The software is used by technical writers and developers to transform XML documents into PDF files and compare them.
|
|
||||||
|
|
||||||
Design Requirements:
|
|
||||||
- Style: Professional, modern, technical, business-oriented
|
|
||||||
- Colors: Blue tones (e.g., #2980B9, #3498DB) combined with neutral grays or white
|
|
||||||
- Elements: Combination of document symbol and transformation/workflow elements
|
|
||||||
- Simplicity: Must be recognizable even at very small sizes (16x16 pixels)
|
|
||||||
- Clean lines and high contrast
|
|
||||||
|
|
||||||
Symbolism Suggestions:
|
|
||||||
- A document with transformation arrows
|
|
||||||
- Stacked/nested documents (XML → XSLT → PDF)
|
|
||||||
- Stylized "D" or "M" for DocuMentor
|
|
||||||
- Workflow diagram with document symbols
|
|
||||||
- Document with gear icon (processing/transformation)
|
|
||||||
|
|
||||||
Format: Vector graphic (SVG), square (1:1 ratio), 512x512 pixels or larger
|
|
||||||
Background: Transparent or solid color (blue/white)
|
|
||||||
|
|
||||||
Style References: Microsoft Office icons, Adobe Creative Cloud icons, modern SaaS applications
|
|
||||||
|
|
||||||
Additional Instructions:
|
|
||||||
- Flat design, not 3D
|
|
||||||
- No gradients or complex shadows
|
|
||||||
- Maximum 3 colors
|
|
||||||
- Geometric shapes preferred
|
|
||||||
- Professional and trustworthy appearance
|
|
||||||
```
|
|
||||||
|
|
||||||
### Alternativer Prompt (detaillierter für KIs wie ChatGPT mit DALL-E)
|
|
||||||
|
|
||||||
```
|
|
||||||
Design a minimalist icon for "DocuMentor" - a professional XML/XSL transformation management software.
|
|
||||||
|
|
||||||
Concept: A clean, modern icon that combines:
|
|
||||||
1. A document/page symbol (representing XML/PDF files)
|
|
||||||
2. An element suggesting transformation or workflow (arrows, gears, or connecting lines)
|
|
||||||
3. Professional color scheme: Primary blue (#2980B9) with white/gray accents
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
- Vector style, flat design
|
|
||||||
- Must work well at 16x16, 48x48, and 256x256 pixels
|
|
||||||
- High contrast for visibility
|
|
||||||
- No text, icon only
|
|
||||||
- Square format (512x512px minimum)
|
|
||||||
- Transparent background preferred
|
|
||||||
|
|
||||||
Style inspiration: Think Microsoft Office 365 icons, VS Code icons, or modern productivity app icons - clean, professional, instantly recognizable.
|
|
||||||
|
|
||||||
Technical constraints:
|
|
||||||
- Simple enough to work as a favicon
|
|
||||||
- Clear silhouette when shown in monochrome
|
|
||||||
- Distinctive enough to stand out in a taskbar or dock
|
|
||||||
```
|
|
||||||
|
|
||||||
## Prompt für spezifische Konzepte
|
|
||||||
|
|
||||||
### Konzept 1: Dokument mit Transformation
|
|
||||||
|
|
||||||
```
|
|
||||||
A minimalist icon showing a document page with a curved arrow pointing to another document, symbolizing transformation. Blue (#2980B9) and white color scheme. Flat design, professional, suitable for business software. SVG style, 512x512px, transparent background.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Konzept 2: Gestapelte Dokumente
|
|
||||||
|
|
||||||
```
|
|
||||||
An icon with three overlapping document sheets in a cascading arrangement, representing XML to XSL to PDF transformation workflow. Modern flat design, blue gradient (#3498DB to #2980B9), white accents. Professional business software icon. 512x512px SVG format.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Konzept 3: Dokument + Zahnrad
|
|
||||||
|
|
||||||
```
|
|
||||||
A clean icon combining a document page with a small gear/cog symbol in the corner, representing document processing. Minimalist design, blue (#2980B9) on white background. Professional style like Microsoft Office icons. 512x512px, vector art, high contrast.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Konzept 4: Stilisiertes "M"
|
|
||||||
|
|
||||||
```
|
|
||||||
A stylized letter "M" for "Mentor" integrated with document/page elements. Modern, geometric, professional. Blue (#2980B9) color scheme. Suitable for small sizes. Flat design, vector style, 512x512px, transparent background.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Verwendung
|
|
||||||
|
|
||||||
1. Wähle einen der Prompts oben
|
|
||||||
2. Füge ihn in eine Bild-Generierungs-KI ein:
|
|
||||||
- **DALL-E 3** (ChatGPT Plus): Englischer Prompt empfohlen
|
|
||||||
- **Midjourney**: Englischer Prompt, evtl. kürzer
|
|
||||||
- **Adobe Firefly**: Deutscher oder englischer Prompt
|
|
||||||
- **Stable Diffusion**: Englischer Prompt mit detaillierten Tags
|
|
||||||
- **Leonardo.ai**: Englischer Prompt
|
|
||||||
|
|
||||||
3. Lade das generierte Bild herunter (idealerweise als PNG)
|
|
||||||
|
|
||||||
4. Konvertiere zu ICO:
|
|
||||||
```bash
|
|
||||||
uv run python create_icon.py generiertes-icon.png
|
|
||||||
```
|
|
||||||
|
|
||||||
## Tipps für beste Ergebnisse
|
|
||||||
|
|
||||||
- **Iteriere**: Generiere mehrere Varianten
|
|
||||||
- **Einfachheit**: Betone "minimalist", "simple", "clean"
|
|
||||||
- **Größe**: Teste das Icon in verschiedenen Größen
|
|
||||||
- **Kontrast**: Achte auf gute Sichtbarkeit auf hellem und dunklem Hintergrund
|
|
||||||
- **Professionalität**: Vermeide zu verspielte oder kindliche Designs
|
|
||||||
|
|
||||||
## Nachbearbeitung
|
|
||||||
|
|
||||||
Falls die KI kein perfektes SVG erstellt:
|
|
||||||
1. PNG exportieren (hohe Auflösung, mind. 512x512px)
|
|
||||||
2. Mit Inkscape oder Adobe Illustrator zu SVG konvertieren
|
|
||||||
3. Oder direkt als PNG verwenden und mit `create_icon.py` konvertieren
|
|
||||||
|
Before Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 605 KiB |
|
Before Width: | Height: | Size: 17 KiB |
@@ -1,76 +0,0 @@
|
|||||||
"""
|
|
||||||
Lädt Feather Icons (MIT-Lizenz) von GitHub herunter und speichert sie in src/res/icons/.
|
|
||||||
Stroke-Farbe wird auf #444444 gesetzt für bessere Sichtbarkeit in hellen und dunklen Themes.
|
|
||||||
|
|
||||||
Ausführung: uv run python scripts/download_icons.py
|
|
||||||
"""
|
|
||||||
|
|
||||||
import urllib.request
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
ICONS = [
|
|
||||||
"folder-plus",
|
|
||||||
"log-out",
|
|
||||||
"settings",
|
|
||||||
"folder",
|
|
||||||
"refresh-cw",
|
|
||||||
"plus-circle",
|
|
||||||
"minus-circle",
|
|
||||||
"play-circle",
|
|
||||||
"file",
|
|
||||||
"check-circle",
|
|
||||||
"info",
|
|
||||||
"git-branch",
|
|
||||||
"file-text",
|
|
||||||
"code",
|
|
||||||
"chevron-down",
|
|
||||||
"chevron-up",
|
|
||||||
"trash-2",
|
|
||||||
"file-plus",
|
|
||||||
"columns",
|
|
||||||
"sliders",
|
|
||||||
"folder-open",
|
|
||||||
]
|
|
||||||
|
|
||||||
BASE_URL = "https://raw.githubusercontent.com/feathericons/feather/master/icons/{name}.svg"
|
|
||||||
OUTPUT_DIR = Path(__file__).parent.parent / "src" / "res" / "icons"
|
|
||||||
|
|
||||||
|
|
||||||
def download_icons():
|
|
||||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
success = 0
|
|
||||||
failed = []
|
|
||||||
|
|
||||||
for name in ICONS:
|
|
||||||
url = BASE_URL.format(name=name)
|
|
||||||
dest = OUTPUT_DIR / f"{name}.svg"
|
|
||||||
|
|
||||||
if dest.exists():
|
|
||||||
print(f" [OK] {name}.svg (bereits vorhanden)")
|
|
||||||
success += 1
|
|
||||||
continue
|
|
||||||
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(url, timeout=10) as response:
|
|
||||||
content = response.read().decode("utf-8")
|
|
||||||
|
|
||||||
content = content.replace('stroke="#000000"', 'stroke="#444444"')
|
|
||||||
content = content.replace("stroke='#000000'", "stroke='#444444'")
|
|
||||||
|
|
||||||
dest.write_text(content, encoding="utf-8")
|
|
||||||
print(f" [OK] {name}.svg")
|
|
||||||
success += 1
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f" [FEHLER] {name}.svg: {e}")
|
|
||||||
failed.append(name)
|
|
||||||
|
|
||||||
print(f"\n{success}/{len(ICONS)} Icons heruntergeladen nach {OUTPUT_DIR}")
|
|
||||||
if failed:
|
|
||||||
print(f"Fehlgeschlagen: {', '.join(failed)}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
print(f"Lade {len(ICONS)} Feather Icons herunter ...")
|
|
||||||
download_icons()
|
|
||||||
@@ -73,72 +73,6 @@ class SSLMode(str, Enum):
|
|||||||
VERIFY_FULL = "verify-full"
|
VERIFY_FULL = "verify-full"
|
||||||
|
|
||||||
|
|
||||||
class XsltVersion(str, Enum):
|
|
||||||
"""XSLT-Version für Saxon-Transformationen."""
|
|
||||||
|
|
||||||
XSLT_1_0 = "1.0" # JAXP API (nur XSLT 1.0)
|
|
||||||
XSLT_2_0_3_0 = "2.0/3.0" # s9api (XSLT 2.0 und 3.0)
|
|
||||||
|
|
||||||
|
|
||||||
class GraphLayout(str, Enum):
|
|
||||||
"""vis.js Physics-Solver / Layout-Modus."""
|
|
||||||
|
|
||||||
BARNES_HUT = "barnesHut"
|
|
||||||
FORCE_ATLAS2 = "forceAtlas2Based"
|
|
||||||
REPULSION = "repulsion"
|
|
||||||
HIERARCHICAL = "hierarchical"
|
|
||||||
|
|
||||||
|
|
||||||
class HierarchicalDirection(str, Enum):
|
|
||||||
"""Richtung für hierarchisches Layout."""
|
|
||||||
|
|
||||||
UD = "UD"
|
|
||||||
DU = "DU"
|
|
||||||
LR = "LR"
|
|
||||||
RL = "RL"
|
|
||||||
|
|
||||||
|
|
||||||
class HierarchicalSortMethod(str, Enum):
|
|
||||||
"""Sortiermethode für hierarchisches Layout."""
|
|
||||||
|
|
||||||
HUBSIZE = "hubsize"
|
|
||||||
DIRECTED = "directed"
|
|
||||||
|
|
||||||
|
|
||||||
class GraphLayoutSettings(BaseModel):
|
|
||||||
"""Persistierte vis.js Layout-Einstellungen für den XSL-Abhängigkeitsgraph."""
|
|
||||||
|
|
||||||
layout: GraphLayout = GraphLayout.BARNES_HUT
|
|
||||||
|
|
||||||
# barnesHut
|
|
||||||
bh_gravitational_constant: int = -3000
|
|
||||||
bh_central_gravity: float = 0.3
|
|
||||||
bh_spring_length: int = 150
|
|
||||||
bh_spring_constant: float = 0.04
|
|
||||||
bh_damping: float = 0.09
|
|
||||||
|
|
||||||
# forceAtlas2Based
|
|
||||||
fa_gravitational_constant: int = -50
|
|
||||||
fa_central_gravity: float = 0.01
|
|
||||||
fa_spring_length: int = 100
|
|
||||||
fa_spring_constant: float = 0.08
|
|
||||||
fa_damping: float = 0.4
|
|
||||||
|
|
||||||
# repulsion
|
|
||||||
re_node_distance: int = 120
|
|
||||||
re_central_gravity: float = 0.0
|
|
||||||
re_spring_length: int = 200
|
|
||||||
re_spring_constant: float = 0.05
|
|
||||||
re_damping: float = 0.09
|
|
||||||
|
|
||||||
# hierarchical
|
|
||||||
hi_direction: HierarchicalDirection = HierarchicalDirection.UD
|
|
||||||
hi_sort_method: HierarchicalSortMethod = HierarchicalSortMethod.HUBSIZE
|
|
||||||
hi_level_separation: int = 150
|
|
||||||
hi_node_spacing: int = 100
|
|
||||||
hi_tree_spacing: int = 200
|
|
||||||
|
|
||||||
|
|
||||||
class PostgreSqlDb(BaseModel):
|
class PostgreSqlDb(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
name: str
|
name: str
|
||||||
@@ -148,7 +82,6 @@ class PostgreSqlDb(BaseModel):
|
|||||||
username: str
|
username: str
|
||||||
password: str
|
password: str
|
||||||
ssl_mode: SSLMode = SSLMode.PREFER
|
ssl_mode: SSLMode = SSLMode.PREFER
|
||||||
timeout: int = 10
|
|
||||||
|
|
||||||
|
|
||||||
class Project(BaseModel):
|
class Project(BaseModel):
|
||||||
@@ -162,31 +95,42 @@ class Project(BaseModel):
|
|||||||
xsl_dir_id: int = Field(..., description="ID des XSL-Verzeichnisses", gt=0)
|
xsl_dir_id: int = Field(..., description="ID des XSL-Verzeichnisses", gt=0)
|
||||||
postgre_sql_db_id: int = Field(..., description="ID der PostgreSQL Datenbank", gt=0)
|
postgre_sql_db_id: int = Field(..., description="ID der PostgreSQL Datenbank", gt=0)
|
||||||
fop_config_dir: Path | None = Field(None, description="Optionaler Pfad zum Apache FOP Config-Verzeichnis")
|
fop_config_dir: Path | None = Field(None, description="Optionaler Pfad zum Apache FOP Config-Verzeichnis")
|
||||||
xslt_params: dict[str, str] = Field(default_factory=dict, description="Projektweite XSLT-Parameter")
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _lookup(collection, item_id: int, attr: str) -> str:
|
|
||||||
"""Sucht einen Wert in einer Konfigurationsliste anhand der ID."""
|
|
||||||
value = [getattr(x, attr) for x in collection if x.id == item_id]
|
|
||||||
return value[0] if value else ""
|
|
||||||
|
|
||||||
def getXsl(self) -> str:
|
def getXsl(self) -> str:
|
||||||
return self._lookup(app_settings.xsl_dirs, self.xsl_dir_id, "name")
|
global app_settings
|
||||||
|
value = [x.name for x in app_settings.xsl_dirs if x.id == self.xsl_dir_id]
|
||||||
|
|
||||||
|
return value[0] if len(value) else ""
|
||||||
|
|
||||||
def getJavaVm(self) -> str:
|
def getJavaVm(self) -> str:
|
||||||
return self._lookup(app_settings.java_vms, self.java_vm_id, "version")
|
global app_settings
|
||||||
|
value = [x.version for x in app_settings.java_vms if x.id == self.java_vm_id]
|
||||||
|
|
||||||
|
return value[0] if len(value) else ""
|
||||||
|
|
||||||
def getSaxon(self) -> str:
|
def getSaxon(self) -> str:
|
||||||
return self._lookup(app_settings.saxon_jars, self.saxon_jar_id, "version")
|
global app_settings
|
||||||
|
value = [x.version for x in app_settings.saxon_jars if x.id == self.saxon_jar_id]
|
||||||
|
|
||||||
|
return value[0] if len(value) else ""
|
||||||
|
|
||||||
def getApacheFop(self) -> str:
|
def getApacheFop(self) -> str:
|
||||||
return self._lookup(app_settings.apache_fops, self.apache_fop_id, "version")
|
global app_settings
|
||||||
|
value = [x.version for x in app_settings.apache_fops if x.id == self.apache_fop_id]
|
||||||
|
|
||||||
|
return value[0] if len(value) else ""
|
||||||
|
|
||||||
def getDiffPdf(self) -> str:
|
def getDiffPdf(self) -> str:
|
||||||
return self._lookup(app_settings.diff_pdfs, self.diff_pdf_id, "version")
|
global app_settings
|
||||||
|
value = [x.version for x in app_settings.diff_pdfs if x.id == self.diff_pdf_id]
|
||||||
|
|
||||||
|
return value[0] if len(value) else ""
|
||||||
|
|
||||||
def getPostgreSqlDb(self) -> str:
|
def getPostgreSqlDb(self) -> str:
|
||||||
return self._lookup(app_settings.postgresql_dbs, self.postgre_sql_db_id, "name")
|
global app_settings
|
||||||
|
value = [x.name for x in app_settings.postgresql_dbs if x.id == self.postgre_sql_db_id]
|
||||||
|
|
||||||
|
return value[0] if len(value) else ""
|
||||||
|
|
||||||
|
|
||||||
class AppSettings(BaseSettings):
|
class AppSettings(BaseSettings):
|
||||||
@@ -199,15 +143,11 @@ class AppSettings(BaseSettings):
|
|||||||
postgresql_dbs: list[PostgreSqlDb] = []
|
postgresql_dbs: list[PostgreSqlDb] = []
|
||||||
theme: str | None = None
|
theme: str | None = None
|
||||||
max_workers: int = 8 # Anzahl paralleler Worker für Transformationen (Standard: 8)
|
max_workers: int = 8 # Anzahl paralleler Worker für Transformationen (Standard: 8)
|
||||||
use_saxon_worker_pool: bool = True # SaxonWorkerPool aktivieren (schneller, benötigt JDK)
|
|
||||||
saxon_xslt_version: XsltVersion = XsltVersion.XSLT_2_0_3_0 # XSLT-Version für Saxon (Standard: 2.0/3.0 mit s9api)
|
|
||||||
use_fop_worker_pool: bool = True # FopWorkerPool aktivieren (schneller, benötigt JDK)
|
|
||||||
|
|
||||||
# UI-Zustand
|
# UI-Zustand
|
||||||
window_geometry: tuple[int, int, int, int] | None = None # (x, y, width, height)
|
window_geometry: tuple[int, int, int, int] | None = None # (x, y, width, height)
|
||||||
splitter_sizes: list[int] | None = None # Splitter-Positionen
|
splitter_sizes: list[int] | None = None # Splitter-Positionen
|
||||||
tree_column_widths: list[int] | None = None # TreeWidget-Spaltenbreiten
|
tree_column_widths: list[int] | None = None # TreeWidget-Spaltenbreiten
|
||||||
graph_layout_settings: GraphLayoutSettings = Field(default_factory=GraphLayoutSettings)
|
|
||||||
|
|
||||||
model_config = SettingsConfigDict(json_file=config_path)
|
model_config = SettingsConfigDict(json_file=config_path)
|
||||||
|
|
||||||
@@ -223,6 +163,7 @@ class AppSettings(BaseSettings):
|
|||||||
return (JsonConfigSettingsSource(settings_cls),)
|
return (JsonConfigSettingsSource(settings_cls),)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
global config_path
|
||||||
# Ordner existert nicht
|
# Ordner existert nicht
|
||||||
if not config_path.parent.exists():
|
if not config_path.parent.exists():
|
||||||
config_path.parent.mkdir(parents=True, exist_ok=True)
|
config_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
@@ -266,7 +207,6 @@ class ProjectData(BaseModel):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
nodes: list[TreeNode] = []
|
nodes: list[TreeNode] = []
|
||||||
expanded_nodes: list[tuple] | None = None # Optional: IDs der aufgeklappten Knoten (TreeNode und XslFile)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def readSettings(cls, project_dir: Path):
|
def readSettings(cls, project_dir: Path):
|
||||||
|
|||||||
@@ -1,282 +0,0 @@
|
|||||||
"""
|
|
||||||
FOP Worker Pool - Persistente JVM-Prozesse für schnelle PDF-Generierung.
|
|
||||||
|
|
||||||
Eliminiert JVM-Startup-Overhead durch Vorinitialisierung von N Worker-Prozessen.
|
|
||||||
Jeder Worker läuft als Daemon und verarbeitet mehrere FO→PDF Transformationen nacheinander.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import glob
|
|
||||||
import logging
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from worker_pool_base import BaseWorkerPool, _CLASSPATH_SEP
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
# Java-Worker-Code (wird zur Laufzeit kompiliert)
|
|
||||||
FOP_WORKER_JAVA = """
|
|
||||||
import org.apache.fop.apps.*;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
import javax.xml.transform.*;
|
|
||||||
import javax.xml.transform.sax.SAXResult;
|
|
||||||
import javax.xml.transform.stream.StreamSource;
|
|
||||||
import java.io.*;
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
public class FopWorker {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
String line;
|
|
||||||
|
|
||||||
System.err.println("FopWorker starting...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Create FopFactory once and reuse (major performance boost!)
|
|
||||||
FopFactory fopFactory = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Check if config file is provided as first argument
|
|
||||||
if (args.length > 0 && !args[0].isEmpty()) {
|
|
||||||
File configFile = new File(args[0]);
|
|
||||||
if (configFile.exists()) {
|
|
||||||
System.err.println("Loading FOP config: " + configFile.getAbsolutePath());
|
|
||||||
fopFactory = FopFactory.newInstance(configFile);
|
|
||||||
} else {
|
|
||||||
System.err.println("Config file not found, using default configuration");
|
|
||||||
fopFactory = FopFactory.newInstance(new File(".").toURI());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.err.println("No config file specified, using default FOP configuration");
|
|
||||||
fopFactory = FopFactory.newInstance(new File(".").toURI());
|
|
||||||
}
|
|
||||||
|
|
||||||
System.err.println("FopWorker started and ready");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("FATAL: Failed to initialize FopFactory: " + e.getMessage());
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
System.err.println("DEBUG: Received line: " + line.substring(0, Math.min(100, line.length())));
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
if ("EXIT".equals(line.trim())) {
|
|
||||||
System.err.println("FopWorker exiting");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Parse job
|
|
||||||
System.err.println("DEBUG: Parsing job...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
String[] parts = line.split("\\t");
|
|
||||||
System.err.println("DEBUG: Parts count: " + parts.length);
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
if (parts.length < 2) {
|
|
||||||
System.out.println("ERROR: Invalid job format");
|
|
||||||
System.out.flush();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String inputFo = parts[0];
|
|
||||||
String outputPdf = parts[1];
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Input FO: " + inputFo);
|
|
||||||
System.err.println("DEBUG: Output PDF: " + outputPdf);
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Create FOUserAgent for this transformation
|
|
||||||
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
|
|
||||||
|
|
||||||
// Note: Event Listener für detailliertes Error-Logging könnte hier hinzugefügt werden,
|
|
||||||
// aber ist nicht kritisch - Fehler werden durch Exceptions gefangen
|
|
||||||
|
|
||||||
// Create output stream
|
|
||||||
File outputFile = new File(outputPdf);
|
|
||||||
outputFile.getParentFile().mkdirs();
|
|
||||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFile));
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.err.println("DEBUG: Creating Fop instance...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Create Fop instance
|
|
||||||
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Setting up transformer...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Setup Transformer
|
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
|
||||||
|
|
||||||
// Setup input and output
|
|
||||||
Source src = new StreamSource(new File(inputFo));
|
|
||||||
Result res = new SAXResult(fop.getDefaultHandler());
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Running FOP transformation...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Run transformation
|
|
||||||
transformer.transform(src, res);
|
|
||||||
|
|
||||||
System.err.println("DEBUG: FOP transformation completed");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transformation erfolgreich
|
|
||||||
System.out.println("OK");
|
|
||||||
System.out.flush();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("DEBUG: Job processing exception: " + e.getClass().getName());
|
|
||||||
System.err.flush();
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
|
|
||||||
String errorMsg = e.getMessage();
|
|
||||||
if (errorMsg == null || errorMsg.isEmpty()) {
|
|
||||||
errorMsg = e.getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
System.out.println("ERROR: " + errorMsg);
|
|
||||||
System.out.flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("FopWorker I/O error: " + e.getMessage());
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class FopWorkerPool(BaseWorkerPool):
|
|
||||||
"""
|
|
||||||
Pool von lang-laufenden JVM-Prozessen für Apache FOP PDF-Generierung.
|
|
||||||
|
|
||||||
Eliminiert JVM-Startup-Overhead durch Wiederverwendung von N Worker-Prozessen.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
num_workers: int,
|
|
||||||
java_vm_path: Path,
|
|
||||||
apache_fop_dir: Path,
|
|
||||||
fop_config_file: Optional[Path] = None,
|
|
||||||
log_dir: Optional[Path] = None,
|
|
||||||
):
|
|
||||||
super().__init__(num_workers, java_vm_path, log_dir)
|
|
||||||
self.apache_fop_dir = apache_fop_dir
|
|
||||||
self.fop_config_file = fop_config_file
|
|
||||||
self.fop_classpath: Optional[str] = None
|
|
||||||
|
|
||||||
self._build_fop_classpath()
|
|
||||||
self._compile_worker_class()
|
|
||||||
self._start_workers()
|
|
||||||
logger.info(f"FopWorkerPool initialisiert mit {num_workers} Workern")
|
|
||||||
|
|
||||||
def _build_fop_classpath(self):
|
|
||||||
"""Erstellt den Classpath für Apache FOP."""
|
|
||||||
all_jars = glob.glob(str(self.apache_fop_dir / "build" / "*.jar"))
|
|
||||||
lib_dir = self.apache_fop_dir / "lib"
|
|
||||||
if lib_dir.exists() and lib_dir.is_dir():
|
|
||||||
all_jars.extend(glob.glob(str(lib_dir / "*.jar")))
|
|
||||||
|
|
||||||
if not all_jars:
|
|
||||||
raise RuntimeError(f"Keine FOP JAR-Dateien gefunden in {self.apache_fop_dir}")
|
|
||||||
|
|
||||||
self.fop_classpath = _CLASSPATH_SEP.join(all_jars)
|
|
||||||
logger.debug(f"FOP Classpath: {len(all_jars)} JARs")
|
|
||||||
|
|
||||||
# --- Abstrakte Properties ---
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _pool_name(self) -> str:
|
|
||||||
return "FOP"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _java_source_code(self) -> str:
|
|
||||||
return FOP_WORKER_JAVA
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _java_class_name(self) -> str:
|
|
||||||
return "FopWorker"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _temp_dir_prefix(self) -> str:
|
|
||||||
return "fop_worker_"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _worker_init_sleep(self) -> float:
|
|
||||||
return 0.2 # FOP braucht etwas länger zum Initialisieren
|
|
||||||
|
|
||||||
# --- Abstrakte Methoden ---
|
|
||||||
|
|
||||||
def _get_classpath(self) -> str:
|
|
||||||
return self.fop_classpath
|
|
||||||
|
|
||||||
def _build_worker_cmd(self, full_classpath: str) -> list[str]:
|
|
||||||
cmd = [str(self.java_vm_path), "-cp", full_classpath, "FopWorker"]
|
|
||||||
if self.fop_config_file and self.fop_config_file.exists():
|
|
||||||
cmd.append(str(self.fop_config_file))
|
|
||||||
return cmd
|
|
||||||
|
|
||||||
def _stderr_log_name(self, i: int) -> str:
|
|
||||||
return f"fop_worker_{i}_stderr.log"
|
|
||||||
|
|
||||||
# --- FOP-spezifische Job-Methode ---
|
|
||||||
|
|
||||||
def build_pdf(self, input_fo: Path, output_pdf: Path) -> tuple[bool, str]:
|
|
||||||
"""
|
|
||||||
Generiert PDF aus FO-Datei mit einem Worker aus dem Pool.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
input_fo: Pfad zur FO-Eingabedatei
|
|
||||||
output_pdf: Pfad zur PDF-Ausgabedatei
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple[bool, str]: (Erfolg, Fehlermeldung/Info)
|
|
||||||
"""
|
|
||||||
worker_idx = self._acquire_worker()
|
|
||||||
try:
|
|
||||||
worker = self.workers[worker_idx]
|
|
||||||
|
|
||||||
if worker.poll() is not None:
|
|
||||||
stderr_content = self._read_stderr_log(worker_idx)
|
|
||||||
error_msg = f"FOP Worker {worker_idx} ist beendet (Exit: {worker.returncode})\nstderr:\n{stderr_content}"
|
|
||||||
logger.error(error_msg)
|
|
||||||
return False, error_msg
|
|
||||||
|
|
||||||
job = f"{input_fo}\t{output_pdf}\n"
|
|
||||||
logger.debug(f"Sende FOP-Job an Worker {worker_idx}: {input_fo.name} → {output_pdf.name}")
|
|
||||||
worker.stdin.write(job)
|
|
||||||
worker.stdin.flush()
|
|
||||||
|
|
||||||
response = worker.stdout.readline().strip()
|
|
||||||
logger.debug(f"FOP Worker {worker_idx} Antwort: '{response}'")
|
|
||||||
|
|
||||||
if response == "OK":
|
|
||||||
return True, "Erfolgreich"
|
|
||||||
elif response.startswith("ERROR:"):
|
|
||||||
return False, f"FOP-Fehler: {response[6:].strip()}"
|
|
||||||
elif not response:
|
|
||||||
stderr_content = self._read_stderr_log(worker_idx, tail=500)
|
|
||||||
return False, f"FOP Worker {worker_idx} crashed (keine Antwort)\nstderr:\n{stderr_content}"
|
|
||||||
else:
|
|
||||||
return False, f"Unerwartete Antwort: {response}"
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler bei FOP Worker {worker_idx}: {e}")
|
|
||||||
return False, f"Worker-Fehler: {str(e)}"
|
|
||||||
finally:
|
|
||||||
self.worker_locks[worker_idx].release()
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import logging
|
|
||||||
from PySide6.QtCore import QByteArray, QFile, Qt
|
|
||||||
from PySide6.QtGui import QIcon, QPainter, QPixmap, QPalette
|
|
||||||
from PySide6.QtSvg import QSvgRenderer
|
|
||||||
from PySide6.QtWidgets import QApplication
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
_ICON_MAP: dict[str, str] = {
|
|
||||||
"folder-plus": ":/icons/folder-plus.svg",
|
|
||||||
"log-out": ":/icons/log-out.svg",
|
|
||||||
"settings": ":/icons/settings.svg",
|
|
||||||
"folder": ":/icons/folder.svg",
|
|
||||||
"refresh-cw": ":/icons/refresh-cw.svg",
|
|
||||||
"plus-circle": ":/icons/plus-circle.svg",
|
|
||||||
"minus-circle": ":/icons/minus-circle.svg",
|
|
||||||
"play-circle": ":/icons/play-circle.svg",
|
|
||||||
"file": ":/icons/file.svg",
|
|
||||||
"check-circle": ":/icons/check-circle.svg",
|
|
||||||
"info": ":/icons/info.svg",
|
|
||||||
"git-branch": ":/icons/git-branch.svg",
|
|
||||||
"file-text": ":/icons/file-text.svg",
|
|
||||||
"code": ":/icons/code.svg",
|
|
||||||
"chevron-down": ":/icons/chevron-down.svg",
|
|
||||||
"chevron-up": ":/icons/chevron-up.svg",
|
|
||||||
"trash-2": ":/icons/trash-2.svg",
|
|
||||||
"file-plus": ":/icons/file-plus.svg",
|
|
||||||
"columns": ":/icons/columns.svg",
|
|
||||||
"sliders": ":/icons/sliders.svg",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def icon(name: str) -> QIcon:
|
|
||||||
"""
|
|
||||||
Lädt ein Icon aus dem Qt-Ressource-System und färbt es mit der aktuellen Palette-Farbe.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
name: Feather-Icon-Name (z.B. "folder-plus", "settings")
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
QIcon in der Textfarbe des aktiven Themes, oder leerer QIcon bei unbekanntem Namen
|
|
||||||
"""
|
|
||||||
path = _ICON_MAP.get(name)
|
|
||||||
if path is None:
|
|
||||||
logger.warning(f"Unbekannter Icon-Name: {name!r}")
|
|
||||||
return QIcon()
|
|
||||||
|
|
||||||
app = QApplication.instance()
|
|
||||||
if app is None:
|
|
||||||
return QIcon(path)
|
|
||||||
|
|
||||||
color = app.palette().color(QPalette.ColorRole.WindowText).name().encode()
|
|
||||||
|
|
||||||
f = QFile(path)
|
|
||||||
if not f.open(QFile.OpenModeFlag.ReadOnly):
|
|
||||||
logger.warning(f"Icon konnte nicht geöffnet werden: {path}")
|
|
||||||
return QIcon(path)
|
|
||||||
|
|
||||||
svg_data = QByteArray(bytes(f.readAll()).replace(b"currentColor", color))
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
renderer = QSvgRenderer(svg_data)
|
|
||||||
result = QIcon()
|
|
||||||
for size in (16, 24, 32):
|
|
||||||
pixmap = QPixmap(size, size)
|
|
||||||
pixmap.fill(Qt.GlobalColor.transparent)
|
|
||||||
painter = QPainter(pixmap)
|
|
||||||
renderer.render(painter)
|
|
||||||
painter.end()
|
|
||||||
result.addPixmap(pixmap)
|
|
||||||
|
|
||||||
return result
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
"""
|
|
||||||
Parser für THIRD_PARTY_LICENSES.txt.
|
|
||||||
|
|
||||||
Extrahiert strukturierte Lizenzinformationen und ergänzt sie
|
|
||||||
mit den tatsächlich installierten Paketversionen via importlib.metadata
|
|
||||||
oder (im PyInstaller-Bundle) aus der mitgebündelten versions.json.
|
|
||||||
"""
|
|
||||||
import json
|
|
||||||
import logging
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from dataclasses import dataclass, field
|
|
||||||
from importlib.metadata import PackageNotFoundError, version
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
# Pfad zur Lizenzdatei: im PyInstaller-Bundle aus sys._MEIPASS,
|
|
||||||
# im Entwicklungsmodus relativ zum Projektroot
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
|
||||||
LICENSE_FILE = Path(sys._MEIPASS) / "THIRD_PARTY_LICENSES.txt" # type: ignore[attr-defined]
|
|
||||||
else:
|
|
||||||
LICENSE_FILE = Path(__file__).parent.parent / "THIRD_PARTY_LICENSES.txt"
|
|
||||||
|
|
||||||
# Mapping von Anzeigenamen zu PyPI-Paketnamen für Sonderfälle
|
|
||||||
_PACKAGE_NAME_MAP: dict[str, str] = {
|
|
||||||
"PySide6": "PySide6",
|
|
||||||
"Pydantic": "pydantic",
|
|
||||||
"Pydantic-Settings": "pydantic-settings",
|
|
||||||
"Pydantic-YAML": "pydantic-yaml",
|
|
||||||
"Polars": "polars",
|
|
||||||
"ConnectorX (via Polars)": "connectorx",
|
|
||||||
"PyArrow (via Polars)": "pyarrow",
|
|
||||||
"psutil": "psutil",
|
|
||||||
"lxml": "lxml",
|
|
||||||
"Ruff (Development)": "ruff",
|
|
||||||
"PyInstaller (Development)": "pyinstaller",
|
|
||||||
"Pillow (Development)": "pillow",
|
|
||||||
}
|
|
||||||
|
|
||||||
# Regex für den Beginn eines nummerierten Eintrags (z.B. "1. PySide6" oder "10. PyInstaller (Development)")
|
|
||||||
_ENTRY_PATTERN = re.compile(r"^\d+\.\s+(.+)$")
|
|
||||||
|
|
||||||
# Bekannte Feldschlüssel in der Lizenzdatei
|
|
||||||
_KNOWN_KEYS = {"Version", "Lizenz", "Webseite", "GitHub", "Beschreibung", "Copyright", "Datei", "Hinweis"}
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LicenseEntry:
|
|
||||||
"""Ein einzelner Eintrag aus THIRD_PARTY_LICENSES.txt."""
|
|
||||||
|
|
||||||
name: str
|
|
||||||
license: str = ""
|
|
||||||
installed_version: str = ""
|
|
||||||
website: str = ""
|
|
||||||
description: str = ""
|
|
||||||
copyright: str = ""
|
|
||||||
category: str = ""
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ParsedLicenses:
|
|
||||||
"""Ergebnis des Parsens der Lizenzdatei."""
|
|
||||||
|
|
||||||
entries: list[LicenseEntry] = field(default_factory=list)
|
|
||||||
|
|
||||||
|
|
||||||
def _normalize_package_name(display_name: str) -> str:
|
|
||||||
"""Normalisiert einen Anzeigenamen zu einem PyPI-Paketnamen."""
|
|
||||||
if display_name in _PACKAGE_NAME_MAP:
|
|
||||||
return _PACKAGE_NAME_MAP[display_name]
|
|
||||||
# Fallback: lowercase, Leerzeichen/Klammern entfernen
|
|
||||||
return display_name.lower().split("(")[0].strip()
|
|
||||||
|
|
||||||
|
|
||||||
_bundled_versions: dict[str, str] | None = None
|
|
||||||
|
|
||||||
|
|
||||||
def _load_bundled_versions() -> dict[str, str]:
|
|
||||||
"""Lädt den Versions-Snapshot aus der mitgebündelten versions.json (nur im PyInstaller-Bundle)."""
|
|
||||||
global _bundled_versions
|
|
||||||
if _bundled_versions is None:
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
|
||||||
versions_file = Path(sys._MEIPASS) / "versions.json" # type: ignore[attr-defined]
|
|
||||||
if versions_file.exists():
|
|
||||||
_bundled_versions = json.loads(versions_file.read_text(encoding="utf-8"))
|
|
||||||
else:
|
|
||||||
_bundled_versions = {}
|
|
||||||
else:
|
|
||||||
_bundled_versions = {}
|
|
||||||
return _bundled_versions
|
|
||||||
|
|
||||||
|
|
||||||
def _get_installed_version(package_name: str) -> str:
|
|
||||||
"""Ermittelt die installierte Version eines Pakets."""
|
|
||||||
bundled = _load_bundled_versions()
|
|
||||||
if bundled:
|
|
||||||
return bundled.get(package_name.lower(), "")
|
|
||||||
try:
|
|
||||||
return version(package_name)
|
|
||||||
except PackageNotFoundError:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
def parse_license_file(license_file: Path | None = None) -> ParsedLicenses:
|
|
||||||
"""
|
|
||||||
Parst THIRD_PARTY_LICENSES.txt und gibt strukturierte Einträge zurück.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
license_file: Pfad zur Lizenzdatei. Standard: LICENSE_FILE
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
ParsedLicenses mit allen gefundenen Einträgen inkl. installierter Versionen
|
|
||||||
"""
|
|
||||||
if license_file is None:
|
|
||||||
license_file = LICENSE_FILE
|
|
||||||
|
|
||||||
if not license_file.exists():
|
|
||||||
logger.warning(f"Lizenzdatei nicht gefunden: {license_file}")
|
|
||||||
return ParsedLicenses()
|
|
||||||
|
|
||||||
text = license_file.read_text(encoding="utf-8")
|
|
||||||
lines = text.splitlines()
|
|
||||||
|
|
||||||
result = ParsedLicenses()
|
|
||||||
current_category = ""
|
|
||||||
current_entry: LicenseEntry | None = None
|
|
||||||
last_key: str | None = None # Letzter erkannter Schlüssel (für Fortsetzungszeilen)
|
|
||||||
separator_line = "=" * 20 # Mindestlänge für Sektions-Trennlinien
|
|
||||||
|
|
||||||
i = 0
|
|
||||||
while i < len(lines):
|
|
||||||
line = lines[i]
|
|
||||||
|
|
||||||
# Sektions-Trennlinie erkannt → nächste Zeile ist Sektionsname
|
|
||||||
if line.startswith(separator_line):
|
|
||||||
i += 1
|
|
||||||
if i < len(lines):
|
|
||||||
section_name = lines[i].strip()
|
|
||||||
|
|
||||||
# Bei "Lizenztexte" aufhören — ab hier kommen nur noch Volltexte
|
|
||||||
if section_name == "Lizenztexte":
|
|
||||||
# Letzten Eintrag noch sichern
|
|
||||||
if current_entry:
|
|
||||||
result.entries.append(current_entry)
|
|
||||||
break
|
|
||||||
|
|
||||||
# Neue Kategorie setzen (ignoriere den Datei-Header "THIRD PARTY LICENSES")
|
|
||||||
if section_name != "THIRD PARTY LICENSES":
|
|
||||||
current_category = section_name
|
|
||||||
|
|
||||||
# Schließende Trennlinie der Sektion überspringen
|
|
||||||
i += 1
|
|
||||||
if i < len(lines) and lines[i].startswith(separator_line):
|
|
||||||
i += 1
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Nummerierter Eintrag (z.B. "1. PySide6")
|
|
||||||
match = _ENTRY_PATTERN.match(line.strip())
|
|
||||||
if match:
|
|
||||||
# Vorherigen Eintrag speichern
|
|
||||||
if current_entry:
|
|
||||||
result.entries.append(current_entry)
|
|
||||||
|
|
||||||
entry_name = match.group(1).strip()
|
|
||||||
current_entry = LicenseEntry(name=entry_name, category=current_category)
|
|
||||||
|
|
||||||
# Installierte Version ermitteln
|
|
||||||
pypi_name = _normalize_package_name(entry_name)
|
|
||||||
current_entry.installed_version = _get_installed_version(pypi_name)
|
|
||||||
|
|
||||||
i += 1
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Schlüssel-Wert-Zeile innerhalb eines Eintrags (z.B. " Version: >=6.10.1")
|
|
||||||
stripped = line.strip()
|
|
||||||
if current_entry and ":" in stripped:
|
|
||||||
key, _, value = stripped.partition(":")
|
|
||||||
key = key.strip()
|
|
||||||
value = value.strip()
|
|
||||||
|
|
||||||
if key in _KNOWN_KEYS:
|
|
||||||
last_key = key
|
|
||||||
if key == "Lizenz":
|
|
||||||
current_entry.license = value
|
|
||||||
elif key == "Webseite":
|
|
||||||
current_entry.website = value
|
|
||||||
elif key == "GitHub" and not current_entry.website:
|
|
||||||
# GitHub nur als Fallback wenn keine Webseite vorhanden
|
|
||||||
current_entry.website = value
|
|
||||||
elif key == "Beschreibung":
|
|
||||||
current_entry.description = value
|
|
||||||
elif key == "Copyright":
|
|
||||||
current_entry.copyright = value
|
|
||||||
else:
|
|
||||||
last_key = None
|
|
||||||
elif current_entry and stripped and not stripped.startswith("="):
|
|
||||||
# Fortsetzungszeile (z.B. mehrzeiliger Copyright-Eintrag)
|
|
||||||
if last_key == "Copyright":
|
|
||||||
current_entry.copyright += "\n" + stripped
|
|
||||||
|
|
||||||
i += 1
|
|
||||||
|
|
||||||
# Letzten Eintrag sichern (falls Datei nicht mit "Lizenztexte" endet)
|
|
||||||
if current_entry and current_entry not in result.entries:
|
|
||||||
result.entries.append(current_entry)
|
|
||||||
|
|
||||||
logger.info(f"{len(result.entries)} Lizenzeinträge aus {license_file.name} geladen")
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
# Standalone-Test
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
parsed = parse_license_file()
|
|
||||||
for entry in parsed.entries:
|
|
||||||
ver = entry.installed_version or "—"
|
|
||||||
logger.debug(f"[{entry.category}] {entry.name}: {ver} ({entry.license})")
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from PySide6.QtGui import QIcon
|
|
||||||
from PySide6.QtWidgets import QApplication
|
from PySide6.QtWidgets import QApplication
|
||||||
|
|
||||||
from ui.MainWindow import MainWindow
|
from ui.MainWindow import MainWindow
|
||||||
@@ -10,39 +8,6 @@ from ui.AppSettings import AppSettingsDlg
|
|||||||
from conf import app_settings
|
from conf import app_settings
|
||||||
|
|
||||||
|
|
||||||
def cleanup_old_logs(log_dir, max_age_hours=24):
|
|
||||||
"""
|
|
||||||
Löscht Log-Dateien, die älter als die angegebene Anzahl von Stunden sind.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
log_dir: Pfad zum Log-Verzeichnis
|
|
||||||
max_age_hours: Maximales Alter der Log-Dateien in Stunden (Standard: 24)
|
|
||||||
"""
|
|
||||||
import time
|
|
||||||
|
|
||||||
if not log_dir.exists():
|
|
||||||
return
|
|
||||||
|
|
||||||
cutoff_time = time.time() - (max_age_hours * 3600)
|
|
||||||
deleted_count = 0
|
|
||||||
|
|
||||||
# Alle .log Dateien im Verzeichnis durchsuchen
|
|
||||||
for log_file in log_dir.glob("*.log"):
|
|
||||||
try:
|
|
||||||
# Änderungszeit der Datei abrufen
|
|
||||||
file_mtime = log_file.stat().st_mtime
|
|
||||||
|
|
||||||
# Wenn die Datei älter als die Grenzzeit ist, löschen
|
|
||||||
if file_mtime < cutoff_time:
|
|
||||||
log_file.unlink()
|
|
||||||
deleted_count += 1
|
|
||||||
except Exception as e:
|
|
||||||
logging.warning(f"Fehler beim Löschen von {log_file}: {e}")
|
|
||||||
|
|
||||||
if deleted_count > 0:
|
|
||||||
logging.info(f"{deleted_count} alte Log-Datei(en) gelöscht (älter als {max_age_hours} Stunden)")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Haupteinstiegspunkt der Anwendung."""
|
"""Haupteinstiegspunkt der Anwendung."""
|
||||||
# Logging konfigurieren - sowohl Datei als auch Konsole
|
# Logging konfigurieren - sowohl Datei als auch Konsole
|
||||||
@@ -52,7 +17,7 @@ def main():
|
|||||||
from conf import config_path
|
from conf import config_path
|
||||||
|
|
||||||
log_dir = config_path.parent / "logs"
|
log_dir = config_path.parent / "logs"
|
||||||
log_dir.mkdir(parents=True, exist_ok=True)
|
log_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
# Log-Dateiname mit Timestamp
|
# Log-Dateiname mit Timestamp
|
||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
@@ -79,28 +44,9 @@ def main():
|
|||||||
|
|
||||||
logging.info(f"Logging initialisiert: {log_file}")
|
logging.info(f"Logging initialisiert: {log_file}")
|
||||||
|
|
||||||
# Alte Log-Dateien aufräumen (erst nach Logger-Init)
|
|
||||||
cleanup_old_logs(log_dir, max_age_hours=24)
|
|
||||||
|
|
||||||
# Unter Windows: AppUserModelID setzen, damit die Taskleiste das richtige Symbol zeigt
|
|
||||||
if sys.platform == "win32":
|
|
||||||
import ctypes
|
|
||||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("de.vitaligraf.documentor")
|
|
||||||
|
|
||||||
# QApplication-Instanz erstellen
|
# QApplication-Instanz erstellen
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
# App-Symbol setzen (PyInstaller: sys._MEIPASS, sonst Quellpfad)
|
|
||||||
if getattr(sys, "frozen", False):
|
|
||||||
icon_path = Path(sys._MEIPASS) / "resources" / "icon.ico"
|
|
||||||
else:
|
|
||||||
icon_path = Path(__file__).parent.parent / "resources" / "icon.ico"
|
|
||||||
if icon_path.exists():
|
|
||||||
app.setWindowIcon(QIcon(str(icon_path)))
|
|
||||||
|
|
||||||
# Qt-Ressourcen registrieren (Icons)
|
|
||||||
import res.resources_rc # noqa: F401
|
|
||||||
|
|
||||||
# Hauptfenster erstellen
|
# Hauptfenster erstellen
|
||||||
window = MainWindow()
|
window = MainWindow()
|
||||||
|
|
||||||
|
|||||||
@@ -1,166 +0,0 @@
|
|||||||
"""
|
|
||||||
Obsolete-Detector — Erkennung veralteter Projekteinträge nach DB-Import.
|
|
||||||
|
|
||||||
Reine Analyselogik ohne Qt-Abhängigkeit. Findet XslFile-Einträge im Projekt,
|
|
||||||
die nicht mehr in der Datenbank vorhanden sind.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from conf import TreeNode, XslFile
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ObsoleteXslEntry:
|
|
||||||
"""Ein XslFile-Eintrag, der nicht mehr in der Datenbank vorhanden ist."""
|
|
||||||
|
|
||||||
xsl_file: XslFile
|
|
||||||
parent_node: TreeNode
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ObsoleteGroup:
|
|
||||||
"""Gruppe veralteter XslFile-Einträge unter einem gemeinsamen Eltern-Pfad."""
|
|
||||||
|
|
||||||
node_path: list[str]
|
|
||||||
parent_node: TreeNode
|
|
||||||
xsl_entries: list[ObsoleteXslEntry] = field(default_factory=list)
|
|
||||||
|
|
||||||
|
|
||||||
def extract_db_xsl_ids(new_nodes: list[TreeNode]) -> set[tuple]:
|
|
||||||
"""
|
|
||||||
Extrahiert alle XslFile-IDs aus den frisch aus der DB geladenen Nodes.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
new_nodes: Nodes aus _process_sql_data()
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Set aller XslFile-IDs (Tupel)
|
|
||||||
"""
|
|
||||||
ids: set[tuple] = set()
|
|
||||||
_collect_ids_recursive(new_nodes, ids)
|
|
||||||
return ids
|
|
||||||
|
|
||||||
|
|
||||||
def _collect_ids_recursive(nodes: list, ids: set[tuple]) -> None:
|
|
||||||
for node in nodes:
|
|
||||||
if isinstance(node, XslFile):
|
|
||||||
ids.add(node.id)
|
|
||||||
elif isinstance(node, TreeNode) and node.children:
|
|
||||||
_collect_ids_recursive(node.children, ids)
|
|
||||||
|
|
||||||
|
|
||||||
def find_obsolete_xsl_entries(
|
|
||||||
project_nodes: list[TreeNode],
|
|
||||||
db_xsl_ids: set[tuple],
|
|
||||||
) -> list[ObsoleteGroup]:
|
|
||||||
"""
|
|
||||||
Findet alle XslFile-Einträge im Projekt, die nicht mehr in der DB vorhanden sind.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
project_nodes: Aktuelle Nodes aus pdf_project.nodes
|
|
||||||
db_xsl_ids: Set aller XslFile-IDs aus der DB (von extract_db_xsl_ids)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Liste von ObsoleteGroup, sortiert nach Hierarchiepfad
|
|
||||||
"""
|
|
||||||
groups: dict[int, ObsoleteGroup] = {}
|
|
||||||
|
|
||||||
_find_obsolete_recursive(project_nodes, db_xsl_ids, path=[], groups=groups)
|
|
||||||
|
|
||||||
# Sortieren nach Pfad für stabile Darstellung
|
|
||||||
return sorted(groups.values(), key=lambda g: g.node_path)
|
|
||||||
|
|
||||||
|
|
||||||
def _find_obsolete_recursive(
|
|
||||||
nodes: list,
|
|
||||||
db_xsl_ids: set[tuple],
|
|
||||||
path: list[str],
|
|
||||||
groups: dict[int, ObsoleteGroup],
|
|
||||||
) -> None:
|
|
||||||
for node in nodes:
|
|
||||||
if isinstance(node, TreeNode):
|
|
||||||
_find_obsolete_in_tree_node(node, db_xsl_ids, path, groups)
|
|
||||||
|
|
||||||
|
|
||||||
def _find_obsolete_in_tree_node(
|
|
||||||
node: TreeNode,
|
|
||||||
db_xsl_ids: set[tuple],
|
|
||||||
parent_path: list[str],
|
|
||||||
groups: dict[int, ObsoleteGroup],
|
|
||||||
) -> None:
|
|
||||||
current_path = parent_path + [node.bez]
|
|
||||||
|
|
||||||
for child in node.children:
|
|
||||||
if isinstance(child, XslFile):
|
|
||||||
if child.id not in db_xsl_ids:
|
|
||||||
node_id = id(node)
|
|
||||||
if node_id not in groups:
|
|
||||||
groups[node_id] = ObsoleteGroup(
|
|
||||||
node_path=current_path,
|
|
||||||
parent_node=node,
|
|
||||||
)
|
|
||||||
groups[node_id].xsl_entries.append(ObsoleteXslEntry(xsl_file=child, parent_node=node))
|
|
||||||
elif isinstance(child, TreeNode):
|
|
||||||
_find_obsolete_in_tree_node(child, db_xsl_ids, current_path, groups)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_empty_tree_nodes(nodes: list) -> list:
|
|
||||||
"""
|
|
||||||
Entfernt rekursiv alle TreeNodes, deren children-Liste nach der Bereinigung leer ist.
|
|
||||||
XslFile-Einträge werden immer behalten (sie wurden bereits entfernt oder sind noch gültig).
|
|
||||||
|
|
||||||
Args:
|
|
||||||
nodes: Liste von TreeNode|XslFile
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Bereinigte Liste ohne leere TreeNodes
|
|
||||||
"""
|
|
||||||
result = []
|
|
||||||
for node in nodes:
|
|
||||||
if isinstance(node, TreeNode):
|
|
||||||
node.children = remove_empty_tree_nodes(node.children)
|
|
||||||
if node.children:
|
|
||||||
result.append(node)
|
|
||||||
# leere TreeNodes stillschweigend verwerfen
|
|
||||||
else:
|
|
||||||
result.append(node)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def collect_unused_xml_files(
|
|
||||||
obsolete_groups: list[ObsoleteGroup],
|
|
||||||
project_dir: Path,
|
|
||||||
is_xml_used_elsewhere_fn,
|
|
||||||
) -> list[tuple[Path, Path]]:
|
|
||||||
"""
|
|
||||||
Sammelt XML-Dateien der veralteten XslFiles, die nirgends anders mehr verwendet werden.
|
|
||||||
|
|
||||||
WICHTIG: Muss nach dem Entfernen der XslFiles aus dem Modell aufgerufen werden,
|
|
||||||
damit is_xml_used_elsewhere_fn korrekte Ergebnisse liefert.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
obsolete_groups: Die veralteten Gruppen
|
|
||||||
project_dir: Absoluter Pfad zum Projektverzeichnis
|
|
||||||
is_xml_used_elsewhere_fn: Callable(xml_path, exclude_xsl_file) -> bool
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Liste von (xml_path_relativ, xml_path_absolut) für nicht mehr verwendete XML-Dateien
|
|
||||||
"""
|
|
||||||
unused: list[tuple[Path, Path]] = []
|
|
||||||
seen: set[str] = set()
|
|
||||||
|
|
||||||
for group in obsolete_groups:
|
|
||||||
for entry in group.xsl_entries:
|
|
||||||
for xml_file_obj in entry.xsl_file.xmls:
|
|
||||||
xml_path_str = str(xml_file_obj.xml)
|
|
||||||
if xml_path_str in seen:
|
|
||||||
continue
|
|
||||||
seen.add(xml_path_str)
|
|
||||||
xml_abs = project_dir / xml_file_obj.xml
|
|
||||||
if xml_abs.exists():
|
|
||||||
if not is_xml_used_elsewhere_fn(xml_file_obj.xml, entry.xsl_file):
|
|
||||||
unused.append((xml_file_obj.xml, xml_abs))
|
|
||||||
|
|
||||||
return unused
|
|
||||||
@@ -8,4 +8,4 @@ select
|
|||||||
r3.xsl_datei
|
r3.xsl_datei
|
||||||
from reporttyp r
|
from reporttyp r
|
||||||
inner join report r2 on r.reporttyp = r2.reporttyp and r2.aktiv = 1
|
inner join report r2 on r.reporttyp = r2.reporttyp and r2.aktiv = 1
|
||||||
inner join repfile r3 on r2.reporttyp = r3.reporttyp and r2.report = r3.report and r3.xsl_datei is not null and r3.aktiv = 1 and r3.export = 0
|
inner join repfile r3 on r2.reporttyp = r3.reporttyp and r2.report = r3.report and r3.xsl_datei is not null and r3.aktiv = 1
|
||||||
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 275 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 222 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 223 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 258 B |
@@ -1 +0,0 @@
|
|||||||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7m0-18H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7m0-18v18"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 288 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="12" y1="18" x2="12" y2="12"/><line x1="9" y1="15" x2="15" y2="15"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 369 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 401 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><polyline points="13 2 13 9 20 9"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 292 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/><line x1="12" y1="11" x2="12" y2="17"/><line x1="9" y1="14" x2="15" y2="14"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 351 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 274 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 314 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 298 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 313 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="8" y1="12" x2="16" y2="12"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 257 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polygon points="10 8 16 12 10 16 10 8"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 260 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 295 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 339 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 964 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 525 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 388 B |
@@ -1,25 +0,0 @@
|
|||||||
<!DOCTYPE RCC>
|
|
||||||
<RCC version="1.0">
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>icons/folder-plus.svg</file>
|
|
||||||
<file>icons/log-out.svg</file>
|
|
||||||
<file>icons/settings.svg</file>
|
|
||||||
<file>icons/folder.svg</file>
|
|
||||||
<file>icons/refresh-cw.svg</file>
|
|
||||||
<file>icons/plus-circle.svg</file>
|
|
||||||
<file>icons/minus-circle.svg</file>
|
|
||||||
<file>icons/play-circle.svg</file>
|
|
||||||
<file>icons/file.svg</file>
|
|
||||||
<file>icons/check-circle.svg</file>
|
|
||||||
<file>icons/info.svg</file>
|
|
||||||
<file>icons/git-branch.svg</file>
|
|
||||||
<file>icons/file-text.svg</file>
|
|
||||||
<file>icons/code.svg</file>
|
|
||||||
<file>icons/chevron-down.svg</file>
|
|
||||||
<file>icons/chevron-up.svg</file>
|
|
||||||
<file>icons/trash-2.svg</file>
|
|
||||||
<file>icons/file-plus.svg</file>
|
|
||||||
<file>icons/columns.svg</file>
|
|
||||||
<file>icons/sliders.svg</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
@@ -1,634 +0,0 @@
|
|||||||
# Resource object code (Python 3)
|
|
||||||
# Created by: object code
|
|
||||||
# Created by: The Resource Compiler for Qt version 6.11.1
|
|
||||||
# WARNING! All changes made in this file will be lost!
|
|
||||||
|
|
||||||
from PySide6 import QtCore
|
|
||||||
|
|
||||||
qt_resource_data = b"\
|
|
||||||
\x00\x00\x01\x01\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><circle cx=\x22\
|
|
||||||
12\x22 cy=\x2212\x22 r=\x221\
|
|
||||||
0\x22/><line x1=\x228\x22\
|
|
||||||
y1=\x2212\x22 x2=\x2216\x22\
|
|
||||||
y2=\x2212\x22/></svg>\
|
|
||||||
\
|
|
||||||
\x00\x00\x02\x0d\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><line x1=\x224\x22\
|
|
||||||
y1=\x2221\x22 x2=\x224\x22 \
|
|
||||||
y2=\x2214\x22/><line x\
|
|
||||||
1=\x224\x22 y1=\x2210\x22 x2\
|
|
||||||
=\x224\x22 y2=\x223\x22/><li\
|
|
||||||
ne x1=\x2212\x22 y1=\x222\
|
|
||||||
1\x22 x2=\x2212\x22 y2=\x221\
|
|
||||||
2\x22/><line x1=\x2212\
|
|
||||||
\x22 y1=\x228\x22 x2=\x2212\x22\
|
|
||||||
y2=\x223\x22/><line x\
|
|
||||||
1=\x2220\x22 y1=\x2221\x22 x\
|
|
||||||
2=\x2220\x22 y2=\x2216\x22/>\
|
|
||||||
<line x1=\x2220\x22 y1\
|
|
||||||
=\x2212\x22 x2=\x2220\x22 y2\
|
|
||||||
=\x223\x22/><line x1=\x22\
|
|
||||||
1\x22 y1=\x2214\x22 x2=\x227\
|
|
||||||
\x22 y2=\x2214\x22/><line\
|
|
||||||
x1=\x229\x22 y1=\x228\x22 x\
|
|
||||||
2=\x2215\x22 y2=\x228\x22/><\
|
|
||||||
line x1=\x2217\x22 y1=\
|
|
||||||
\x2216\x22 x2=\x2223\x22 y2=\
|
|
||||||
\x2216\x22/></svg>\
|
|
||||||
\x00\x00\x01\x04\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><circle cx=\x22\
|
|
||||||
12\x22 cy=\x2212\x22 r=\x221\
|
|
||||||
0\x22/><polygon poi\
|
|
||||||
nts=\x2210 8 16 12 \
|
|
||||||
10 16 10 8\x22/></s\
|
|
||||||
vg>\
|
|
||||||
\x00\x00\x01 \
|
|
||||||
<\
|
|
||||||
svg width=\x2224\x22 h\
|
|
||||||
eight=\x2224\x22 viewB\
|
|
||||||
ox=\x220 0 24 24\x22 x\
|
|
||||||
mlns=\x22http://www\
|
|
||||||
.w3.org/2000/svg\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M12\
|
|
||||||
3h7a2 2 0 0 1 2\
|
|
||||||
2v14a2 2 0 0 1-\
|
|
||||||
2 2h-7m0-18H5a2 \
|
|
||||||
2 0 0 0-2 2v14a2\
|
|
||||||
2 0 0 0 2 2h7m0\
|
|
||||||
-18v18\x22/></svg>\
|
|
||||||
\x00\x00\x01_\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M22\
|
|
||||||
19a2 2 0 0 1-2 \
|
|
||||||
2H4a2 2 0 0 1-2-\
|
|
||||||
2V5a2 2 0 0 1 2-\
|
|
||||||
2h5l2 3h9a2 2 0 \
|
|
||||||
0 1 2 2z\x22/><line\
|
|
||||||
x1=\x2212\x22 y1=\x2211\x22\
|
|
||||||
x2=\x2212\x22 y2=\x2217\x22\
|
|
||||||
/><line x1=\x229\x22 y\
|
|
||||||
1=\x2214\x22 x2=\x2215\x22 y\
|
|
||||||
2=\x2214\x22/></svg>\
|
|
||||||
\x00\x00\x01$\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M13\
|
|
||||||
2H6a2 2 0 0 0-2\
|
|
||||||
2v16a2 2 0 0 0 \
|
|
||||||
2 2h12a2 2 0 0 0\
|
|
||||||
2-2V9z\x22/><polyl\
|
|
||||||
ine points=\x2213 2\
|
|
||||||
13 9 20 9\x22/></s\
|
|
||||||
vg>\
|
|
||||||
\x00\x00\x01S\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><polyline po\
|
|
||||||
ints=\x2223 4 23 10\
|
|
||||||
17 10\x22/><polyli\
|
|
||||||
ne points=\x221 20 \
|
|
||||||
1 14 7 14\x22/><pat\
|
|
||||||
h d=\x22M3.51 9a9 9\
|
|
||||||
0 0 1 14.85-3.3\
|
|
||||||
6L23 10M1 14l4.6\
|
|
||||||
4 4.36A9 9 0 0 0\
|
|
||||||
20.49 15\x22/></sv\
|
|
||||||
g>\
|
|
||||||
\x00\x00\x01\x12\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M22\
|
|
||||||
19a2 2 0 0 1-2 \
|
|
||||||
2H4a2 2 0 0 1-2-\
|
|
||||||
2V5a2 2 0 0 1 2-\
|
|
||||||
2h5l2 3h9a2 2 0 \
|
|
||||||
0 1 2 2z\x22/></svg\
|
|
||||||
>\
|
|
||||||
\x00\x00\x00\xde\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><polyline po\
|
|
||||||
ints=\x226 9 12 15 \
|
|
||||||
18 9\x22/></svg>\
|
|
||||||
\x00\x00\x03\xc4\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><circle cx=\x22\
|
|
||||||
12\x22 cy=\x2212\x22 r=\x223\
|
|
||||||
\x22/><path d=\x22M19.\
|
|
||||||
4 15a1.65 1.65 0\
|
|
||||||
0 0 .33 1.82l.0\
|
|
||||||
6.06a2 2 0 0 1 0\
|
|
||||||
2.83 2 2 0 0 1-\
|
|
||||||
2.83 0l-.06-.06a\
|
|
||||||
1.65 1.65 0 0 0-\
|
|
||||||
1.82-.33 1.65 1.\
|
|
||||||
65 0 0 0-1 1.51V\
|
|
||||||
21a2 2 0 0 1-2 2\
|
|
||||||
2 2 0 0 1-2-2v-\
|
|
||||||
.09A1.65 1.65 0 \
|
|
||||||
0 0 9 19.4a1.65 \
|
|
||||||
1.65 0 0 0-1.82.\
|
|
||||||
33l-.06.06a2 2 0\
|
|
||||||
0 1-2.83 0 2 2 \
|
|
||||||
0 0 1 0-2.83l.06\
|
|
||||||
-.06a1.65 1.65 0\
|
|
||||||
0 0 .33-1.82 1.\
|
|
||||||
65 1.65 0 0 0-1.\
|
|
||||||
51-1H3a2 2 0 0 1\
|
|
||||||
-2-2 2 2 0 0 1 2\
|
|
||||||
-2h.09A1.65 1.65\
|
|
||||||
0 0 0 4.6 9a1.6\
|
|
||||||
5 1.65 0 0 0-.33\
|
|
||||||
-1.82l-.06-.06a2\
|
|
||||||
2 0 0 1 0-2.83 \
|
|
||||||
2 2 0 0 1 2.83 0\
|
|
||||||
l.06.06a1.65 1.6\
|
|
||||||
5 0 0 0 1.82.33H\
|
|
||||||
9a1.65 1.65 0 0 \
|
|
||||||
0 1-1.51V3a2 2 0\
|
|
||||||
0 1 2-2 2 2 0 0\
|
|
||||||
1 2 2v.09a1.65 \
|
|
||||||
1.65 0 0 0 1 1.5\
|
|
||||||
1 1.65 1.65 0 0 \
|
|
||||||
0 1.82-.33l.06-.\
|
|
||||||
06a2 2 0 0 1 2.8\
|
|
||||||
3 0 2 2 0 0 1 0 \
|
|
||||||
2.83l-.06.06a1.6\
|
|
||||||
5 1.65 0 0 0-.33\
|
|
||||||
1.82V9a1.65 1.6\
|
|
||||||
5 0 0 0 1.51 1H2\
|
|
||||||
1a2 2 0 0 1 2 2 \
|
|
||||||
2 2 0 0 1-2 2h-.\
|
|
||||||
09a1.65 1.65 0 0\
|
|
||||||
0-1.51 1z\x22/></s\
|
|
||||||
vg>\
|
|
||||||
\x00\x00\x01'\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><circle cx=\x22\
|
|
||||||
12\x22 cy=\x2212\x22 r=\x221\
|
|
||||||
0\x22/><line x1=\x2212\
|
|
||||||
\x22 y1=\x228\x22 x2=\x2212\x22\
|
|
||||||
y2=\x2216\x22/><line \
|
|
||||||
x1=\x228\x22 y1=\x2212\x22 x\
|
|
||||||
2=\x2216\x22 y2=\x2212\x22/>\
|
|
||||||
</svg>\
|
|
||||||
\x00\x00\x019\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M9 \
|
|
||||||
21H5a2 2 0 0 1-2\
|
|
||||||
-2V5a2 2 0 0 1 2\
|
|
||||||
-2h4\x22/><polyline\
|
|
||||||
points=\x2216 17 2\
|
|
||||||
1 12 16 7\x22/><lin\
|
|
||||||
e x1=\x2221\x22 y1=\x2212\
|
|
||||||
\x22 x2=\x229\x22 y2=\x2212\x22\
|
|
||||||
/></svg>\
|
|
||||||
\x00\x00\x01\x13\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M22\
|
|
||||||
11.08V12a10 10 \
|
|
||||||
0 1 1-5.93-9.14\x22\
|
|
||||||
/><polyline poin\
|
|
||||||
ts=\x2222 4 12 14.0\
|
|
||||||
1 9 11.01\x22/></sv\
|
|
||||||
g>\
|
|
||||||
\x00\x00\x01*\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><circle cx=\x22\
|
|
||||||
12\x22 cy=\x2212\x22 r=\x221\
|
|
||||||
0\x22/><line x1=\x2212\
|
|
||||||
\x22 y1=\x2216\x22 x2=\x2212\
|
|
||||||
\x22 y2=\x2212\x22/><line\
|
|
||||||
x1=\x2212\x22 y1=\x228\x22 \
|
|
||||||
x2=\x2212.01\x22 y2=\x228\
|
|
||||||
\x22/></svg>\
|
|
||||||
\x00\x00\x00\xdf\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><polyline po\
|
|
||||||
ints=\x2218 15 12 9\
|
|
||||||
6 15\x22/></svg>\
|
|
||||||
\x00\x00\x01\x91\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M14\
|
|
||||||
2H6a2 2 0 0 0-2\
|
|
||||||
2v16a2 2 0 0 0 \
|
|
||||||
2 2h12a2 2 0 0 0\
|
|
||||||
2-2V8z\x22/><polyl\
|
|
||||||
ine points=\x2214 2\
|
|
||||||
14 8 20 8\x22/><li\
|
|
||||||
ne x1=\x2216\x22 y1=\x221\
|
|
||||||
3\x22 x2=\x228\x22 y2=\x2213\
|
|
||||||
\x22/><line x1=\x2216\x22\
|
|
||||||
y1=\x2217\x22 x2=\x228\x22 \
|
|
||||||
y2=\x2217\x22/><polyli\
|
|
||||||
ne points=\x2210 9 \
|
|
||||||
9 9 8 9\x22/></svg>\
|
|
||||||
\
|
|
||||||
\x00\x00\x01q\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><path d=\x22M14\
|
|
||||||
2H6a2 2 0 0 0-2\
|
|
||||||
2v16a2 2 0 0 0 \
|
|
||||||
2 2h12a2 2 0 0 0\
|
|
||||||
2-2V8z\x22/><polyl\
|
|
||||||
ine points=\x2214 2\
|
|
||||||
14 8 20 8\x22/><li\
|
|
||||||
ne x1=\x2212\x22 y1=\x221\
|
|
||||||
8\x22 x2=\x2212\x22 y2=\x221\
|
|
||||||
2\x22/><line x1=\x229\x22\
|
|
||||||
y1=\x2215\x22 x2=\x2215\x22\
|
|
||||||
y2=\x2215\x22/></svg>\
|
|
||||||
\
|
|
||||||
\x00\x00\x01\x02\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><polyline po\
|
|
||||||
ints=\x2216 18 22 1\
|
|
||||||
2 16 6\x22/><polyli\
|
|
||||||
ne points=\x228 6 2\
|
|
||||||
12 8 18\x22/></svg\
|
|
||||||
>\
|
|
||||||
\x00\x00\x01\x84\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><polyline po\
|
|
||||||
ints=\x223 6 5 6 21\
|
|
||||||
6\x22/><path d=\x22M1\
|
|
||||||
9 6v14a2 2 0 0 1\
|
|
||||||
-2 2H7a2 2 0 0 1\
|
|
||||||
-2-2V6m3 0V4a2 2\
|
|
||||||
0 0 1 2-2h4a2 2\
|
|
||||||
0 0 1 2 2v2\x22/><\
|
|
||||||
line x1=\x2210\x22 y1=\
|
|
||||||
\x2211\x22 x2=\x2210\x22 y2=\
|
|
||||||
\x2217\x22/><line x1=\x22\
|
|
||||||
14\x22 y1=\x2211\x22 x2=\x22\
|
|
||||||
14\x22 y2=\x2217\x22/></s\
|
|
||||||
vg>\
|
|
||||||
\x00\x00\x01:\
|
|
||||||
<\
|
|
||||||
svg xmlns=\x22http:\
|
|
||||||
//www.w3.org/200\
|
|
||||||
0/svg\x22 width=\x2224\
|
|
||||||
\x22 height=\x2224\x22 vi\
|
|
||||||
ewBox=\x220 0 24 24\
|
|
||||||
\x22 fill=\x22none\x22 st\
|
|
||||||
roke=\x22currentCol\
|
|
||||||
or\x22 stroke-width\
|
|
||||||
=\x222\x22 stroke-line\
|
|
||||||
cap=\x22round\x22 stro\
|
|
||||||
ke-linejoin=\x22rou\
|
|
||||||
nd\x22><line x1=\x226\x22\
|
|
||||||
y1=\x223\x22 x2=\x226\x22 y\
|
|
||||||
2=\x2215\x22/><circle \
|
|
||||||
cx=\x2218\x22 cy=\x226\x22 r\
|
|
||||||
=\x223\x22/><circle cx\
|
|
||||||
=\x226\x22 cy=\x2218\x22 r=\x22\
|
|
||||||
3\x22/><path d=\x22M18\
|
|
||||||
9a9 9 0 0 1-9 9\
|
|
||||||
\x22/></svg>\
|
|
||||||
"
|
|
||||||
|
|
||||||
qt_resource_name = b"\
|
|
||||||
\x00\x05\
|
|
||||||
\x00o\xa6S\
|
|
||||||
\x00i\
|
|
||||||
\x00c\x00o\x00n\x00s\
|
|
||||||
\x00\x10\
|
|
||||||
\x02\xfe\x1a\xa7\
|
|
||||||
\x00m\
|
|
||||||
\x00i\x00n\x00u\x00s\x00-\x00c\x00i\x00r\x00c\x00l\x00e\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0b\
|
|
||||||
\x0cb\x05\x87\
|
|
||||||
\x00s\
|
|
||||||
\x00l\x00i\x00d\x00e\x00r\x00s\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0f\
|
|
||||||
\x0b\xa3Gg\
|
|
||||||
\x00p\
|
|
||||||
\x00l\x00a\x00y\x00-\x00c\x00i\x00r\x00c\x00l\x00e\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0b\
|
|
||||||
\x04\x82\x9dG\
|
|
||||||
\x00c\
|
|
||||||
\x00o\x00l\x00u\x00m\x00n\x00s\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0f\
|
|
||||||
\x06\x9fG\xa7\
|
|
||||||
\x00f\
|
|
||||||
\x00o\x00l\x00d\x00e\x00r\x00-\x00p\x00l\x00u\x00s\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x08\
|
|
||||||
\x00(Wg\
|
|
||||||
\x00f\
|
|
||||||
\x00i\x00l\x00e\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0e\
|
|
||||||
\x04\x1b\xd7\x87\
|
|
||||||
\x00r\
|
|
||||||
\x00e\x00f\x00r\x00e\x00s\x00h\x00-\x00c\x00w\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0a\
|
|
||||||
\x0a\xc8\xf6\x87\
|
|
||||||
\x00f\
|
|
||||||
\x00o\x00l\x00d\x00e\x00r\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x10\
|
|
||||||
\x0e\x17\x06\x87\
|
|
||||||
\x00c\
|
|
||||||
\x00h\x00e\x00v\x00r\x00o\x00n\x00-\x00d\x00o\x00w\x00n\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0c\
|
|
||||||
\x0b\xdf,\xc7\
|
|
||||||
\x00s\
|
|
||||||
\x00e\x00t\x00t\x00i\x00n\x00g\x00s\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0f\
|
|
||||||
\x02\xe3G'\
|
|
||||||
\x00p\
|
|
||||||
\x00l\x00u\x00s\x00-\x00c\x00i\x00r\x00c\x00l\x00e\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0b\
|
|
||||||
\x06!\xeeG\
|
|
||||||
\x00l\
|
|
||||||
\x00o\x00g\x00-\x00o\x00u\x00t\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x10\
|
|
||||||
\x0d\xfd\xe1'\
|
|
||||||
\x00c\
|
|
||||||
\x00h\x00e\x00c\x00k\x00-\x00c\x00i\x00r\x00c\x00l\x00e\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x08\
|
|
||||||
\x04\xd2T\xc7\
|
|
||||||
\x00i\
|
|
||||||
\x00n\x00f\x00o\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0e\
|
|
||||||
\x09Xl\x87\
|
|
||||||
\x00c\
|
|
||||||
\x00h\x00e\x00v\x00r\x00o\x00n\x00-\x00u\x00p\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0d\
|
|
||||||
\x06\xf2R'\
|
|
||||||
\x00f\
|
|
||||||
\x00i\x00l\x00e\x00-\x00t\x00e\x00x\x00t\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0d\
|
|
||||||
\x09\xc3S\x87\
|
|
||||||
\x00f\
|
|
||||||
\x00i\x00l\x00e\x00-\x00p\x00l\x00u\x00s\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x08\
|
|
||||||
\x05\xa8W\x87\
|
|
||||||
\x00c\
|
|
||||||
\x00o\x00d\x00e\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0b\
|
|
||||||
\x0b\xf2K\xe7\
|
|
||||||
\x00t\
|
|
||||||
\x00r\x00a\x00s\x00h\x00-\x002\x00.\x00s\x00v\x00g\
|
|
||||||
\x00\x0e\
|
|
||||||
\x04|qG\
|
|
||||||
\x00g\
|
|
||||||
\x00i\x00t\x00-\x00b\x00r\x00a\x00n\x00c\x00h\x00.\x00s\x00v\x00g\
|
|
||||||
"
|
|
||||||
|
|
||||||
qt_resource_struct = b"\
|
|
||||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
|
||||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
||||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x14\x00\x00\x00\x02\
|
|
||||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
||||||
\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x01\x00\x00\x06\xa5\
|
|
||||||
\x00\x00\x01\x9ey\x0c6\xfa\
|
|
||||||
\x00\x00\x01L\x00\x00\x00\x00\x00\x01\x00\x00\x0e\xe4\
|
|
||||||
\x00\x00\x01\x9ey\x0c3\x89\
|
|
||||||
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
|
||||||
\x00\x00\x01\x9ey\x0c4\x94\
|
|
||||||
\x00\x00\x00\xcc\x00\x00\x00\x00\x00\x01\x00\x00\x07\xcd\
|
|
||||||
\x00\x00\x01\x9ey\x0c2\xb4\
|
|
||||||
\x00\x00\x02\x5c\x00\x00\x00\x00\x00\x01\x00\x00\x1a\x0c\
|
|
||||||
\x00\x00\x01\x9ey\x0c:\x95\
|
|
||||||
\x00\x00\x00v\x00\x00\x00\x00\x00\x01\x00\x00\x04\x1e\
|
|
||||||
\x00\x00\x01\x9ey\x0cB\x90\
|
|
||||||
\x00\x00\x01\xb2\x00\x00\x00\x00\x00\x01\x00\x00\x12c\
|
|
||||||
\x00\x00\x01\x9ey\x0c9c\
|
|
||||||
\x00\x00\x02*\x00\x00\x00\x00\x00\x01\x00\x00\x17~\
|
|
||||||
\x00\x00\x01\x9ey\x0c<\x93\
|
|
||||||
\x00\x00\x01p\x00\x00\x00\x00\x00\x01\x00\x00\x10\x0f\
|
|
||||||
\x00\x00\x01\x9ey\x0c.\xf3\
|
|
||||||
\x00\x00\x00\x92\x00\x00\x00\x00\x00\x01\x00\x00\x05B\
|
|
||||||
\x00\x00\x01\x9ey\x0c-\x81\
|
|
||||||
\x00\x00\x01\xea\x00\x00\x00\x00\x00\x01\x00\x00\x14t\
|
|
||||||
\x00\x00\x01\x9ey\x0c;i\
|
|
||||||
\x00\x00\x01\xc8\x00\x00\x00\x00\x00\x01\x00\x00\x13\x91\
|
|
||||||
\x00\x00\x01\x9ey\x0c>\xf8\
|
|
||||||
\x00\x00\x02\x0a\x00\x00\x00\x00\x00\x01\x00\x00\x16\x09\
|
|
||||||
\x00\x00\x01\x9ey\x0cA`\
|
|
||||||
\x00\x00\x00\xee\x00\x00\x00\x00\x00\x01\x00\x00\x09$\
|
|
||||||
\x00\x00\x01\x9ey\x0c1c\
|
|
||||||
\x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00\x03\x16\
|
|
||||||
\x00\x00\x01\x9ey\x0c5\xc9\
|
|
||||||
\x00\x00\x01.\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x1c\
|
|
||||||
\x00\x00\x01\x9ey\x0c00\
|
|
||||||
\x00\x00\x02@\x00\x00\x00\x00\x00\x01\x00\x00\x18\x84\
|
|
||||||
\x00\x00\x01\x9ey\x0c?\xdf\
|
|
||||||
\x00\x00\x006\x00\x00\x00\x00\x00\x01\x00\x00\x01\x05\
|
|
||||||
\x00\x00\x01\x9ey\x0cC\xc7\
|
|
||||||
\x00\x00\x01\x8c\x00\x00\x00\x00\x00\x01\x00\x00\x11L\
|
|
||||||
\x00\x00\x01\x9ey\x0c8.\
|
|
||||||
\x00\x00\x01\x08\x00\x00\x00\x00\x00\x01\x00\x00\x0a:\
|
|
||||||
\x00\x00\x01\x9ey\x0c=\xc8\
|
|
||||||
"
|
|
||||||
|
|
||||||
def qInitResources():
|
|
||||||
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
|
||||||
|
|
||||||
def qCleanupResources():
|
|
||||||
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
|
||||||
|
|
||||||
qInitResources()
|
|
||||||
@@ -6,10 +6,12 @@ Jeder Worker läuft als Daemon und verarbeitet mehrere Transformationen nacheina
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import subprocess
|
||||||
|
import threading
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from queue import Queue
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import tempfile
|
||||||
from worker_pool_base import BaseWorkerPool, build_jar_classpath
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -28,10 +30,7 @@ public class SaxonWorker {
|
|||||||
// Create TransformerFactory once and reuse
|
// Create TransformerFactory once and reuse
|
||||||
TransformerFactory factory = TransformerFactory.newInstance();
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
|
|
||||||
// Cache für kompilierte Stylesheets (Performance-Optimierung)
|
System.err.println("SaxonWorker started and ready (using JAXP Transformer API)");
|
||||||
Map<String, Templates> templatesCache = new HashMap<>();
|
|
||||||
|
|
||||||
System.err.println("SaxonWorker started and ready (using JAXP Transformer API with stylesheet caching)");
|
|
||||||
System.err.flush();
|
System.err.flush();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -63,33 +62,19 @@ public class SaxonWorker {
|
|||||||
String xslStylesheet = parts[1];
|
String xslStylesheet = parts[1];
|
||||||
String outputFo = parts[2];
|
String outputFo = parts[2];
|
||||||
|
|
||||||
// Prüfe ob Stylesheet bereits im Cache ist
|
System.err.println("DEBUG: Creating transformer from stylesheet...");
|
||||||
Templates templates;
|
|
||||||
if (templatesCache.containsKey(xslStylesheet)) {
|
|
||||||
templates = templatesCache.get(xslStylesheet);
|
|
||||||
System.err.println("DEBUG: Using cached stylesheet: " + xslStylesheet);
|
|
||||||
System.err.flush();
|
|
||||||
} else {
|
|
||||||
System.err.println("DEBUG: Compiling and caching stylesheet: " + xslStylesheet);
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
StreamSource xslSource = new StreamSource(new File(xslStylesheet));
|
|
||||||
templates = factory.newTemplates(xslSource);
|
|
||||||
templatesCache.put(xslStylesheet, templates);
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Stylesheet compiled and cached (cache size: " + templatesCache.size() + ")");
|
|
||||||
System.err.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Creating transformer from cached template...");
|
|
||||||
System.err.flush();
|
System.err.flush();
|
||||||
|
|
||||||
// Create Source and Result objects
|
// Create Source and Result objects
|
||||||
|
StreamSource xslSource = new StreamSource(new File(xslStylesheet));
|
||||||
StreamSource xmlSource = new StreamSource(new File(sourceXml));
|
StreamSource xmlSource = new StreamSource(new File(sourceXml));
|
||||||
StreamResult result = new StreamResult(new File(outputFo));
|
StreamResult result = new StreamResult(new File(outputFo));
|
||||||
|
|
||||||
// Create transformer from templates
|
System.err.println("DEBUG: Compiling stylesheet...");
|
||||||
Transformer transformer = templates.newTransformer();
|
System.err.flush();
|
||||||
|
|
||||||
|
// Create transformer from stylesheet
|
||||||
|
Transformer transformer = factory.newTransformer(xslSource);
|
||||||
|
|
||||||
// Set parameters if present
|
// Set parameters if present
|
||||||
if (parts.length > 3 && !parts[3].isEmpty()) {
|
if (parts.length > 3 && !parts[3].isEmpty()) {
|
||||||
@@ -170,9 +155,9 @@ public class SaxonWorker {
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class SaxonWorkerPool(BaseWorkerPool):
|
class SaxonWorkerPool:
|
||||||
"""
|
"""
|
||||||
Pool von lang-laufenden JVM-Prozessen für Saxon-Transformationen (JAXP/XSLT 1.0).
|
Pool von lang-laufenden JVM-Prozessen für Saxon-Transformationen.
|
||||||
|
|
||||||
Eliminiert JVM-Startup-Overhead durch Wiederverwendung von N Worker-Prozessen.
|
Eliminiert JVM-Startup-Overhead durch Wiederverwendung von N Worker-Prozessen.
|
||||||
"""
|
"""
|
||||||
@@ -185,51 +170,144 @@ class SaxonWorkerPool(BaseWorkerPool):
|
|||||||
classpath_cache: dict[Path, str],
|
classpath_cache: dict[Path, str],
|
||||||
log_dir: Optional[Path] = None,
|
log_dir: Optional[Path] = None,
|
||||||
):
|
):
|
||||||
super().__init__(num_workers, java_vm_path, log_dir)
|
"""
|
||||||
|
Initialisiert den Saxon-Worker-Pool.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
num_workers: Anzahl der Worker-Prozesse
|
||||||
|
java_vm_path: Pfad zur Java VM Binary
|
||||||
|
saxon_jar_path: Pfad zur Saxon JAR-Datei
|
||||||
|
classpath_cache: Cache für Saxon-Classpaths
|
||||||
|
log_dir: Optionales Verzeichnis für Worker-Logs (Standard: temp_dir/temp)
|
||||||
|
"""
|
||||||
|
self.num_workers = num_workers
|
||||||
|
self.java_vm_path = java_vm_path
|
||||||
self.saxon_jar_path = saxon_jar_path
|
self.saxon_jar_path = saxon_jar_path
|
||||||
self.classpath_cache = classpath_cache
|
self.classpath_cache = classpath_cache
|
||||||
|
self.log_dir = log_dir
|
||||||
|
|
||||||
|
# Worker-Prozesse und Queues
|
||||||
|
self.workers: list[subprocess.Popen] = []
|
||||||
|
self.job_queue: Queue = Queue()
|
||||||
|
self.result_queue: Queue = Queue()
|
||||||
|
self.worker_locks: list[threading.Lock] = []
|
||||||
|
|
||||||
|
# Temporäres Verzeichnis für kompilierte Java-Klasse
|
||||||
|
self.temp_dir: Optional[Path] = None
|
||||||
|
self.worker_class_path: Optional[Path] = None
|
||||||
|
self.worker_log_dir: Optional[Path] = None
|
||||||
|
|
||||||
|
# Initialisierung
|
||||||
self._compile_worker_class()
|
self._compile_worker_class()
|
||||||
self._start_workers()
|
self._start_workers()
|
||||||
|
|
||||||
logger.info(f"SaxonWorkerPool initialisiert mit {num_workers} Workern")
|
logger.info(f"SaxonWorkerPool initialisiert mit {num_workers} Workern")
|
||||||
|
|
||||||
# --- Abstrakte Properties ---
|
def _compile_worker_class(self):
|
||||||
|
"""Kompiliert die SaxonWorker-Java-Klasse."""
|
||||||
|
try:
|
||||||
|
# Erstelle temporäres Verzeichnis
|
||||||
|
self.temp_dir = Path(tempfile.mkdtemp(prefix="saxon_worker_"))
|
||||||
|
|
||||||
@property
|
# Schreibe Java-Quellcode
|
||||||
def _pool_name(self) -> str:
|
java_file = self.temp_dir / "SaxonWorker.java"
|
||||||
return "Saxon"
|
java_file.write_text(SAXON_WORKER_JAVA, encoding="utf-8")
|
||||||
|
|
||||||
@property
|
# Hole Classpath
|
||||||
def _java_source_code(self) -> str:
|
|
||||||
return SAXON_WORKER_JAVA
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _java_class_name(self) -> str:
|
|
||||||
return "SaxonWorker"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _temp_dir_prefix(self) -> str:
|
|
||||||
return "saxon_worker_"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _worker_init_sleep(self) -> float:
|
|
||||||
return 0.1
|
|
||||||
|
|
||||||
# --- Abstrakte Methoden ---
|
|
||||||
|
|
||||||
def _get_classpath(self) -> str:
|
|
||||||
saxon_dir = self.saxon_jar_path.parent
|
saxon_dir = self.saxon_jar_path.parent
|
||||||
if saxon_dir not in self.classpath_cache:
|
if saxon_dir in self.classpath_cache:
|
||||||
self.classpath_cache[saxon_dir] = build_jar_classpath(saxon_dir)
|
classpath = self.classpath_cache[saxon_dir]
|
||||||
return self.classpath_cache[saxon_dir]
|
else:
|
||||||
|
# Fallback: Baue Classpath neu
|
||||||
|
import glob
|
||||||
|
import sys
|
||||||
|
|
||||||
def _build_worker_cmd(self, full_classpath: str) -> list[str]:
|
all_jars = glob.glob(str(saxon_dir / "*.jar"))
|
||||||
return [str(self.java_vm_path), "-cp", full_classpath, "SaxonWorker"]
|
lib_dir = saxon_dir / "lib"
|
||||||
|
if lib_dir.exists():
|
||||||
|
all_jars.extend(glob.glob(str(lib_dir / "*.jar")))
|
||||||
|
|
||||||
def _stderr_log_name(self, i: int) -> str:
|
classpath_separator = ";" if sys.platform == "win32" else ":"
|
||||||
return f"worker_{i}_stderr.log"
|
classpath = classpath_separator.join(all_jars)
|
||||||
|
|
||||||
# --- Saxon-spezifische Job-Methode ---
|
# Kompiliere Java-Klasse
|
||||||
|
javac_cmd = [str(self.java_vm_path).replace("java", "javac"), "-cp", classpath, str(java_file)]
|
||||||
|
|
||||||
|
logger.debug(f"Kompiliere SaxonWorker: {' '.join(javac_cmd)}")
|
||||||
|
|
||||||
|
result = subprocess.run(javac_cmd, capture_output=True, text=True, timeout=30)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise RuntimeError(f"Java-Kompilierung fehlgeschlagen: {result.stderr}")
|
||||||
|
|
||||||
|
self.worker_class_path = self.temp_dir
|
||||||
|
|
||||||
|
logger.info(f"SaxonWorker erfolgreich kompiliert: {self.temp_dir}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Kompilieren von SaxonWorker: {e}")
|
||||||
|
raise
|
||||||
|
|
||||||
|
def _start_workers(self):
|
||||||
|
"""Startet N Worker-Prozesse."""
|
||||||
|
# Hole Classpath
|
||||||
|
saxon_dir = self.saxon_jar_path.parent
|
||||||
|
classpath = self.classpath_cache.get(saxon_dir, "")
|
||||||
|
|
||||||
|
# Füge Worker-Classpath hinzu
|
||||||
|
import sys
|
||||||
|
|
||||||
|
classpath_separator = ";" if sys.platform == "win32" else ":"
|
||||||
|
full_classpath = str(self.worker_class_path) + classpath_separator + classpath
|
||||||
|
|
||||||
|
# Bestimme Log-Verzeichnis
|
||||||
|
self.worker_log_dir = self.log_dir if self.log_dir else self.temp_dir
|
||||||
|
if self.log_dir:
|
||||||
|
self.worker_log_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
for i in range(self.num_workers):
|
||||||
|
try:
|
||||||
|
# Starte JVM-Prozess mit SaxonWorker
|
||||||
|
cmd = [str(self.java_vm_path), "-cp", full_classpath, "SaxonWorker"]
|
||||||
|
|
||||||
|
# Öffne stderr-Log-Datei für diesen Worker
|
||||||
|
stderr_log = self.worker_log_dir / f"worker_{i}_stderr.log"
|
||||||
|
stderr_file = open(stderr_log, "w", encoding="utf-8")
|
||||||
|
|
||||||
|
process = subprocess.Popen(
|
||||||
|
cmd,
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=stderr_file, # Redirect stderr to file
|
||||||
|
text=True,
|
||||||
|
bufsize=1, # Line buffered
|
||||||
|
)
|
||||||
|
|
||||||
|
self.workers.append(process)
|
||||||
|
self.worker_locks.append(threading.Lock())
|
||||||
|
|
||||||
|
logger.debug(f"Worker {i} gestartet (PID: {process.pid}, stderr: {stderr_log})")
|
||||||
|
|
||||||
|
# Warte kurz damit Worker initialisieren kann
|
||||||
|
import time
|
||||||
|
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
# Prüfe ob Worker noch läuft
|
||||||
|
if process.poll() is not None:
|
||||||
|
# Worker ist bereits beendet - Fehler!
|
||||||
|
stderr_file.close()
|
||||||
|
with open(stderr_log, "r") as f:
|
||||||
|
stderr_content = f.read()
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Worker {i} ist sofort beendet (Exit Code: {process.returncode})\nstderr:\n{stderr_content}"
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Starten von Worker {i}: {e}")
|
||||||
|
raise
|
||||||
|
|
||||||
|
logger.info(f"{len(self.workers)} Saxon-Worker erfolgreich gestartet")
|
||||||
|
|
||||||
def transform(
|
def transform(
|
||||||
self, source_xml: Path, xsl_stylesheet: Path, output_fo: Path, xslt_params: dict[str, str]
|
self, source_xml: Path, xsl_stylesheet: Path, output_fo: Path, xslt_params: dict[str, str]
|
||||||
@@ -246,38 +324,119 @@ class SaxonWorkerPool(BaseWorkerPool):
|
|||||||
Returns:
|
Returns:
|
||||||
tuple[bool, str]: (Erfolg, Fehlermeldung/Info)
|
tuple[bool, str]: (Erfolg, Fehlermeldung/Info)
|
||||||
"""
|
"""
|
||||||
worker_idx = self._acquire_worker()
|
# Finde freien Worker
|
||||||
|
worker_idx = None
|
||||||
|
for i, lock in enumerate(self.worker_locks):
|
||||||
|
if lock.acquire(blocking=False):
|
||||||
|
worker_idx = i
|
||||||
|
break
|
||||||
|
|
||||||
|
if worker_idx is None:
|
||||||
|
# Kein freier Worker, warte auf ersten verfügbaren
|
||||||
|
for i, lock in enumerate(self.worker_locks):
|
||||||
|
lock.acquire()
|
||||||
|
worker_idx = i
|
||||||
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
worker = self.workers[worker_idx]
|
worker = self.workers[worker_idx]
|
||||||
|
|
||||||
|
# Prüfe ob Worker noch läuft
|
||||||
if worker.poll() is not None:
|
if worker.poll() is not None:
|
||||||
stderr_content = self._read_stderr_log(worker_idx)
|
# Worker ist tot!
|
||||||
error_msg = f"Worker {worker_idx} ist beendet (Exit: {worker.returncode})\nstderr:\n{stderr_content}"
|
stderr_log = self.worker_log_dir / f"worker_{worker_idx}_stderr.log"
|
||||||
|
try:
|
||||||
|
with open(stderr_log, "r") as f:
|
||||||
|
stderr_content = f.read()
|
||||||
|
error_msg = (
|
||||||
|
f"Worker {worker_idx} ist beendet (Exit: {worker.returncode})\nstderr:\n{stderr_content}"
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
error_msg = f"Worker {worker_idx} ist beendet (Exit: {worker.returncode})"
|
||||||
logger.error(error_msg)
|
logger.error(error_msg)
|
||||||
return False, error_msg
|
return False, error_msg
|
||||||
|
|
||||||
params_str = "|||".join([f"{k}={v}" for k, v in xslt_params.items()])
|
# Formatiere Parameter
|
||||||
|
params_str = "|||".join([f"{key}={value}" for key, value in xslt_params.items()])
|
||||||
|
|
||||||
|
# Erstelle Job-String (Tab-separated)
|
||||||
job = f"{source_xml}\t{xsl_stylesheet}\t{output_fo}\t{params_str}\n"
|
job = f"{source_xml}\t{xsl_stylesheet}\t{output_fo}\t{params_str}\n"
|
||||||
|
|
||||||
logger.debug(f"Sende Job an Worker {worker_idx}: {source_xml.name}")
|
logger.debug(f"Sende Job an Worker {worker_idx}: {source_xml.name}")
|
||||||
|
|
||||||
|
# Sende Job an Worker
|
||||||
worker.stdin.write(job)
|
worker.stdin.write(job)
|
||||||
worker.stdin.flush()
|
worker.stdin.flush()
|
||||||
|
|
||||||
|
# Warte auf Antwort
|
||||||
response = worker.stdout.readline().strip()
|
response = worker.stdout.readline().strip()
|
||||||
|
|
||||||
logger.debug(f"Worker {worker_idx} Antwort: '{response}'")
|
logger.debug(f"Worker {worker_idx} Antwort: '{response}'")
|
||||||
|
|
||||||
if response == "OK":
|
if response == "OK":
|
||||||
return True, "Erfolgreich"
|
return True, "Erfolgreich"
|
||||||
elif response.startswith("ERROR:"):
|
elif response.startswith("ERROR:"):
|
||||||
return False, f"Saxon-Fehler: {response[6:].strip()}"
|
error_msg = response[6:].strip()
|
||||||
elif not response:
|
return False, f"Saxon-Fehler: {error_msg}"
|
||||||
stderr_content = self._read_stderr_log(worker_idx, tail=500)
|
|
||||||
return False, f"Worker {worker_idx} crashed (keine Antwort)\nstderr:\n{stderr_content}"
|
|
||||||
else:
|
else:
|
||||||
|
# Leere Antwort bedeutet Worker ist crashed
|
||||||
|
if not response:
|
||||||
|
stderr_log = self.worker_log_dir / f"worker_{worker_idx}_stderr.log"
|
||||||
|
try:
|
||||||
|
with open(stderr_log, "r") as f:
|
||||||
|
stderr_content = f.read()[-500:] # Letzte 500 Zeichen
|
||||||
|
return False, f"Worker {worker_idx} crashed (keine Antwort)\nstderr:\n{stderr_content}"
|
||||||
|
except Exception:
|
||||||
|
return False, f"Worker {worker_idx} crashed (keine Antwort)"
|
||||||
return False, f"Unerwartete Antwort: {response}"
|
return False, f"Unerwartete Antwort: {response}"
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Fehler bei Worker {worker_idx}: {e}")
|
logger.error(f"Fehler bei Worker {worker_idx}: {e}")
|
||||||
return False, f"Worker-Fehler: {str(e)}"
|
return False, f"Worker-Fehler: {str(e)}"
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
# Gebe Worker-Lock frei
|
||||||
self.worker_locks[worker_idx].release()
|
self.worker_locks[worker_idx].release()
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
"""Beendet alle Worker-Prozesse sauber."""
|
||||||
|
logger.info("Beende Saxon-Worker-Pool...")
|
||||||
|
|
||||||
|
for i, worker in enumerate(self.workers):
|
||||||
|
try:
|
||||||
|
# Sende EXIT-Befehl
|
||||||
|
if worker.stdin and not worker.stdin.closed:
|
||||||
|
worker.stdin.write("EXIT\n")
|
||||||
|
worker.stdin.flush()
|
||||||
|
|
||||||
|
# Warte auf Beendigung (max 2 Sekunden)
|
||||||
|
worker.wait(timeout=2)
|
||||||
|
logger.debug(f"Worker {i} beendet")
|
||||||
|
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
# Force kill falls nötig
|
||||||
|
worker.kill()
|
||||||
|
logger.warning(f"Worker {i} musste gekillt werden")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Fehler beim Beenden von Worker {i}: {e}")
|
||||||
|
|
||||||
|
# Lösche temporäres Verzeichnis
|
||||||
|
if self.temp_dir and self.temp_dir.exists():
|
||||||
|
try:
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
shutil.rmtree(self.temp_dir)
|
||||||
|
logger.debug(f"Temporäres Verzeichnis gelöscht: {self.temp_dir}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Konnte temporäres Verzeichnis nicht löschen: {e}")
|
||||||
|
|
||||||
|
logger.info("Saxon-Worker-Pool beendet")
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
"""Context manager entry."""
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
"""Context manager exit."""
|
||||||
|
self.shutdown()
|
||||||
|
|||||||
@@ -1,267 +0,0 @@
|
|||||||
"""
|
|
||||||
Saxon Worker Pool (s9api) - Persistente JVM-Prozesse für XSLT 2.0/3.0 Transformationen.
|
|
||||||
|
|
||||||
Diese Variante verwendet die Saxon s9api API anstatt JAXP und ist für XSLT 2.0 und 3.0 geeignet.
|
|
||||||
Eliminiert JVM-Startup-Overhead durch Vorinitialisierung von N Worker-Prozessen.
|
|
||||||
Jeder Worker läuft als Daemon und verarbeitet mehrere Transformationen nacheinander.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from worker_pool_base import BaseWorkerPool, build_jar_classpath
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
# Java-Worker-Code für s9api (wird zur Laufzeit kompiliert)
|
|
||||||
SAXON_S9API_WORKER_JAVA = """
|
|
||||||
import net.sf.saxon.s9api.*;
|
|
||||||
import javax.xml.transform.stream.StreamSource;
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class SaxonS9ApiWorker {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
String line;
|
|
||||||
|
|
||||||
// Create Processor once and reuse (equivalent to TransformerFactory)
|
|
||||||
Processor processor = new Processor(false);
|
|
||||||
|
|
||||||
// Cache für kompilierte Stylesheets (Performance-Optimierung)
|
|
||||||
Map<String, XsltExecutable> stylesheetCache = new HashMap<>();
|
|
||||||
|
|
||||||
System.err.println("SaxonS9ApiWorker started and ready (using s9api for XSLT 2.0/3.0 with stylesheet caching)");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
try {
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
System.err.println("DEBUG: Received line: " + line.substring(0, Math.min(100, line.length())));
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
if ("EXIT".equals(line.trim())) {
|
|
||||||
System.err.println("SaxonS9ApiWorker exiting");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Parse job
|
|
||||||
System.err.println("DEBUG: Parsing job...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
String[] parts = line.split("\\\\t");
|
|
||||||
System.err.println("DEBUG: Parts count: " + parts.length);
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
if (parts.length < 3) {
|
|
||||||
System.out.println("ERROR: Invalid job format");
|
|
||||||
System.out.flush();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String sourceXml = parts[0];
|
|
||||||
String xslStylesheet = parts[1];
|
|
||||||
String outputFo = parts[2];
|
|
||||||
|
|
||||||
// Prüfe ob Stylesheet bereits im Cache ist
|
|
||||||
XsltExecutable executable;
|
|
||||||
if (stylesheetCache.containsKey(xslStylesheet)) {
|
|
||||||
executable = stylesheetCache.get(xslStylesheet);
|
|
||||||
System.err.println("DEBUG: Using cached stylesheet: " + xslStylesheet);
|
|
||||||
System.err.flush();
|
|
||||||
} else {
|
|
||||||
System.err.println("DEBUG: Compiling and caching stylesheet: " + xslStylesheet);
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
XsltCompiler compiler = processor.newXsltCompiler();
|
|
||||||
executable = compiler.compile(new StreamSource(new File(xslStylesheet)));
|
|
||||||
stylesheetCache.put(xslStylesheet, executable);
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Stylesheet compiled and cached (cache size: " + stylesheetCache.size() + ")");
|
|
||||||
System.err.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Creating transformer...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Create transformer
|
|
||||||
XsltTransformer transformer = executable.load();
|
|
||||||
|
|
||||||
// Set source
|
|
||||||
transformer.setSource(new StreamSource(new File(sourceXml)));
|
|
||||||
|
|
||||||
// Set destination
|
|
||||||
Serializer serializer = processor.newSerializer(new File(outputFo));
|
|
||||||
transformer.setDestination(serializer);
|
|
||||||
|
|
||||||
// Set parameters if present
|
|
||||||
if (parts.length > 3 && !parts[3].isEmpty()) {
|
|
||||||
String[] params = parts[3].split("\\\\|\\\\|\\\\|");
|
|
||||||
for (String param : params) {
|
|
||||||
if (!param.isEmpty() && param.contains("=")) {
|
|
||||||
String[] kv = param.split("=", 2);
|
|
||||||
transformer.setParameter(new QName(kv[0]), new XdmAtomicValue(kv[1]));
|
|
||||||
System.err.println("DEBUG: Set parameter: " + kv[0] + " = " + kv[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.err.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Running transformation...");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
// Transform
|
|
||||||
transformer.transform();
|
|
||||||
|
|
||||||
System.err.println("DEBUG: Transformation completed");
|
|
||||||
System.err.flush();
|
|
||||||
|
|
||||||
System.out.println("OK");
|
|
||||||
System.out.flush();
|
|
||||||
|
|
||||||
} catch (SaxonApiException e) {
|
|
||||||
System.err.println("DEBUG: SaxonApiException: " + e.getClass().getName());
|
|
||||||
System.err.flush();
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
|
|
||||||
String errorMsg = e.getMessage();
|
|
||||||
if (errorMsg == null || errorMsg.isEmpty()) {
|
|
||||||
errorMsg = e.getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
System.out.println("ERROR: " + errorMsg);
|
|
||||||
System.out.flush();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("DEBUG: Job processing exception: " + e.getClass().getName());
|
|
||||||
System.err.flush();
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
System.out.println("ERROR: " + (e.getMessage() != null ? e.getMessage() : e.getClass().getName()));
|
|
||||||
System.out.flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("SaxonS9ApiWorker I/O error: " + e.getMessage());
|
|
||||||
e.printStackTrace(System.err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class SaxonWorkerPoolS9Api(BaseWorkerPool):
|
|
||||||
"""
|
|
||||||
Pool von lang-laufenden JVM-Prozessen für Saxon-Transformationen mit s9api.
|
|
||||||
|
|
||||||
Diese Variante verwendet die Saxon s9api API anstatt JAXP und unterstützt
|
|
||||||
vollständig XSLT 2.0 und 3.0 Transformationen.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
num_workers: int,
|
|
||||||
java_vm_path: Path,
|
|
||||||
saxon_jar_path: Path,
|
|
||||||
classpath_cache: dict[Path, str],
|
|
||||||
log_dir: Optional[Path] = None,
|
|
||||||
):
|
|
||||||
super().__init__(num_workers, java_vm_path, log_dir)
|
|
||||||
self.saxon_jar_path = saxon_jar_path
|
|
||||||
self.classpath_cache = classpath_cache
|
|
||||||
|
|
||||||
self._compile_worker_class()
|
|
||||||
self._start_workers()
|
|
||||||
logger.info(f"SaxonWorkerPoolS9Api initialisiert mit {num_workers} Workern (XSLT 2.0/3.0)")
|
|
||||||
|
|
||||||
# --- Abstrakte Properties ---
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _pool_name(self) -> str:
|
|
||||||
return "Saxon-S9Api"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _java_source_code(self) -> str:
|
|
||||||
return SAXON_S9API_WORKER_JAVA
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _java_class_name(self) -> str:
|
|
||||||
return "SaxonS9ApiWorker"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _temp_dir_prefix(self) -> str:
|
|
||||||
return "saxon_s9api_worker_"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _worker_init_sleep(self) -> float:
|
|
||||||
return 0.1
|
|
||||||
|
|
||||||
# --- Abstrakte Methoden ---
|
|
||||||
|
|
||||||
def _get_classpath(self) -> str:
|
|
||||||
saxon_dir = self.saxon_jar_path.parent
|
|
||||||
if saxon_dir not in self.classpath_cache:
|
|
||||||
self.classpath_cache[saxon_dir] = build_jar_classpath(saxon_dir)
|
|
||||||
logger.debug(f"Classpath für {saxon_dir} neu erstellt und gecacht")
|
|
||||||
return self.classpath_cache[saxon_dir]
|
|
||||||
|
|
||||||
def _build_worker_cmd(self, full_classpath: str) -> list[str]:
|
|
||||||
return [str(self.java_vm_path), "-cp", full_classpath, "SaxonS9ApiWorker"]
|
|
||||||
|
|
||||||
def _stderr_log_name(self, i: int) -> str:
|
|
||||||
return f"s9api_worker_{i}_stderr.log"
|
|
||||||
|
|
||||||
# --- Saxon-s9api-spezifische Job-Methode ---
|
|
||||||
|
|
||||||
def transform(
|
|
||||||
self, source_xml: Path, xsl_stylesheet: Path, output_fo: Path, xslt_params: dict[str, str]
|
|
||||||
) -> tuple[bool, str]:
|
|
||||||
"""
|
|
||||||
Führt eine XSLT-Transformation mit einem Worker aus dem Pool aus.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
source_xml: Pfad zur XML-Eingabedatei
|
|
||||||
xsl_stylesheet: Pfad zur XSL-Stylesheet-Datei
|
|
||||||
output_fo: Pfad zur FO-Ausgabedatei
|
|
||||||
xslt_params: Dictionary mit XSLT-Parametern
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple[bool, str]: (Erfolg, Fehlermeldung/Info)
|
|
||||||
"""
|
|
||||||
worker_idx = self._acquire_worker()
|
|
||||||
try:
|
|
||||||
worker = self.workers[worker_idx]
|
|
||||||
|
|
||||||
if worker.poll() is not None:
|
|
||||||
stderr_content = self._read_stderr_log(worker_idx)
|
|
||||||
error_msg = (
|
|
||||||
f"S9Api Worker {worker_idx} ist beendet (Exit: {worker.returncode})\nstderr:\n{stderr_content}"
|
|
||||||
)
|
|
||||||
logger.error(error_msg)
|
|
||||||
return False, error_msg
|
|
||||||
|
|
||||||
params_str = "|||".join([f"{k}={v}" for k, v in xslt_params.items()])
|
|
||||||
job = f"{source_xml}\t{xsl_stylesheet}\t{output_fo}\t{params_str}\n"
|
|
||||||
|
|
||||||
logger.debug(f"Sende Job an S9Api Worker {worker_idx}: {source_xml.name}")
|
|
||||||
worker.stdin.write(job)
|
|
||||||
worker.stdin.flush()
|
|
||||||
|
|
||||||
response = worker.stdout.readline().strip()
|
|
||||||
logger.debug(f"S9Api Worker {worker_idx} Antwort: '{response}'")
|
|
||||||
|
|
||||||
if response == "OK":
|
|
||||||
return True, "Erfolgreich"
|
|
||||||
elif response.startswith("ERROR:"):
|
|
||||||
return False, f"Saxon-Fehler (s9api): {response[6:].strip()}"
|
|
||||||
elif not response:
|
|
||||||
stderr_content = self._read_stderr_log(worker_idx, tail=500)
|
|
||||||
return False, f"S9Api Worker {worker_idx} crashed (keine Antwort)\nstderr:\n{stderr_content}"
|
|
||||||
else:
|
|
||||||
return False, f"Unerwartete Antwort: {response}"
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler bei S9Api Worker {worker_idx}: {e}")
|
|
||||||
return False, f"Worker-Fehler: {str(e)}"
|
|
||||||
finally:
|
|
||||||
self.worker_locks[worker_idx].release()
|
|
||||||
@@ -9,31 +9,20 @@ Dieses Modul implementiert die Transformations-Pipeline:
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Optional, TYPE_CHECKING
|
from typing import Any, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
# Verhindert Konsolenfenster bei Subprozessen in PyInstaller-EXE (Windows)
|
|
||||||
_SUBPROCESS_FLAGS = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from saxon_pool import SaxonWorkerPool
|
from saxon_pool import SaxonWorkerPool
|
||||||
from saxon_pool_s9api import SaxonWorkerPoolS9Api
|
|
||||||
from fop_pool import FopWorkerPool
|
|
||||||
from xsl_dependencies import XslDependencyGraph
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Globaler Saxon-Worker-Pool (wird von MainWindow initialisiert)
|
# Globaler Saxon-Worker-Pool (wird von MainWindow initialisiert)
|
||||||
# Kann entweder JAXP oder s9api Variante sein
|
_saxon_worker_pool: Optional["SaxonWorkerPool"] = None
|
||||||
_saxon_worker_pool: Optional["SaxonWorkerPool | SaxonWorkerPoolS9Api"] = None
|
|
||||||
|
|
||||||
# Globaler FOP-Worker-Pool (wird von MainWindow initialisiert)
|
|
||||||
_fop_worker_pool: Optional["FopWorkerPool"] = None
|
|
||||||
|
|
||||||
|
|
||||||
def set_saxon_worker_pool(pool: Optional["SaxonWorkerPool | SaxonWorkerPoolS9Api"]):
|
def set_saxon_worker_pool(pool: Optional["SaxonWorkerPool"]):
|
||||||
"""Setzt den globalen Saxon-Worker-Pool."""
|
"""Setzt den globalen Saxon-Worker-Pool."""
|
||||||
global _saxon_worker_pool
|
global _saxon_worker_pool
|
||||||
_saxon_worker_pool = pool
|
_saxon_worker_pool = pool
|
||||||
@@ -43,26 +32,6 @@ def set_saxon_worker_pool(pool: Optional["SaxonWorkerPool | SaxonWorkerPoolS9Api
|
|||||||
logger.info("Saxon-Worker-Pool deaktiviert (Fallback auf subprocess)")
|
logger.info("Saxon-Worker-Pool deaktiviert (Fallback auf subprocess)")
|
||||||
|
|
||||||
|
|
||||||
def get_saxon_worker_pool() -> Optional["SaxonWorkerPool | SaxonWorkerPoolS9Api"]:
|
|
||||||
"""Gibt den aktuellen globalen Saxon-Worker-Pool zurück."""
|
|
||||||
return _saxon_worker_pool
|
|
||||||
|
|
||||||
|
|
||||||
def set_fop_worker_pool(pool: Optional["FopWorkerPool"]):
|
|
||||||
"""Setzt den globalen FOP-Worker-Pool."""
|
|
||||||
global _fop_worker_pool
|
|
||||||
_fop_worker_pool = pool
|
|
||||||
if pool:
|
|
||||||
logger.info(f"FOP-Worker-Pool aktiviert mit {pool.num_workers} Workern")
|
|
||||||
else:
|
|
||||||
logger.info("FOP-Worker-Pool deaktiviert (Fallback auf subprocess)")
|
|
||||||
|
|
||||||
|
|
||||||
def get_fop_worker_pool() -> Optional["FopWorkerPool"]:
|
|
||||||
"""Gibt den aktuellen globalen FOP-Worker-Pool zurück."""
|
|
||||||
return _fop_worker_pool
|
|
||||||
|
|
||||||
|
|
||||||
class TransformationJob:
|
class TransformationJob:
|
||||||
"""
|
"""
|
||||||
Repräsentiert einen einzelnen Transformations-Job.
|
Repräsentiert einen einzelnen Transformations-Job.
|
||||||
@@ -86,7 +55,6 @@ class TransformationJob:
|
|||||||
diff_pdf_params: list[str],
|
diff_pdf_params: list[str],
|
||||||
xsl_id: tuple | None = None,
|
xsl_id: tuple | None = None,
|
||||||
fop_config_dir: Path | None = None,
|
fop_config_dir: Path | None = None,
|
||||||
dependency_graph: Optional["XslDependencyGraph"] = None,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Initialisiert einen Transformations-Job.
|
Initialisiert einen Transformations-Job.
|
||||||
@@ -103,7 +71,6 @@ class TransformationJob:
|
|||||||
diff_pdf_params: Standard-Parameter für diff-pdf
|
diff_pdf_params: Standard-Parameter für diff-pdf
|
||||||
xsl_id: ID der XSL-Datei (als Tuple)
|
xsl_id: ID der XSL-Datei (als Tuple)
|
||||||
fop_config_dir: Optionaler Pfad zum FOP-Config-Verzeichnis (überschreibt Standardpfad)
|
fop_config_dir: Optionaler Pfad zum FOP-Config-Verzeichnis (überschreibt Standardpfad)
|
||||||
dependency_graph: Optionaler XSL-Abhängigkeitsgraph für Import/Include-Prüfung
|
|
||||||
"""
|
"""
|
||||||
self.project_dir = project_dir
|
self.project_dir = project_dir
|
||||||
self.xml_file = xml_file # Relativ
|
self.xml_file = xml_file # Relativ
|
||||||
@@ -118,7 +85,6 @@ class TransformationJob:
|
|||||||
self.fop_config_dir = fop_config_dir
|
self.fop_config_dir = fop_config_dir
|
||||||
self.diff_pdf_path = diff_pdf_path
|
self.diff_pdf_path = diff_pdf_path
|
||||||
self.diff_pdf_params = diff_pdf_params
|
self.diff_pdf_params = diff_pdf_params
|
||||||
self.dependency_graph = dependency_graph
|
|
||||||
|
|
||||||
# Ausgabe-Verzeichnisse im Projektordner
|
# Ausgabe-Verzeichnisse im Projektordner
|
||||||
self.new_dir = project_dir / "new"
|
self.new_dir = project_dir / "new"
|
||||||
@@ -167,12 +133,12 @@ class TransformationJob:
|
|||||||
Returns:
|
Returns:
|
||||||
bool: True wenn New-PDF existiert und aktueller ist als alle Inputs
|
bool: True wenn New-PDF existiert und aktueller ist als alle Inputs
|
||||||
"""
|
"""
|
||||||
try:
|
if not self.new_pdf.exists():
|
||||||
output_mtime = self.new_pdf.stat().st_mtime
|
|
||||||
except FileNotFoundError:
|
|
||||||
logger.debug(f"New-PDF existiert nicht: {self.new_pdf}")
|
logger.debug(f"New-PDF existiert nicht: {self.new_pdf}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
output_mtime = self.new_pdf.stat().st_mtime
|
||||||
|
|
||||||
# Prüfe XML-Datei
|
# Prüfe XML-Datei
|
||||||
xml_abs = self.project_dir / self.xml_file
|
xml_abs = self.project_dir / self.xml_file
|
||||||
if xml_abs.exists() and xml_abs.stat().st_mtime > output_mtime:
|
if xml_abs.exists() and xml_abs.stat().st_mtime > output_mtime:
|
||||||
@@ -184,13 +150,6 @@ class TransformationJob:
|
|||||||
logger.debug(f"XSL-Datei ist neuer: {self.xsl_file}")
|
logger.debug(f"XSL-Datei ist neuer: {self.xsl_file}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Prüfe importierte/inkludierte XSL-Dateien (transitiv)
|
|
||||||
if self.dependency_graph and self.xsl_file.exists():
|
|
||||||
for dep_xsl in self.dependency_graph.get_dependencies(self.xsl_file):
|
|
||||||
if dep_xsl.exists() and dep_xsl.stat().st_mtime > output_mtime:
|
|
||||||
logger.debug(f"Importierte XSL-Datei ist neuer: {dep_xsl}")
|
|
||||||
return False
|
|
||||||
|
|
||||||
logger.debug(f"Transformation ist aktuell: {self.new_pdf}")
|
logger.debug(f"Transformation ist aktuell: {self.new_pdf}")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -297,7 +256,6 @@ class TransformationJob:
|
|||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=120, # 2 Minuten Timeout
|
timeout=120, # 2 Minuten Timeout
|
||||||
creationflags=_SUBPROCESS_FLAGS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Saxon Ausgaben loggen
|
# Saxon Ausgaben loggen
|
||||||
@@ -345,55 +303,11 @@ class TransformationJob:
|
|||||||
logger.error(error_msg)
|
logger.error(error_msg)
|
||||||
return False, error_msg
|
return False, error_msg
|
||||||
|
|
||||||
logger.info(f"Starte Apache FOP PDF-Generierung: {self.xml_file.name}")
|
|
||||||
|
|
||||||
# Versuche zuerst den Worker-Pool zu nutzen (schneller!)
|
|
||||||
global _fop_worker_pool
|
|
||||||
if _fop_worker_pool:
|
|
||||||
try:
|
|
||||||
success, message = _fop_worker_pool.build_pdf(
|
|
||||||
input_fo=self.temp_fo,
|
|
||||||
output_pdf=self.new_pdf,
|
|
||||||
)
|
|
||||||
|
|
||||||
if success:
|
|
||||||
logger.info(f"FOP PDF-Generierung erfolgreich (Worker-Pool): {self.xml_file.name}")
|
|
||||||
|
|
||||||
# Temporäre FO-Datei löschen
|
|
||||||
if self.temp_fo.exists():
|
|
||||||
try:
|
|
||||||
self.temp_fo.unlink()
|
|
||||||
logger.debug(f"Temporäre FO-Datei gelöscht: {self.temp_fo}")
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f"Konnte FO-Datei nicht löschen: {e}")
|
|
||||||
|
|
||||||
# Wenn kein Ref-PDF existiert, erstelle es
|
|
||||||
if not self.ref_pdf.exists():
|
|
||||||
try:
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
shutil.copy2(self.new_pdf, self.ref_pdf)
|
|
||||||
logger.info(f"Ref-PDF erstellt: {self.ref_pdf}")
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f"Konnte Ref-PDF nicht erstellen: {e}")
|
|
||||||
|
|
||||||
return True, "Erfolgreich"
|
|
||||||
else:
|
|
||||||
logger.error(f"FOP PDF-Generierung fehlgeschlagen (Worker-Pool): {message}")
|
|
||||||
return False, message
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f"FOP Worker-Pool-Fehler, Fallback auf subprocess: {e}")
|
|
||||||
# Fallback auf subprocess unten
|
|
||||||
|
|
||||||
# Fallback: Traditionelle subprocess-Methode (langsamer, aber robuster)
|
|
||||||
|
|
||||||
# Apache FOP Kommandozeile
|
# Apache FOP Kommandozeile
|
||||||
fop_conf_exists = self.fop_conf.exists()
|
|
||||||
cmd_line = [
|
cmd_line = [
|
||||||
str(self.fop_cmd),
|
str(self.fop_cmd),
|
||||||
"-c",
|
"-c",
|
||||||
str(self.fop_conf) if fop_conf_exists else "",
|
str(self.fop_conf) if self.fop_conf.exists() else "",
|
||||||
"-r",
|
"-r",
|
||||||
"-fo",
|
"-fo",
|
||||||
str(self.temp_fo),
|
str(self.temp_fo),
|
||||||
@@ -402,7 +316,7 @@ class TransformationJob:
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Entferne leere Config-Parameter wenn fop.xconf nicht existiert
|
# Entferne leere Config-Parameter wenn fop.xconf nicht existiert
|
||||||
if not fop_conf_exists:
|
if not self.fop_conf.exists():
|
||||||
cmd_line = [c for c in cmd_line if c not in ["-c", ""]]
|
cmd_line = [c for c in cmd_line if c not in ["-c", ""]]
|
||||||
|
|
||||||
logger.info(f"Starte Apache FOP PDF-Generierung: {self.xml_file.name}")
|
logger.info(f"Starte Apache FOP PDF-Generierung: {self.xml_file.name}")
|
||||||
@@ -414,7 +328,6 @@ class TransformationJob:
|
|||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=180, # 3 Minuten Timeout
|
timeout=180, # 3 Minuten Timeout
|
||||||
creationflags=_SUBPROCESS_FLAGS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Apache FOP Ausgaben loggen
|
# Apache FOP Ausgaben loggen
|
||||||
@@ -494,7 +407,6 @@ class TransformationJob:
|
|||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=60, # 1 Minute Timeout
|
timeout=60, # 1 Minute Timeout
|
||||||
creationflags=_SUBPROCESS_FLAGS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
@@ -530,7 +442,6 @@ class TransformationJob:
|
|||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
timeout=90, # 1.5 Minuten Timeout
|
timeout=90, # 1.5 Minuten Timeout
|
||||||
creationflags=_SUBPROCESS_FLAGS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if result_diff.returncode == 0 or self.diff_pdf.exists():
|
if result_diff.returncode == 0 or self.diff_pdf.exists():
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
"""
|
|
||||||
Info-Dialog für DocuMentor.
|
|
||||||
|
|
||||||
Zeigt Programmversion, Python-Version und alle Drittanbieter-Bibliotheken
|
|
||||||
mit installierten Versionen und Lizenzinformationen an.
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
import sys
|
|
||||||
from importlib.metadata import PackageNotFoundError, version
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from PySide6.QtCore import Qt
|
|
||||||
from PySide6.QtGui import QFont
|
|
||||||
from PySide6.QtWidgets import (
|
|
||||||
QDialog,
|
|
||||||
QDialogButtonBox,
|
|
||||||
QFrame,
|
|
||||||
QHBoxLayout,
|
|
||||||
QHeaderView,
|
|
||||||
QLabel,
|
|
||||||
QTableWidget,
|
|
||||||
QTableWidgetItem,
|
|
||||||
QVBoxLayout,
|
|
||||||
)
|
|
||||||
|
|
||||||
from license_parser import parse_license_file
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class AboutDialog(QDialog):
|
|
||||||
"""Info-Dialog mit Versionsinformationen und Drittanbieter-Lizenzen."""
|
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
super().__init__(parent)
|
|
||||||
self.setWindowTitle("Über DocuMentor")
|
|
||||||
self.resize(950, 620)
|
|
||||||
self.setSizeGripEnabled(True)
|
|
||||||
self.setModal(True)
|
|
||||||
self._setup_ui()
|
|
||||||
self._populate_data()
|
|
||||||
|
|
||||||
def _get_app_version(self) -> str:
|
|
||||||
"""Ermittelt die Programmversion."""
|
|
||||||
try:
|
|
||||||
return version("DocuMentor")
|
|
||||||
except PackageNotFoundError:
|
|
||||||
# Fallback: pyproject.toml parsen (PyInstaller-Bundle oder Entwicklungsmodus)
|
|
||||||
try:
|
|
||||||
import tomllib
|
|
||||||
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
|
||||||
pyproject = Path(sys._MEIPASS) / "pyproject.toml" # type: ignore[attr-defined]
|
|
||||||
else:
|
|
||||||
pyproject = Path(__file__).parent.parent.parent / "pyproject.toml"
|
|
||||||
with open(pyproject, "rb") as f:
|
|
||||||
return tomllib.load(f)["project"]["version"]
|
|
||||||
except Exception:
|
|
||||||
return "unbekannt"
|
|
||||||
|
|
||||||
def _setup_ui(self):
|
|
||||||
"""Erstellt das Dialog-Layout programmatisch."""
|
|
||||||
layout = QVBoxLayout(self)
|
|
||||||
layout.setSpacing(8)
|
|
||||||
|
|
||||||
# App-Name
|
|
||||||
self.app_name_label = QLabel("DocuMentor")
|
|
||||||
font = QFont()
|
|
||||||
font.setPointSize(18)
|
|
||||||
font.setBold(True)
|
|
||||||
self.app_name_label.setFont(font)
|
|
||||||
self.app_name_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
||||||
layout.addWidget(self.app_name_label)
|
|
||||||
|
|
||||||
# Beschreibung
|
|
||||||
self.description_label = QLabel("Professionelle XSL-Transformations-Verwaltung und PDF-Generierung")
|
|
||||||
self.description_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
||||||
self.description_label.setWordWrap(True)
|
|
||||||
layout.addWidget(self.description_label)
|
|
||||||
|
|
||||||
# Version + Python-Version
|
|
||||||
self.version_label = QLabel()
|
|
||||||
self.version_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
||||||
layout.addWidget(self.version_label)
|
|
||||||
|
|
||||||
# Lizenz
|
|
||||||
self.license_label = QLabel("Lizenz: MIT")
|
|
||||||
self.license_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
||||||
layout.addWidget(self.license_label)
|
|
||||||
|
|
||||||
# Separator
|
|
||||||
separator = QFrame()
|
|
||||||
separator.setFrameShape(QFrame.Shape.HLine)
|
|
||||||
separator.setFrameShadow(QFrame.Shadow.Sunken)
|
|
||||||
layout.addWidget(separator)
|
|
||||||
|
|
||||||
# Überschrift für Tabelle
|
|
||||||
header_layout = QHBoxLayout()
|
|
||||||
table_header = QLabel("Drittanbieter-Bibliotheken:")
|
|
||||||
header_font = QFont()
|
|
||||||
header_font.setBold(True)
|
|
||||||
table_header.setFont(header_font)
|
|
||||||
header_layout.addWidget(table_header)
|
|
||||||
header_layout.addStretch()
|
|
||||||
layout.addLayout(header_layout)
|
|
||||||
|
|
||||||
# Dependency-Tabelle
|
|
||||||
self.table = QTableWidget()
|
|
||||||
self.table.setColumnCount(6)
|
|
||||||
self.table.setHorizontalHeaderLabels(["Name", "Lizenz", "Installiert", "Webseite", "Copyright", "Kategorie"])
|
|
||||||
self.table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers)
|
|
||||||
self.table.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows)
|
|
||||||
self.table.setAlternatingRowColors(True)
|
|
||||||
self.table.setSortingEnabled(True)
|
|
||||||
self.table.verticalHeader().setVisible(False)
|
|
||||||
|
|
||||||
# Spaltenbreiten
|
|
||||||
header = self.table.horizontalHeader()
|
|
||||||
header.resizeSection(0, 170) # Name
|
|
||||||
header.resizeSection(1, 180) # Lizenz
|
|
||||||
header.resizeSection(2, 80) # Installiert
|
|
||||||
header.resizeSection(5, 200) # Kategorie
|
|
||||||
header.setSectionResizeMode(3, QHeaderView.ResizeMode.Stretch) # Webseite
|
|
||||||
header.setSectionResizeMode(4, QHeaderView.ResizeMode.Stretch) # Copyright
|
|
||||||
|
|
||||||
layout.addWidget(self.table)
|
|
||||||
|
|
||||||
# Schließen-Button
|
|
||||||
button_box = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
|
|
||||||
button_box.rejected.connect(self.reject)
|
|
||||||
button_box.setCenterButtons(True)
|
|
||||||
layout.addWidget(button_box)
|
|
||||||
|
|
||||||
def _populate_data(self):
|
|
||||||
"""Befüllt den Dialog mit Versions- und Lizenzinformationen."""
|
|
||||||
# Version setzen
|
|
||||||
app_version = self._get_app_version()
|
|
||||||
python_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
|
|
||||||
self.version_label.setText(f"Version: {app_version} | Python: {python_version}")
|
|
||||||
|
|
||||||
# Lizenzdaten laden und Tabelle befüllen
|
|
||||||
parsed = parse_license_file()
|
|
||||||
self.table.setRowCount(len(parsed.entries))
|
|
||||||
|
|
||||||
for row, entry in enumerate(parsed.entries):
|
|
||||||
self.table.setItem(row, 0, QTableWidgetItem(entry.name))
|
|
||||||
self.table.setItem(row, 1, QTableWidgetItem(entry.license))
|
|
||||||
self.table.setItem(row, 2, QTableWidgetItem(entry.installed_version or "—"))
|
|
||||||
if entry.website:
|
|
||||||
website_label = QLabel(f'<a href="{entry.website}">{entry.website}</a>')
|
|
||||||
website_label.setOpenExternalLinks(True)
|
|
||||||
website_label.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction)
|
|
||||||
self.table.setCellWidget(row, 3, website_label)
|
|
||||||
else:
|
|
||||||
self.table.setItem(row, 3, QTableWidgetItem(""))
|
|
||||||
self.table.setItem(row, 4, QTableWidgetItem(entry.copyright))
|
|
||||||
self.table.setItem(row, 5, QTableWidgetItem(entry.category))
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>833</width>
|
<width>833</width>
|
||||||
<height>526</height>
|
<height>387</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -520,208 +520,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tabPerformance">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Performance</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBoxWorker">
|
|
||||||
<property name="title">
|
|
||||||
<string>ThreadPoolExecutor Einstellungen</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelWorkerCount">
|
|
||||||
<property name="text">
|
|
||||||
<string>Anzahl paralleler Worker für Transformationen:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBoxWorkerCount">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Anzahl der parallelen Worker-Threads für Transformationen (Standard: 8)</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>32</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>8</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBoxSaxonPool">
|
|
||||||
<property name="title">
|
|
||||||
<string>SaxonWorkerPool Einstellungen</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxUseSaxonPool">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Aktiviert persistente JVM-Prozesse für Saxon-Transformationen.
|
|
||||||
Vorteile: Bis zu 10x schneller durch Eliminierung von JVM-Startup-Overhead
|
|
||||||
Nachteile: Benötigt JDK (javac) - funktioniert nicht mit JRE allein
|
|
||||||
|
|
||||||
Deaktivieren Sie diese Option, wenn:
|
|
||||||
• Sie nur ein JRE (keine JDK) installiert haben
|
|
||||||
• Sie Probleme mit dem Worker-Pool haben
|
|
||||||
• Sie die Funktion testen möchten</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>SaxonWorkerPool verwenden (empfohlen)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayoutXsltVersion">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelXsltVersion">
|
|
||||||
<property name="text">
|
|
||||||
<string>XSLT-Version:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBoxXsltVersion">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Wählen Sie die XSLT-Version für Saxon-Transformationen:
|
|
||||||
|
|
||||||
XSLT 1.0 (JAXP): Verwendet die JAXP Transformer API
|
|
||||||
• Nur für XSLT 1.0 vollständig spezifiziert
|
|
||||||
• Kann bei XSLT 2.0/3.0 zu fehlerhaften Ausgaben führen
|
|
||||||
|
|
||||||
XSLT 2.0/3.0 (s9api): Verwendet die Saxon s9api
|
|
||||||
• Vollständige Unterstützung für XSLT 2.0 und 3.0
|
|
||||||
• Empfohlen für moderne XSLT-Stylesheets</string>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>XSLT 1.0 (JAXP)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>XSLT 2.0/3.0 (s9api) - Empfohlen</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacerXsltVersion">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelSaxonPoolInfo">
|
|
||||||
<property name="text">
|
|
||||||
<string><i>Hinweis: SaxonWorkerPool benötigt ein JDK (Java Development Kit).<br>Mit JRE allein werden Transformationen im Fallback-Modus ausgeführt.</i></string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBoxFopPool">
|
|
||||||
<property name="title">
|
|
||||||
<string>FopWorkerPool Einstellungen</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxUseFopPool">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Aktiviert persistente JVM-Prozesse für Apache FOP PDF-Generierung.
|
|
||||||
Vorteile: Bis zu 10x schneller durch Eliminierung von JVM-Startup-Overhead
|
|
||||||
Nachteile: Benötigt JDK (javac) - funktioniert nicht mit JRE allein
|
|
||||||
|
|
||||||
Deaktivieren Sie diese Option, wenn:
|
|
||||||
• Sie nur ein JRE (keine JDK) installiert haben
|
|
||||||
• Sie Probleme mit dem Worker-Pool haben
|
|
||||||
• Sie die Funktion testen möchten</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>FopWorkerPool verwenden (empfohlen)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelFopPoolInfo">
|
|
||||||
<property name="text">
|
|
||||||
<string><i>Hinweis: FopWorkerPool benötigt ein JDK (Java Development Kit).<br>Mit JRE allein werden PDFs im Fallback-Modus generiert.</i></string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="mouseTracking">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string><html><head/><body><p><span style=" font-weight:700; font-style:italic;">Hinweis: Änderungen in diesem Dialog sind unter Umständen erst nach neu start der Anwendung wirksam.</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacerPerformance">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Form generated from reading UI file 'AppSettings.ui'
|
## Form generated from reading UI file 'AppSettings.ui'
|
||||||
##
|
##
|
||||||
## Created by: Qt User Interface Compiler version 6.9.2
|
## Created by: Qt User Interface Compiler version 6.9.1
|
||||||
##
|
##
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -15,17 +15,16 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
|||||||
QFont, QFontDatabase, QGradient, QIcon,
|
QFont, QFontDatabase, QGradient, QIcon,
|
||||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||||
from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QComboBox,
|
from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox,
|
||||||
QDialog, QDialogButtonBox, QFrame, QGroupBox,
|
QFrame, QHBoxLayout, QHeaderView, QPushButton,
|
||||||
QHBoxLayout, QHeaderView, QLabel, QPushButton,
|
QSizePolicy, QTabWidget, QTableWidget, QTableWidgetItem,
|
||||||
QSizePolicy, QSpacerItem, QSpinBox, QTabWidget,
|
QVBoxLayout, QWidget)
|
||||||
QTableWidget, QTableWidgetItem, QVBoxLayout, QWidget)
|
|
||||||
|
|
||||||
class Ui_Dialog(object):
|
class Ui_Dialog(object):
|
||||||
def setupUi(self, Dialog):
|
def setupUi(self, Dialog):
|
||||||
if not Dialog.objectName():
|
if not Dialog.objectName():
|
||||||
Dialog.setObjectName(u"Dialog")
|
Dialog.setObjectName(u"Dialog")
|
||||||
Dialog.resize(833, 526)
|
Dialog.resize(833, 387)
|
||||||
self.verticalLayout = QVBoxLayout(Dialog)
|
self.verticalLayout = QVBoxLayout(Dialog)
|
||||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||||
self.tabSettings = QTabWidget(Dialog)
|
self.tabSettings = QTabWidget(Dialog)
|
||||||
@@ -303,104 +302,6 @@ class Ui_Dialog(object):
|
|||||||
self.verticalLayout_7.addWidget(self.frame_6)
|
self.verticalLayout_7.addWidget(self.frame_6)
|
||||||
|
|
||||||
self.tabSettings.addTab(self.tabPdfProject, "")
|
self.tabSettings.addTab(self.tabPdfProject, "")
|
||||||
self.tabPerformance = QWidget()
|
|
||||||
self.tabPerformance.setObjectName(u"tabPerformance")
|
|
||||||
self.verticalLayout_9 = QVBoxLayout(self.tabPerformance)
|
|
||||||
self.verticalLayout_9.setObjectName(u"verticalLayout_9")
|
|
||||||
self.groupBoxWorker = QGroupBox(self.tabPerformance)
|
|
||||||
self.groupBoxWorker.setObjectName(u"groupBoxWorker")
|
|
||||||
self.verticalLayout_10 = QVBoxLayout(self.groupBoxWorker)
|
|
||||||
self.verticalLayout_10.setObjectName(u"verticalLayout_10")
|
|
||||||
self.labelWorkerCount = QLabel(self.groupBoxWorker)
|
|
||||||
self.labelWorkerCount.setObjectName(u"labelWorkerCount")
|
|
||||||
|
|
||||||
self.verticalLayout_10.addWidget(self.labelWorkerCount)
|
|
||||||
|
|
||||||
self.spinBoxWorkerCount = QSpinBox(self.groupBoxWorker)
|
|
||||||
self.spinBoxWorkerCount.setObjectName(u"spinBoxWorkerCount")
|
|
||||||
self.spinBoxWorkerCount.setMinimum(1)
|
|
||||||
self.spinBoxWorkerCount.setMaximum(32)
|
|
||||||
self.spinBoxWorkerCount.setValue(8)
|
|
||||||
|
|
||||||
self.verticalLayout_10.addWidget(self.spinBoxWorkerCount)
|
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout_9.addWidget(self.groupBoxWorker)
|
|
||||||
|
|
||||||
self.groupBoxSaxonPool = QGroupBox(self.tabPerformance)
|
|
||||||
self.groupBoxSaxonPool.setObjectName(u"groupBoxSaxonPool")
|
|
||||||
self.verticalLayout_11 = QVBoxLayout(self.groupBoxSaxonPool)
|
|
||||||
self.verticalLayout_11.setObjectName(u"verticalLayout_11")
|
|
||||||
self.checkBoxUseSaxonPool = QCheckBox(self.groupBoxSaxonPool)
|
|
||||||
self.checkBoxUseSaxonPool.setObjectName(u"checkBoxUseSaxonPool")
|
|
||||||
|
|
||||||
self.verticalLayout_11.addWidget(self.checkBoxUseSaxonPool)
|
|
||||||
|
|
||||||
self.horizontalLayoutXsltVersion = QHBoxLayout()
|
|
||||||
self.horizontalLayoutXsltVersion.setObjectName(u"horizontalLayoutXsltVersion")
|
|
||||||
self.labelXsltVersion = QLabel(self.groupBoxSaxonPool)
|
|
||||||
self.labelXsltVersion.setObjectName(u"labelXsltVersion")
|
|
||||||
|
|
||||||
self.horizontalLayoutXsltVersion.addWidget(self.labelXsltVersion)
|
|
||||||
|
|
||||||
self.comboBoxXsltVersion = QComboBox(self.groupBoxSaxonPool)
|
|
||||||
self.comboBoxXsltVersion.addItem("")
|
|
||||||
self.comboBoxXsltVersion.addItem("")
|
|
||||||
self.comboBoxXsltVersion.setObjectName(u"comboBoxXsltVersion")
|
|
||||||
|
|
||||||
self.horizontalLayoutXsltVersion.addWidget(self.comboBoxXsltVersion)
|
|
||||||
|
|
||||||
self.horizontalSpacerXsltVersion = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
|
||||||
|
|
||||||
self.horizontalLayoutXsltVersion.addItem(self.horizontalSpacerXsltVersion)
|
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout_11.addLayout(self.horizontalLayoutXsltVersion)
|
|
||||||
|
|
||||||
self.labelSaxonPoolInfo = QLabel(self.groupBoxSaxonPool)
|
|
||||||
self.labelSaxonPoolInfo.setObjectName(u"labelSaxonPoolInfo")
|
|
||||||
self.labelSaxonPoolInfo.setWordWrap(True)
|
|
||||||
|
|
||||||
self.verticalLayout_11.addWidget(self.labelSaxonPoolInfo)
|
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout_9.addWidget(self.groupBoxSaxonPool)
|
|
||||||
|
|
||||||
self.groupBoxFopPool = QGroupBox(self.tabPerformance)
|
|
||||||
self.groupBoxFopPool.setObjectName(u"groupBoxFopPool")
|
|
||||||
self.verticalLayout_12 = QVBoxLayout(self.groupBoxFopPool)
|
|
||||||
self.verticalLayout_12.setObjectName(u"verticalLayout_12")
|
|
||||||
self.checkBoxUseFopPool = QCheckBox(self.groupBoxFopPool)
|
|
||||||
self.checkBoxUseFopPool.setObjectName(u"checkBoxUseFopPool")
|
|
||||||
|
|
||||||
self.verticalLayout_12.addWidget(self.checkBoxUseFopPool)
|
|
||||||
|
|
||||||
self.labelFopPoolInfo = QLabel(self.groupBoxFopPool)
|
|
||||||
self.labelFopPoolInfo.setObjectName(u"labelFopPoolInfo")
|
|
||||||
self.labelFopPoolInfo.setWordWrap(True)
|
|
||||||
|
|
||||||
self.verticalLayout_12.addWidget(self.labelFopPoolInfo)
|
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout_9.addWidget(self.groupBoxFopPool)
|
|
||||||
|
|
||||||
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
|
|
||||||
|
|
||||||
self.verticalLayout_9.addItem(self.verticalSpacer)
|
|
||||||
|
|
||||||
self.label = QLabel(self.tabPerformance)
|
|
||||||
self.label.setObjectName(u"label")
|
|
||||||
self.label.setMouseTracking(True)
|
|
||||||
self.label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
||||||
self.label.setWordWrap(True)
|
|
||||||
|
|
||||||
self.verticalLayout_9.addWidget(self.label)
|
|
||||||
|
|
||||||
self.verticalSpacerPerformance = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
|
|
||||||
|
|
||||||
self.verticalLayout_9.addItem(self.verticalSpacerPerformance)
|
|
||||||
|
|
||||||
self.tabSettings.addTab(self.tabPerformance, "")
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.tabSettings)
|
self.verticalLayout.addWidget(self.tabSettings)
|
||||||
|
|
||||||
@@ -446,53 +347,5 @@ class Ui_Dialog(object):
|
|||||||
self.addProject.setText(QCoreApplication.translate("Dialog", u"Hinzuf\u00fcgen", None))
|
self.addProject.setText(QCoreApplication.translate("Dialog", u"Hinzuf\u00fcgen", None))
|
||||||
self.removeProject.setText(QCoreApplication.translate("Dialog", u"Entfernen", None))
|
self.removeProject.setText(QCoreApplication.translate("Dialog", u"Entfernen", None))
|
||||||
self.tabSettings.setTabText(self.tabSettings.indexOf(self.tabPdfProject), QCoreApplication.translate("Dialog", u"PDF-Projekte", None))
|
self.tabSettings.setTabText(self.tabSettings.indexOf(self.tabPdfProject), QCoreApplication.translate("Dialog", u"PDF-Projekte", None))
|
||||||
self.groupBoxWorker.setTitle(QCoreApplication.translate("Dialog", u"ThreadPoolExecutor Einstellungen", None))
|
|
||||||
self.labelWorkerCount.setText(QCoreApplication.translate("Dialog", u"Anzahl paralleler Worker f\u00fcr Transformationen:", None))
|
|
||||||
#if QT_CONFIG(tooltip)
|
|
||||||
self.spinBoxWorkerCount.setToolTip(QCoreApplication.translate("Dialog", u"Anzahl der parallelen Worker-Threads f\u00fcr Transformationen (Standard: 8)", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.groupBoxSaxonPool.setTitle(QCoreApplication.translate("Dialog", u"SaxonWorkerPool Einstellungen", None))
|
|
||||||
#if QT_CONFIG(tooltip)
|
|
||||||
self.checkBoxUseSaxonPool.setToolTip(QCoreApplication.translate("Dialog", u"Aktiviert persistente JVM-Prozesse f\u00fcr Saxon-Transformationen.\n"
|
|
||||||
"Vorteile: Bis zu 10x schneller durch Eliminierung von JVM-Startup-Overhead\n"
|
|
||||||
"Nachteile: Ben\u00f6tigt JDK (javac) - funktioniert nicht mit JRE allein\n"
|
|
||||||
"\n"
|
|
||||||
"Deaktivieren Sie diese Option, wenn:\n"
|
|
||||||
"\u2022 Sie nur ein JRE (keine JDK) installiert haben\n"
|
|
||||||
"\u2022 Sie Probleme mit dem Worker-Pool haben\n"
|
|
||||||
"\u2022 Sie die Funktion testen m\u00f6chten", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.checkBoxUseSaxonPool.setText(QCoreApplication.translate("Dialog", u"SaxonWorkerPool verwenden (empfohlen)", None))
|
|
||||||
self.labelXsltVersion.setText(QCoreApplication.translate("Dialog", u"XSLT-Version:", None))
|
|
||||||
self.comboBoxXsltVersion.setItemText(0, QCoreApplication.translate("Dialog", u"XSLT 1.0 (JAXP)", None))
|
|
||||||
self.comboBoxXsltVersion.setItemText(1, QCoreApplication.translate("Dialog", u"XSLT 2.0/3.0 (s9api) - Empfohlen", None))
|
|
||||||
|
|
||||||
#if QT_CONFIG(tooltip)
|
|
||||||
self.comboBoxXsltVersion.setToolTip(QCoreApplication.translate("Dialog", u"W\u00e4hlen Sie die XSLT-Version f\u00fcr Saxon-Transformationen:\n"
|
|
||||||
"\n"
|
|
||||||
"XSLT 1.0 (JAXP): Verwendet die JAXP Transformer API\n"
|
|
||||||
"\u2022 Nur f\u00fcr XSLT 1.0 vollst\u00e4ndig spezifiziert\n"
|
|
||||||
"\u2022 Kann bei XSLT 2.0/3.0 zu fehlerhaften Ausgaben f\u00fchren\n"
|
|
||||||
"\n"
|
|
||||||
"XSLT 2.0/3.0 (s9api): Verwendet die Saxon s9api\n"
|
|
||||||
"\u2022 Vollst\u00e4ndige Unterst\u00fctzung f\u00fcr XSLT 2.0 und 3.0\n"
|
|
||||||
"\u2022 Empfohlen f\u00fcr moderne XSLT-Stylesheets", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.labelSaxonPoolInfo.setText(QCoreApplication.translate("Dialog", u"<i>Hinweis: SaxonWorkerPool ben\u00f6tigt ein JDK (Java Development Kit).<br>Mit JRE allein werden Transformationen im Fallback-Modus ausgef\u00fchrt.</i>", None))
|
|
||||||
self.groupBoxFopPool.setTitle(QCoreApplication.translate("Dialog", u"FopWorkerPool Einstellungen", None))
|
|
||||||
#if QT_CONFIG(tooltip)
|
|
||||||
self.checkBoxUseFopPool.setToolTip(QCoreApplication.translate("Dialog", u"Aktiviert persistente JVM-Prozesse f\u00fcr Apache FOP PDF-Generierung.\n"
|
|
||||||
"Vorteile: Bis zu 10x schneller durch Eliminierung von JVM-Startup-Overhead\n"
|
|
||||||
"Nachteile: Ben\u00f6tigt JDK (javac) - funktioniert nicht mit JRE allein\n"
|
|
||||||
"\n"
|
|
||||||
"Deaktivieren Sie diese Option, wenn:\n"
|
|
||||||
"\u2022 Sie nur ein JRE (keine JDK) installiert haben\n"
|
|
||||||
"\u2022 Sie Probleme mit dem Worker-Pool haben\n"
|
|
||||||
"\u2022 Sie die Funktion testen m\u00f6chten", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.checkBoxUseFopPool.setText(QCoreApplication.translate("Dialog", u"FopWorkerPool verwenden (empfohlen)", None))
|
|
||||||
self.labelFopPoolInfo.setText(QCoreApplication.translate("Dialog", u"<i>Hinweis: FopWorkerPool ben\u00f6tigt ein JDK (Java Development Kit).<br>Mit JRE allein werden PDFs im Fallback-Modus generiert.</i>", None))
|
|
||||||
self.label.setText(QCoreApplication.translate("Dialog", u"<html><head/><body><p><span style=\" font-weight:700; font-style:italic;\">Hinweis: \u00c4nderungen in diesem Dialog sind unter Umst\u00e4nden erst nach neu start der Anwendung wirksam.</span></p></body></html>", None))
|
|
||||||
self.tabSettings.setTabText(self.tabSettings.indexOf(self.tabPerformance), QCoreApplication.translate("Dialog", u"Performance", None))
|
|
||||||
# retranslateUi
|
# retranslateUi
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1263</width>
|
<width>1263</width>
|
||||||
<height>779</height>
|
<height>774</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -61,26 +61,6 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="projectPath">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QLabel { padding: 5px; font-weight: bold; }</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Kein Projekt geladen</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="searchEdit">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Knoten oder XSL-Datei filtern...</string>
|
|
||||||
</property>
|
|
||||||
<property name="clearButtonEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="treeWidget">
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -89,18 +69,8 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QTreeWidget::item {
|
|
||||||
padding: 4px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTreeWidget::item:selected {
|
|
||||||
background-color: palette(highlight);
|
|
||||||
color: palette(highlighted-text);
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="columnCount">
|
<property name="columnCount">
|
||||||
<number>2</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="headerHighlightSections">
|
<attribute name="headerHighlightSections">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -118,6 +88,81 @@ QTreeWidget::item:selected {
|
|||||||
<string notr="true">2</string>
|
<string notr="true">2</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">3</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_2">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Shadow::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LayoutDirection::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>nur geänderte generieren</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="QIcon::ThemeIcon::MediaPlaybackStart"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Alle generieren</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="QIcon::ThemeIcon::MediaSeekForward"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pB_lade_aus_fn2">
|
||||||
|
<property name="text">
|
||||||
|
<string>lade aus FN2</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="QIcon::ThemeIcon::GoDown"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -144,7 +189,7 @@ QTreeWidget::item:selected {
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>68</width>
|
<width>68</width>
|
||||||
<height>733</height>
|
<height>728</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@@ -233,26 +278,14 @@ QTreeWidget::item:selected {
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="view_ref_pdf">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Vorher (Referenz)</string>
|
<string>Vorher (Referenz)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="QIcon::ThemeIcon::DocumentOpen"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="alpha">
|
<widget class="QSlider" name="alpha">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Blendet zwischen Referenz-PDF (links) und neuer PDF (rechts) um. Doppelklick setzt auf Mitte zurück.</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-100</number>
|
<number>-100</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -265,16 +298,10 @@ QTreeWidget::item:selected {
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="view_new_pdf">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Nachher (Neu)</string>
|
<string>Nachher (Neu)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="QIcon::ThemeIcon::DocumentOpen"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -299,12 +326,6 @@ QTreeWidget::item:selected {
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="zoom">
|
<widget class="QSlider" name="zoom">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Vergrößert oder verkleinert die PDF-Ansicht (25% bis 300%). Doppelklick setzt auf 100% zurück.</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>25</number>
|
<number>25</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -338,10 +359,7 @@ QTreeWidget::item:selected {
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Änderungen übernehmen</string>
|
<string>✅ Änderungen übernehmen</string>
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="emblem-default"/>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -363,9 +381,6 @@ QTreeWidget::item:selected {
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea_2">
|
<widget class="QScrollArea" name="scrollArea_2">
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::Shape::NoFrame</enum>
|
<enum>QFrame::Shape::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -380,8 +395,8 @@ QTreeWidget::item:selected {
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>892</width>
|
<width>726</width>
|
||||||
<height>702</height>
|
<height>697</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
@@ -433,20 +448,7 @@ QTreeWidget::item:selected {
|
|||||||
<string>Thema</string>
|
<string>Thema</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuAktion">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Aktion</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionAlle_XML_Dateien_transformieren"/>
|
|
||||||
<addaction name="actionAlle_XML_Dateien_neu_transformieren_force"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionAus_Datenbank_laden"/>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menuProjekt"/>
|
<addaction name="menuProjekt"/>
|
||||||
<addaction name="menuAktion"/>
|
|
||||||
<addaction name="menuThema"/>
|
<addaction name="menuThema"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
@@ -484,36 +486,10 @@ QTreeWidget::item:selected {
|
|||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="folder-open"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Vorhandene Projekte</string>
|
<string>Vorhandene Projekte</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAlle_XML_Dateien_transformieren">
|
|
||||||
<property name="text">
|
|
||||||
<string>Alle XML-Dateien transformieren</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAlle_XML_Dateien_neu_transformieren_force">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="QIcon::ThemeIcon::ViewRefresh"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Alle XML-Dateien neu transformieren (force)</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionFN2">
|
|
||||||
<property name="text">
|
|
||||||
<string>FN2</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAus_Datenbank_laden">
|
|
||||||
<property name="text">
|
|
||||||
<string>Aus Datenbank laden</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Form generated from reading UI file 'MainWinddow.ui'
|
## Form generated from reading UI file 'MainWinddow.ui'
|
||||||
##
|
##
|
||||||
## Created by: Qt User Interface Compiler version 6.10.1
|
## Created by: Qt User Interface Compiler version 6.9.2
|
||||||
##
|
##
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -17,10 +17,10 @@ from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
|
|||||||
QPainter, QPalette, QPixmap, QRadialGradient,
|
QPainter, QPalette, QPixmap, QRadialGradient,
|
||||||
QTransform)
|
QTransform)
|
||||||
from PySide6.QtWidgets import (QApplication, QFrame, QHBoxLayout, QHeaderView,
|
from PySide6.QtWidgets import (QApplication, QFrame, QHBoxLayout, QHeaderView,
|
||||||
QLabel, QLineEdit, QMainWindow, QMenu,
|
QLabel, QMainWindow, QMenu, QMenuBar,
|
||||||
QMenuBar, QPushButton, QScrollArea, QSizePolicy,
|
QPushButton, QScrollArea, QSizePolicy, QSlider,
|
||||||
QSlider, QSpacerItem, QSplitter, QStatusBar,
|
QSpacerItem, QSplitter, QStatusBar, QTreeWidget,
|
||||||
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget)
|
QTreeWidgetItem, QVBoxLayout, QWidget)
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
@@ -42,18 +42,6 @@ class Ui_MainWindow(object):
|
|||||||
self.actionVorhandene_Projekte = QAction(MainWindow)
|
self.actionVorhandene_Projekte = QAction(MainWindow)
|
||||||
self.actionVorhandene_Projekte.setObjectName(u"actionVorhandene_Projekte")
|
self.actionVorhandene_Projekte.setObjectName(u"actionVorhandene_Projekte")
|
||||||
self.actionVorhandene_Projekte.setEnabled(False)
|
self.actionVorhandene_Projekte.setEnabled(False)
|
||||||
icon3 = QIcon(QIcon.fromTheme(u"folder-open"))
|
|
||||||
self.actionVorhandene_Projekte.setIcon(icon3)
|
|
||||||
self.actionAlle_XML_Dateien_transformieren = QAction(MainWindow)
|
|
||||||
self.actionAlle_XML_Dateien_transformieren.setObjectName(u"actionAlle_XML_Dateien_transformieren")
|
|
||||||
self.actionAlle_XML_Dateien_neu_transformieren_force = QAction(MainWindow)
|
|
||||||
self.actionAlle_XML_Dateien_neu_transformieren_force.setObjectName(u"actionAlle_XML_Dateien_neu_transformieren_force")
|
|
||||||
icon4 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.ViewRefresh))
|
|
||||||
self.actionAlle_XML_Dateien_neu_transformieren_force.setIcon(icon4)
|
|
||||||
self.actionFN2 = QAction(MainWindow)
|
|
||||||
self.actionFN2.setObjectName(u"actionFN2")
|
|
||||||
self.actionAus_Datenbank_laden = QAction(MainWindow)
|
|
||||||
self.actionAus_Datenbank_laden.setObjectName(u"actionAus_Datenbank_laden")
|
|
||||||
self.centralwidget = QWidget(MainWindow)
|
self.centralwidget = QWidget(MainWindow)
|
||||||
self.centralwidget.setObjectName(u"centralwidget")
|
self.centralwidget.setObjectName(u"centralwidget")
|
||||||
self.horizontalLayout = QHBoxLayout(self.centralwidget)
|
self.horizontalLayout = QHBoxLayout(self.centralwidget)
|
||||||
@@ -77,20 +65,9 @@ class Ui_MainWindow(object):
|
|||||||
self.verticalLayout = QVBoxLayout(self.frame)
|
self.verticalLayout = QVBoxLayout(self.frame)
|
||||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||||
self.verticalLayout.setContentsMargins(-1, -1, -1, 0)
|
self.verticalLayout.setContentsMargins(-1, -1, -1, 0)
|
||||||
self.projectPath = QLabel(self.frame)
|
|
||||||
self.projectPath.setObjectName(u"projectPath")
|
|
||||||
self.projectPath.setStyleSheet(u"QLabel { padding: 5px; font-weight: bold; }")
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.projectPath)
|
|
||||||
|
|
||||||
self.searchEdit = QLineEdit(self.frame)
|
|
||||||
self.searchEdit.setObjectName(u"searchEdit")
|
|
||||||
self.searchEdit.setClearButtonEnabled(True)
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.searchEdit)
|
|
||||||
|
|
||||||
self.treeWidget = QTreeWidget(self.frame)
|
self.treeWidget = QTreeWidget(self.frame)
|
||||||
__qtreewidgetitem = QTreeWidgetItem()
|
__qtreewidgetitem = QTreeWidgetItem()
|
||||||
|
__qtreewidgetitem.setText(2, u"3");
|
||||||
__qtreewidgetitem.setText(1, u"2");
|
__qtreewidgetitem.setText(1, u"2");
|
||||||
__qtreewidgetitem.setText(0, u"1");
|
__qtreewidgetitem.setText(0, u"1");
|
||||||
self.treeWidget.setHeaderItem(__qtreewidgetitem)
|
self.treeWidget.setHeaderItem(__qtreewidgetitem)
|
||||||
@@ -100,20 +77,48 @@ class Ui_MainWindow(object):
|
|||||||
sizePolicy1.setVerticalStretch(0)
|
sizePolicy1.setVerticalStretch(0)
|
||||||
sizePolicy1.setHeightForWidth(self.treeWidget.sizePolicy().hasHeightForWidth())
|
sizePolicy1.setHeightForWidth(self.treeWidget.sizePolicy().hasHeightForWidth())
|
||||||
self.treeWidget.setSizePolicy(sizePolicy1)
|
self.treeWidget.setSizePolicy(sizePolicy1)
|
||||||
self.treeWidget.setStyleSheet(u"QTreeWidget::item {\n"
|
self.treeWidget.setColumnCount(3)
|
||||||
" padding: 4px 4px;\n"
|
|
||||||
"}\n"
|
|
||||||
"\n"
|
|
||||||
"QTreeWidget::item:selected {\n"
|
|
||||||
" background-color: palette(highlight);\n"
|
|
||||||
" color: palette(highlighted-text);\n"
|
|
||||||
"}")
|
|
||||||
self.treeWidget.setColumnCount(2)
|
|
||||||
self.treeWidget.header().setHighlightSections(True)
|
self.treeWidget.header().setHighlightSections(True)
|
||||||
self.treeWidget.header().setStretchLastSection(True)
|
self.treeWidget.header().setStretchLastSection(True)
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.treeWidget)
|
self.verticalLayout.addWidget(self.treeWidget)
|
||||||
|
|
||||||
|
self.frame_2 = QFrame(self.frame)
|
||||||
|
self.frame_2.setObjectName(u"frame_2")
|
||||||
|
self.frame_2.setFrameShadow(QFrame.Shadow.Raised)
|
||||||
|
self.horizontalLayout_2 = QHBoxLayout(self.frame_2)
|
||||||
|
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
||||||
|
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.pushButton = QPushButton(self.frame_2)
|
||||||
|
self.pushButton.setObjectName(u"pushButton")
|
||||||
|
self.pushButton.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
|
||||||
|
icon3 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStart))
|
||||||
|
self.pushButton.setIcon(icon3)
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addWidget(self.pushButton)
|
||||||
|
|
||||||
|
self.pushButton_2 = QPushButton(self.frame_2)
|
||||||
|
self.pushButton_2.setObjectName(u"pushButton_2")
|
||||||
|
self.pushButton_2.setAutoFillBackground(False)
|
||||||
|
icon4 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.MediaSeekForward))
|
||||||
|
self.pushButton_2.setIcon(icon4)
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addWidget(self.pushButton_2)
|
||||||
|
|
||||||
|
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addItem(self.horizontalSpacer)
|
||||||
|
|
||||||
|
self.pB_lade_aus_fn2 = QPushButton(self.frame_2)
|
||||||
|
self.pB_lade_aus_fn2.setObjectName(u"pB_lade_aus_fn2")
|
||||||
|
icon5 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.GoDown))
|
||||||
|
self.pB_lade_aus_fn2.setIcon(icon5)
|
||||||
|
|
||||||
|
self.horizontalLayout_2.addWidget(self.pB_lade_aus_fn2)
|
||||||
|
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.frame_2)
|
||||||
|
|
||||||
self.splitter.addWidget(self.frame)
|
self.splitter.addWidget(self.frame)
|
||||||
self.scrollArea = QScrollArea(self.splitter)
|
self.scrollArea = QScrollArea(self.splitter)
|
||||||
self.scrollArea.setObjectName(u"scrollArea")
|
self.scrollArea.setObjectName(u"scrollArea")
|
||||||
@@ -164,29 +169,23 @@ class Ui_MainWindow(object):
|
|||||||
|
|
||||||
self.horizontalLayout_3.addItem(self.horizontalSpacer_4)
|
self.horizontalLayout_3.addItem(self.horizontalSpacer_4)
|
||||||
|
|
||||||
self.view_ref_pdf = QPushButton(self.frame_4)
|
self.label_6 = QLabel(self.frame_4)
|
||||||
self.view_ref_pdf.setObjectName(u"view_ref_pdf")
|
self.label_6.setObjectName(u"label_6")
|
||||||
self.view_ref_pdf.setEnabled(False)
|
|
||||||
icon5 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.DocumentOpen))
|
|
||||||
self.view_ref_pdf.setIcon(icon5)
|
|
||||||
|
|
||||||
self.horizontalLayout_3.addWidget(self.view_ref_pdf)
|
self.horizontalLayout_3.addWidget(self.label_6)
|
||||||
|
|
||||||
self.alpha = QSlider(self.frame_4)
|
self.alpha = QSlider(self.frame_4)
|
||||||
self.alpha.setObjectName(u"alpha")
|
self.alpha.setObjectName(u"alpha")
|
||||||
self.alpha.setEnabled(False)
|
|
||||||
self.alpha.setMinimum(-100)
|
self.alpha.setMinimum(-100)
|
||||||
self.alpha.setMaximum(100)
|
self.alpha.setMaximum(100)
|
||||||
self.alpha.setOrientation(Qt.Orientation.Horizontal)
|
self.alpha.setOrientation(Qt.Orientation.Horizontal)
|
||||||
|
|
||||||
self.horizontalLayout_3.addWidget(self.alpha)
|
self.horizontalLayout_3.addWidget(self.alpha)
|
||||||
|
|
||||||
self.view_new_pdf = QPushButton(self.frame_4)
|
self.label_7 = QLabel(self.frame_4)
|
||||||
self.view_new_pdf.setObjectName(u"view_new_pdf")
|
self.label_7.setObjectName(u"label_7")
|
||||||
self.view_new_pdf.setEnabled(False)
|
|
||||||
self.view_new_pdf.setIcon(icon5)
|
|
||||||
|
|
||||||
self.horizontalLayout_3.addWidget(self.view_new_pdf)
|
self.horizontalLayout_3.addWidget(self.label_7)
|
||||||
|
|
||||||
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
||||||
|
|
||||||
@@ -199,7 +198,6 @@ class Ui_MainWindow(object):
|
|||||||
|
|
||||||
self.zoom = QSlider(self.frame_4)
|
self.zoom = QSlider(self.frame_4)
|
||||||
self.zoom.setObjectName(u"zoom")
|
self.zoom.setObjectName(u"zoom")
|
||||||
self.zoom.setEnabled(False)
|
|
||||||
self.zoom.setMinimum(25)
|
self.zoom.setMinimum(25)
|
||||||
self.zoom.setMaximum(300)
|
self.zoom.setMaximum(300)
|
||||||
self.zoom.setValue(100)
|
self.zoom.setValue(100)
|
||||||
@@ -214,8 +212,6 @@ class Ui_MainWindow(object):
|
|||||||
self.accept_changes = QPushButton(self.frame_4)
|
self.accept_changes = QPushButton(self.frame_4)
|
||||||
self.accept_changes.setObjectName(u"accept_changes")
|
self.accept_changes.setObjectName(u"accept_changes")
|
||||||
self.accept_changes.setEnabled(False)
|
self.accept_changes.setEnabled(False)
|
||||||
icon6 = QIcon(QIcon.fromTheme(u"emblem-default"))
|
|
||||||
self.accept_changes.setIcon(icon6)
|
|
||||||
|
|
||||||
self.horizontalLayout_3.addWidget(self.accept_changes)
|
self.horizontalLayout_3.addWidget(self.accept_changes)
|
||||||
|
|
||||||
@@ -228,13 +224,12 @@ class Ui_MainWindow(object):
|
|||||||
|
|
||||||
self.scrollArea_2 = QScrollArea(self.frame_3)
|
self.scrollArea_2 = QScrollArea(self.frame_3)
|
||||||
self.scrollArea_2.setObjectName(u"scrollArea_2")
|
self.scrollArea_2.setObjectName(u"scrollArea_2")
|
||||||
self.scrollArea_2.setEnabled(True)
|
|
||||||
self.scrollArea_2.setFrameShape(QFrame.Shape.NoFrame)
|
self.scrollArea_2.setFrameShape(QFrame.Shape.NoFrame)
|
||||||
self.scrollArea_2.setFrameShadow(QFrame.Shadow.Raised)
|
self.scrollArea_2.setFrameShadow(QFrame.Shadow.Raised)
|
||||||
self.scrollArea_2.setWidgetResizable(True)
|
self.scrollArea_2.setWidgetResizable(True)
|
||||||
self.scrollAreaWidgetContents_2 = QWidget()
|
self.scrollAreaWidgetContents_2 = QWidget()
|
||||||
self.scrollAreaWidgetContents_2.setObjectName(u"scrollAreaWidgetContents_2")
|
self.scrollAreaWidgetContents_2.setObjectName(u"scrollAreaWidgetContents_2")
|
||||||
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 880, 697))
|
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 726, 697))
|
||||||
self.verticalLayout_3 = QVBoxLayout(self.scrollAreaWidgetContents_2)
|
self.verticalLayout_3 = QVBoxLayout(self.scrollAreaWidgetContents_2)
|
||||||
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
||||||
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
@@ -254,16 +249,12 @@ class Ui_MainWindow(object):
|
|||||||
self.menuProjekt.setObjectName(u"menuProjekt")
|
self.menuProjekt.setObjectName(u"menuProjekt")
|
||||||
self.menuThema = QMenu(self.menubar)
|
self.menuThema = QMenu(self.menubar)
|
||||||
self.menuThema.setObjectName(u"menuThema")
|
self.menuThema.setObjectName(u"menuThema")
|
||||||
self.menuAktion = QMenu(self.menubar)
|
|
||||||
self.menuAktion.setObjectName(u"menuAktion")
|
|
||||||
self.menuAktion.setEnabled(False)
|
|
||||||
MainWindow.setMenuBar(self.menubar)
|
MainWindow.setMenuBar(self.menubar)
|
||||||
self.statusbar = QStatusBar(MainWindow)
|
self.statusbar = QStatusBar(MainWindow)
|
||||||
self.statusbar.setObjectName(u"statusbar")
|
self.statusbar.setObjectName(u"statusbar")
|
||||||
MainWindow.setStatusBar(self.statusbar)
|
MainWindow.setStatusBar(self.statusbar)
|
||||||
|
|
||||||
self.menubar.addAction(self.menuProjekt.menuAction())
|
self.menubar.addAction(self.menuProjekt.menuAction())
|
||||||
self.menubar.addAction(self.menuAktion.menuAction())
|
|
||||||
self.menubar.addAction(self.menuThema.menuAction())
|
self.menubar.addAction(self.menuThema.menuAction())
|
||||||
self.menuProjekt.addAction(self.actionNeu)
|
self.menuProjekt.addAction(self.actionNeu)
|
||||||
self.menuProjekt.addSeparator()
|
self.menuProjekt.addSeparator()
|
||||||
@@ -272,10 +263,6 @@ class Ui_MainWindow(object):
|
|||||||
self.menuProjekt.addAction(self.actionEinstellungen)
|
self.menuProjekt.addAction(self.actionEinstellungen)
|
||||||
self.menuProjekt.addSeparator()
|
self.menuProjekt.addSeparator()
|
||||||
self.menuProjekt.addAction(self.actionBeenden)
|
self.menuProjekt.addAction(self.actionBeenden)
|
||||||
self.menuAktion.addAction(self.actionAlle_XML_Dateien_transformieren)
|
|
||||||
self.menuAktion.addAction(self.actionAlle_XML_Dateien_neu_transformieren_force)
|
|
||||||
self.menuAktion.addSeparator()
|
|
||||||
self.menuAktion.addAction(self.actionAus_Datenbank_laden)
|
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
self.actionBeenden.triggered.connect(MainWindow.close)
|
self.actionBeenden.triggered.connect(MainWindow.close)
|
||||||
@@ -295,26 +282,16 @@ class Ui_MainWindow(object):
|
|||||||
self.actionEinstellungen.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+S", None))
|
self.actionEinstellungen.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+S", None))
|
||||||
#endif // QT_CONFIG(shortcut)
|
#endif // QT_CONFIG(shortcut)
|
||||||
self.actionVorhandene_Projekte.setText(QCoreApplication.translate("MainWindow", u"Vorhandene Projekte", None))
|
self.actionVorhandene_Projekte.setText(QCoreApplication.translate("MainWindow", u"Vorhandene Projekte", None))
|
||||||
self.actionAlle_XML_Dateien_transformieren.setText(QCoreApplication.translate("MainWindow", u"Alle XML-Dateien transformieren", None))
|
self.pushButton.setText(QCoreApplication.translate("MainWindow", u"nur ge\u00e4nderte generieren", None))
|
||||||
self.actionAlle_XML_Dateien_neu_transformieren_force.setText(QCoreApplication.translate("MainWindow", u"Alle XML-Dateien neu transformieren (force)", None))
|
self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"Alle generieren", None))
|
||||||
self.actionFN2.setText(QCoreApplication.translate("MainWindow", u"FN2", None))
|
self.pB_lade_aus_fn2.setText(QCoreApplication.translate("MainWindow", u"lade aus FN2", None))
|
||||||
self.actionAus_Datenbank_laden.setText(QCoreApplication.translate("MainWindow", u"Aus Datenbank laden", None))
|
|
||||||
self.projectPath.setText(QCoreApplication.translate("MainWindow", u"Kein Projekt geladen", None))
|
|
||||||
self.searchEdit.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Knoten oder XSL-Datei filtern...", None))
|
|
||||||
self.label.setText("")
|
self.label.setText("")
|
||||||
self.label_2.setText("")
|
self.label_2.setText("")
|
||||||
self.view_ref_pdf.setText(QCoreApplication.translate("MainWindow", u"Vorher (Referenz)", None))
|
self.label_6.setText(QCoreApplication.translate("MainWindow", u"Vorher (Referenz)", None))
|
||||||
#if QT_CONFIG(tooltip)
|
self.label_7.setText(QCoreApplication.translate("MainWindow", u"Nachher (Neu)", None))
|
||||||
self.alpha.setToolTip(QCoreApplication.translate("MainWindow", u"Blendet zwischen Referenz-PDF (links) und neuer PDF (rechts) um. Doppelklick setzt auf Mitte zur\u00fcck.", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.view_new_pdf.setText(QCoreApplication.translate("MainWindow", u"Nachher (Neu)", None))
|
|
||||||
self.label_5.setText(QCoreApplication.translate("MainWindow", u"Zoom", None))
|
self.label_5.setText(QCoreApplication.translate("MainWindow", u"Zoom", None))
|
||||||
#if QT_CONFIG(tooltip)
|
self.accept_changes.setText(QCoreApplication.translate("MainWindow", u"\u2705 \u00c4nderungen \u00fcbernehmen", None))
|
||||||
self.zoom.setToolTip(QCoreApplication.translate("MainWindow", u"Vergr\u00f6\u00dfert oder verkleinert die PDF-Ansicht (25% bis 300%). Doppelklick setzt auf 100% zur\u00fcck.", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.accept_changes.setText(QCoreApplication.translate("MainWindow", u"\u00c4nderungen \u00fcbernehmen", None))
|
|
||||||
self.menuProjekt.setTitle(QCoreApplication.translate("MainWindow", u"Projekt", None))
|
self.menuProjekt.setTitle(QCoreApplication.translate("MainWindow", u"Projekt", None))
|
||||||
self.menuThema.setTitle(QCoreApplication.translate("MainWindow", u"Thema", None))
|
self.menuThema.setTitle(QCoreApplication.translate("MainWindow", u"Thema", None))
|
||||||
self.menuAktion.setTitle(QCoreApplication.translate("MainWindow", u"Aktion", None))
|
|
||||||
# retranslateUi
|
# retranslateUi
|
||||||
|
|
||||||
|
|||||||
@@ -1,137 +0,0 @@
|
|||||||
"""
|
|
||||||
ObsoleteEntriesDialog — Dialog zur Bestätigung des Entfernens veralteter Projekteinträge.
|
|
||||||
|
|
||||||
Zeigt XslFile-Einträge an, die nicht mehr in der Datenbank vorhanden sind,
|
|
||||||
und lässt den Benutzer entscheiden ob sie entfernt werden sollen.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from PySide6.QtCore import Qt
|
|
||||||
from PySide6.QtWidgets import (
|
|
||||||
QCheckBox,
|
|
||||||
QDialog,
|
|
||||||
QDialogButtonBox,
|
|
||||||
QLabel,
|
|
||||||
QSizePolicy,
|
|
||||||
QTreeWidget,
|
|
||||||
QTreeWidgetItem,
|
|
||||||
QVBoxLayout,
|
|
||||||
)
|
|
||||||
|
|
||||||
from obsolete_detector import ObsoleteGroup
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ObsoleteEntriesDialog(QDialog):
|
|
||||||
"""
|
|
||||||
Dialog zur Anzeige und Bestätigung veralteter Einträge nach einem DB-Import.
|
|
||||||
|
|
||||||
Zeigt die veralteten XslFile-Einträge gruppiert nach ihrer Baumhierarchie an.
|
|
||||||
Der Benutzer kann entscheiden ob die Einträge entfernt und ob nicht mehr
|
|
||||||
verwendete XML-Dateien physisch gelöscht werden sollen.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, parent, obsolete_groups: list[ObsoleteGroup]):
|
|
||||||
"""
|
|
||||||
Args:
|
|
||||||
parent: Eltern-Widget
|
|
||||||
obsolete_groups: Veraltete Einträge gruppiert nach Hierarchiepfad
|
|
||||||
"""
|
|
||||||
super().__init__(parent)
|
|
||||||
self._obsolete_groups = obsolete_groups
|
|
||||||
self._setup_ui()
|
|
||||||
self._populate_tree()
|
|
||||||
|
|
||||||
def _setup_ui(self) -> None:
|
|
||||||
"""Erstellt die UI-Elemente des Dialogs."""
|
|
||||||
total_count = sum(len(g.xsl_entries) for g in self._obsolete_groups)
|
|
||||||
|
|
||||||
self.setWindowTitle("Veraltete Einträge gefunden")
|
|
||||||
self.resize(640, 420)
|
|
||||||
self.setSizeGripEnabled(True)
|
|
||||||
|
|
||||||
layout = QVBoxLayout(self)
|
|
||||||
layout.setSpacing(10)
|
|
||||||
|
|
||||||
# Erklärungstext
|
|
||||||
info_label = QLabel(
|
|
||||||
f"<b>{total_count} XSL-Datei(en)</b> sind nicht mehr in der Datenbank vorhanden "
|
|
||||||
f"und können aus dem Projekt entfernt werden."
|
|
||||||
)
|
|
||||||
info_label.setWordWrap(True)
|
|
||||||
layout.addWidget(info_label)
|
|
||||||
|
|
||||||
# Baumansicht der veralteten Einträge
|
|
||||||
self._tree = QTreeWidget()
|
|
||||||
self._tree.setColumnCount(3)
|
|
||||||
self._tree.setHeaderLabels(["Bezeichnung", "XSL-Datei", "XML-Dateien"])
|
|
||||||
self._tree.setColumnWidth(0, 280)
|
|
||||||
self._tree.setColumnWidth(1, 200)
|
|
||||||
self._tree.setColumnWidth(2, 80)
|
|
||||||
self._tree.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
|
||||||
self._tree.setAlternatingRowColors(True)
|
|
||||||
self._tree.setEditTriggers(QTreeWidget.EditTrigger.NoEditTriggers)
|
|
||||||
layout.addWidget(self._tree)
|
|
||||||
|
|
||||||
# Checkbox für physische XML-Löschung
|
|
||||||
self._delete_xml_checkbox = QCheckBox("Nicht mehr verwendete XML-Dateien physisch löschen")
|
|
||||||
self._delete_xml_checkbox.setChecked(False)
|
|
||||||
layout.addWidget(self._delete_xml_checkbox)
|
|
||||||
|
|
||||||
# Dialog-Buttons
|
|
||||||
self._button_box = QDialogButtonBox()
|
|
||||||
remove_button = self._button_box.addButton(
|
|
||||||
"Veraltete Einträge entfernen", QDialogButtonBox.ButtonRole.AcceptRole
|
|
||||||
)
|
|
||||||
remove_button.setToolTip("Entfernt alle aufgelisteten Einträge aus dem Projekt")
|
|
||||||
self._button_box.addButton(QDialogButtonBox.StandardButton.Cancel)
|
|
||||||
self._button_box.accepted.connect(self.accept)
|
|
||||||
self._button_box.rejected.connect(self.reject)
|
|
||||||
layout.addWidget(self._button_box)
|
|
||||||
|
|
||||||
def _populate_tree(self) -> None:
|
|
||||||
"""Befüllt den QTreeWidget mit den veralteten Einträgen."""
|
|
||||||
self._tree.clear()
|
|
||||||
|
|
||||||
for group in self._obsolete_groups:
|
|
||||||
# Hierarchiepfad als verschachtelte Items aufbauen
|
|
||||||
parent_item = self._tree.invisibleRootItem()
|
|
||||||
for path_part in group.node_path:
|
|
||||||
# Prüfe ob dieser Pfadteil bereits als Kind vorhanden ist
|
|
||||||
existing = None
|
|
||||||
for i in range(parent_item.childCount()):
|
|
||||||
child = parent_item.child(i)
|
|
||||||
if child.text(0) == path_part and not child.data(0, Qt.ItemDataRole.UserRole):
|
|
||||||
existing = child
|
|
||||||
break
|
|
||||||
if existing:
|
|
||||||
parent_item = existing
|
|
||||||
else:
|
|
||||||
node_item = QTreeWidgetItem(parent_item, [path_part])
|
|
||||||
font = node_item.font(0)
|
|
||||||
font.setBold(True)
|
|
||||||
node_item.setFont(0, font)
|
|
||||||
parent_item = node_item
|
|
||||||
|
|
||||||
# XslFile-Einträge unter dem Hierarchiepfad
|
|
||||||
for entry in group.xsl_entries:
|
|
||||||
xsl = entry.xsl_file
|
|
||||||
xml_count = str(len(xsl.xmls)) if xsl.xmls else "0"
|
|
||||||
xsl_item = QTreeWidgetItem(
|
|
||||||
parent_item,
|
|
||||||
[xsl.bez, xsl.xsl_file.name, xml_count],
|
|
||||||
)
|
|
||||||
xsl_item.setData(0, Qt.ItemDataRole.UserRole, xsl)
|
|
||||||
xsl_item.setToolTip(1, str(xsl.xsl_file))
|
|
||||||
|
|
||||||
self._tree.expandAll()
|
|
||||||
|
|
||||||
def delete_xml_files(self) -> bool:
|
|
||||||
"""
|
|
||||||
Gibt zurück ob der Benutzer die physische Löschung der XML-Dateien gewünscht hat.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
True wenn die Checkbox aktiviert ist
|
|
||||||
"""
|
|
||||||
return self._delete_xml_checkbox.isChecked()
|
|
||||||
@@ -5,7 +5,6 @@ from PySide6.QtWidgets import QDialog, QFileDialog, QMessageBox
|
|||||||
|
|
||||||
from conf import app_settings
|
from conf import app_settings
|
||||||
from ui.PdfProject_ui import Ui_projectDlg
|
from ui.PdfProject_ui import Ui_projectDlg
|
||||||
from ui.ProjectXsltParamsDialog import ProjectXsltParamsDialog
|
|
||||||
|
|
||||||
|
|
||||||
class PdfProjectDlg(QDialog):
|
class PdfProjectDlg(QDialog):
|
||||||
@@ -16,7 +15,7 @@ class PdfProjectDlg(QDialog):
|
|||||||
Args:
|
Args:
|
||||||
parent: Übergeordnetes Widget
|
parent: Übergeordnetes Widget
|
||||||
project_data: Bestehende Projektdaten zum Bearbeiten (optional)
|
project_data: Bestehende Projektdaten zum Bearbeiten (optional)
|
||||||
edit_mode: Wenn True, wird der Projekt-Ordner deaktiviert (nur Name und Einstellungen ändern)
|
edit_mode: Wenn True, werden Projekt-Name und -Ordner deaktiviert (nur Einstellungen ändern)
|
||||||
"""
|
"""
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
@@ -27,7 +26,6 @@ class PdfProjectDlg(QDialog):
|
|||||||
# Projektdaten speichern
|
# Projektdaten speichern
|
||||||
self.project_data = project_data or {}
|
self.project_data = project_data or {}
|
||||||
self.edit_mode = edit_mode
|
self.edit_mode = edit_mode
|
||||||
self.xslt_params: dict[str, str] = dict(self.project_data.get("xslt_params", {}))
|
|
||||||
|
|
||||||
# Dialog-Eigenschaften setzen
|
# Dialog-Eigenschaften setzen
|
||||||
self.setModal(True)
|
self.setModal(True)
|
||||||
@@ -55,9 +53,6 @@ class PdfProjectDlg(QDialog):
|
|||||||
# Browse-Button für FOP-Config-Ordner
|
# Browse-Button für FOP-Config-Ordner
|
||||||
self.ui.btnBrowseFopConfig.clicked.connect(self.browse_fop_config_dir)
|
self.ui.btnBrowseFopConfig.clicked.connect(self.browse_fop_config_dir)
|
||||||
|
|
||||||
# XSLT-Parameter bearbeiten
|
|
||||||
self.ui.btnEditXsltParams.clicked.connect(self._edit_xslt_params)
|
|
||||||
|
|
||||||
# OK/Cancel Buttons sind bereits in der UI-Datei verbunden
|
# OK/Cancel Buttons sind bereits in der UI-Datei verbunden
|
||||||
# self.ui.buttonBox.accepted.connect(self.accept)
|
# self.ui.buttonBox.accepted.connect(self.accept)
|
||||||
# self.ui.buttonBox.rejected.connect(self.reject)
|
# self.ui.buttonBox.rejected.connect(self.reject)
|
||||||
@@ -195,12 +190,6 @@ class PdfProjectDlg(QDialog):
|
|||||||
if selected_dir:
|
if selected_dir:
|
||||||
self.ui.lineFopConfigDir.setText(selected_dir)
|
self.ui.lineFopConfigDir.setText(selected_dir)
|
||||||
|
|
||||||
def _edit_xslt_params(self):
|
|
||||||
"""Öffnet den Dialog zur Bearbeitung der projektweiten XSLT-Parameter."""
|
|
||||||
dialog = ProjectXsltParamsDialog(self, self.xslt_params)
|
|
||||||
if dialog.exec() == ProjectXsltParamsDialog.DialogCode.Accepted:
|
|
||||||
self.xslt_params = dialog.get_params()
|
|
||||||
|
|
||||||
def validate_and_accept(self):
|
def validate_and_accept(self):
|
||||||
"""Validiert die Eingaben und akzeptiert den Dialog."""
|
"""Validiert die Eingaben und akzeptiert den Dialog."""
|
||||||
# Projekt-Name prüfen
|
# Projekt-Name prüfen
|
||||||
@@ -280,8 +269,7 @@ class PdfProjectDlg(QDialog):
|
|||||||
'apache_fop_id': self.ui.cB_ApacheFop.currentData(),
|
'apache_fop_id': self.ui.cB_ApacheFop.currentData(),
|
||||||
'diff_pdf_id': self.ui.cB_Diff_Pdf.currentData(),
|
'diff_pdf_id': self.ui.cB_Diff_Pdf.currentData(),
|
||||||
'postgre_sql_db_id': self.ui.cB_Postgres.currentData(),
|
'postgre_sql_db_id': self.ui.cB_Postgres.currentData(),
|
||||||
'fop_config_dir': fop_config_dir if fop_config_dir else None,
|
'fop_config_dir': fop_config_dir if fop_config_dir else None
|
||||||
'xslt_params': self.xslt_params,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _configure_edit_mode(self):
|
def _configure_edit_mode(self):
|
||||||
@@ -303,3 +291,50 @@ class PdfProjectDlg(QDialog):
|
|||||||
self.project_data = project_data
|
self.project_data = project_data
|
||||||
self._load_project_data()
|
self._load_project_data()
|
||||||
|
|
||||||
|
|
||||||
|
# Convenience-Funktionen für einfache Verwendung
|
||||||
|
def create_project_dialog(parent=None):
|
||||||
|
"""
|
||||||
|
Erstellt einen neuen Projekt-Dialog für ein neues Projekt.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent: Übergeordnetes Widget
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PdfProjectDlg: Der Dialog
|
||||||
|
"""
|
||||||
|
return PdfProjectDlg(parent)
|
||||||
|
|
||||||
|
|
||||||
|
def edit_project_dialog(parent=None, project_data=None):
|
||||||
|
"""
|
||||||
|
Erstellt einen Projekt-Dialog zum Bearbeiten eines bestehenden Projekts.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent: Übergeordnetes Widget
|
||||||
|
project_data: Bestehende Projektdaten
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PdfProjectDlg: Der Dialog
|
||||||
|
"""
|
||||||
|
return PdfProjectDlg(parent, project_data)
|
||||||
|
|
||||||
|
|
||||||
|
def show_project_dialog(parent=None, project_data=None):
|
||||||
|
"""
|
||||||
|
Zeigt einen Projekt-Dialog an und gibt die Ergebnisse zurück.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent: Übergeordnetes Widget
|
||||||
|
project_data: Bestehende Projektdaten (optional)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple: (accepted: bool, project_data: dict)
|
||||||
|
"""
|
||||||
|
dialog = PdfProjectDlg(parent, project_data)
|
||||||
|
result = dialog.exec()
|
||||||
|
|
||||||
|
if result == QDialog.DialogCode.Accepted:
|
||||||
|
return True, dialog.get_project_data()
|
||||||
|
else:
|
||||||
|
return False, None
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>608</width>
|
<width>608</width>
|
||||||
<height>375</height>
|
<height>331</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -135,20 +135,6 @@
|
|||||||
<item row="8" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QComboBox" name="cB_Postgres"/>
|
<widget class="QComboBox" name="cB_Postgres"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
|
||||||
<widget class="QLabel" name="label_10">
|
|
||||||
<property name="text">
|
|
||||||
<string>XSLT-Parameter:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1">
|
|
||||||
<widget class="QPushButton" name="btnEditXsltParams">
|
|
||||||
<property name="text">
|
|
||||||
<string>Bearbeiten ...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QFrame" name="frame_2">
|
<widget class="QFrame" name="frame_2">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Form generated from reading UI file 'PdfProject.ui'
|
## Form generated from reading UI file 'PdfProject.ui'
|
||||||
##
|
##
|
||||||
## Created by: Qt User Interface Compiler version 6.10.1
|
## Created by: Qt User Interface Compiler version 6.9.2
|
||||||
##
|
##
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -131,16 +131,6 @@ class Ui_projectDlg(object):
|
|||||||
|
|
||||||
self.formLayout.setWidget(8, QFormLayout.ItemRole.FieldRole, self.cB_Postgres)
|
self.formLayout.setWidget(8, QFormLayout.ItemRole.FieldRole, self.cB_Postgres)
|
||||||
|
|
||||||
self.label_10 = QLabel(self.widget)
|
|
||||||
self.label_10.setObjectName(u"label_10")
|
|
||||||
|
|
||||||
self.formLayout.setWidget(9, QFormLayout.ItemRole.LabelRole, self.label_10)
|
|
||||||
|
|
||||||
self.btnEditXsltParams = QPushButton(self.widget)
|
|
||||||
self.btnEditXsltParams.setObjectName(u"btnEditXsltParams")
|
|
||||||
|
|
||||||
self.formLayout.setWidget(9, QFormLayout.ItemRole.FieldRole, self.btnEditXsltParams)
|
|
||||||
|
|
||||||
self.frame_2 = QFrame(self.widget)
|
self.frame_2 = QFrame(self.widget)
|
||||||
self.frame_2.setObjectName(u"frame_2")
|
self.frame_2.setObjectName(u"frame_2")
|
||||||
self.frame_2.setFrameShape(QFrame.Shape.StyledPanel)
|
self.frame_2.setFrameShape(QFrame.Shape.StyledPanel)
|
||||||
@@ -192,8 +182,6 @@ class Ui_projectDlg(object):
|
|||||||
self.label_9.setText(QCoreApplication.translate("projectDlg", u"FOP-Config-Ordner:", None))
|
self.label_9.setText(QCoreApplication.translate("projectDlg", u"FOP-Config-Ordner:", None))
|
||||||
self.label_7.setText(QCoreApplication.translate("projectDlg", u"diff-pdf:", None))
|
self.label_7.setText(QCoreApplication.translate("projectDlg", u"diff-pdf:", None))
|
||||||
self.label_8.setText(QCoreApplication.translate("projectDlg", u"Postgres:", None))
|
self.label_8.setText(QCoreApplication.translate("projectDlg", u"Postgres:", None))
|
||||||
self.label_10.setText(QCoreApplication.translate("projectDlg", u"XSLT-Parameter:", None))
|
|
||||||
self.btnEditXsltParams.setText(QCoreApplication.translate("projectDlg", u"Bearbeiten ...", None))
|
|
||||||
self.btnBrowseFopConfig.setText(QCoreApplication.translate("projectDlg", u"Durchsuchen ...", None))
|
self.btnBrowseFopConfig.setText(QCoreApplication.translate("projectDlg", u"Durchsuchen ...", None))
|
||||||
# retranslateUi
|
# retranslateUi
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ from PySide6.QtCore import QThread, Signal, Qt
|
|||||||
|
|
||||||
from ui.PostgreSqlConfigDialog_ui import Ui_PostgreSqlConfigDialog
|
from ui.PostgreSqlConfigDialog_ui import Ui_PostgreSqlConfigDialog
|
||||||
|
|
||||||
|
import polars as pl
|
||||||
|
|
||||||
|
|
||||||
class DatabaseTestThread(QThread):
|
class DatabaseTestThread(QThread):
|
||||||
"""Thread für den Datenbankverbindungstest."""
|
"""Thread für den Datenbankverbindungstest."""
|
||||||
@@ -16,15 +18,8 @@ class DatabaseTestThread(QThread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Führt den Datenbanktest in einem separaten Thread aus."""
|
"""Führt den Datenbanktest in einem separaten Thread aus."""
|
||||||
import polars as pl
|
|
||||||
try:
|
try:
|
||||||
timeout = self.connection_data.get("timeout", 10)
|
uri = f"postgresql://{self.connection_data['username']}:{self.connection_data['password']}@{self.connection_data['host']}:{self.connection_data['port']}/{self.connection_data['database']}"
|
||||||
uri = (
|
|
||||||
f"postgresql://{self.connection_data['username']}:{self.connection_data['password']}"
|
|
||||||
f"@{self.connection_data['host']}:{self.connection_data['port']}"
|
|
||||||
f"/{self.connection_data['database']}"
|
|
||||||
f"?connect_timeout={timeout}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Datenbankverbindung testen
|
# Datenbankverbindung testen
|
||||||
r = pl.read_database_uri(
|
r = pl.read_database_uri(
|
||||||
@@ -111,7 +106,6 @@ class PostgreSqlConfigDialog(QDialog):
|
|||||||
self.ui.usernameEdit.setText(data.get("username", ""))
|
self.ui.usernameEdit.setText(data.get("username", ""))
|
||||||
self.ui.passwordEdit.setText(data.get("password", ""))
|
self.ui.passwordEdit.setText(data.get("password", ""))
|
||||||
self.ui.sslModeComboBox.setCurrentText(data.get("ssl_mode", "prefer"))
|
self.ui.sslModeComboBox.setCurrentText(data.get("ssl_mode", "prefer"))
|
||||||
self.ui.timeoutSpinBox.setValue(data.get("timeout", 10))
|
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
"""Gibt die eingegebenen Daten zurück."""
|
"""Gibt die eingegebenen Daten zurück."""
|
||||||
@@ -132,5 +126,4 @@ class PostgreSqlConfigDialog(QDialog):
|
|||||||
"username": self.ui.usernameEdit.text().strip(),
|
"username": self.ui.usernameEdit.text().strip(),
|
||||||
"password": self.ui.passwordEdit.text(), # Passwort kann leer sein
|
"password": self.ui.passwordEdit.text(), # Passwort kann leer sein
|
||||||
"ssl_mode": self.ui.sslModeComboBox.currentText(),
|
"ssl_mode": self.ui.sslModeComboBox.currentText(),
|
||||||
"timeout": self.ui.timeoutSpinBox.value(),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,27 +138,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="timeoutLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Timeout (s):</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QSpinBox" name="timeoutSpinBox">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>300</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QPushButton" name="testConnectionButton">
|
<widget class="QPushButton" name="testConnectionButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Verbindung testen</string>
|
<string>Verbindung testen</string>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Form generated from reading UI file 'PostgreSqlConfigDialog.ui'
|
## Form generated from reading UI file 'PostgreSqlConfigDialog.ui'
|
||||||
##
|
##
|
||||||
## Created by: Qt User Interface Compiler version 6.10.1
|
## Created by: Qt User Interface Compiler version 6.9.1
|
||||||
##
|
##
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -110,23 +110,10 @@ class Ui_PostgreSqlConfigDialog(object):
|
|||||||
|
|
||||||
self.formLayout.setWidget(6, QFormLayout.ItemRole.FieldRole, self.sslModeComboBox)
|
self.formLayout.setWidget(6, QFormLayout.ItemRole.FieldRole, self.sslModeComboBox)
|
||||||
|
|
||||||
self.timeoutLabel = QLabel(PostgreSqlConfigDialog)
|
|
||||||
self.timeoutLabel.setObjectName(u"timeoutLabel")
|
|
||||||
|
|
||||||
self.formLayout.setWidget(7, QFormLayout.ItemRole.LabelRole, self.timeoutLabel)
|
|
||||||
|
|
||||||
self.timeoutSpinBox = QSpinBox(PostgreSqlConfigDialog)
|
|
||||||
self.timeoutSpinBox.setObjectName(u"timeoutSpinBox")
|
|
||||||
self.timeoutSpinBox.setMinimum(1)
|
|
||||||
self.timeoutSpinBox.setMaximum(300)
|
|
||||||
self.timeoutSpinBox.setValue(10)
|
|
||||||
|
|
||||||
self.formLayout.setWidget(7, QFormLayout.ItemRole.FieldRole, self.timeoutSpinBox)
|
|
||||||
|
|
||||||
self.testConnectionButton = QPushButton(PostgreSqlConfigDialog)
|
self.testConnectionButton = QPushButton(PostgreSqlConfigDialog)
|
||||||
self.testConnectionButton.setObjectName(u"testConnectionButton")
|
self.testConnectionButton.setObjectName(u"testConnectionButton")
|
||||||
|
|
||||||
self.formLayout.setWidget(8, QFormLayout.ItemRole.FieldRole, self.testConnectionButton)
|
self.formLayout.setWidget(7, QFormLayout.ItemRole.FieldRole, self.testConnectionButton)
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout.addLayout(self.formLayout)
|
self.verticalLayout.addLayout(self.formLayout)
|
||||||
@@ -164,7 +151,6 @@ class Ui_PostgreSqlConfigDialog(object):
|
|||||||
self.sslModeComboBox.setItemText(4, QCoreApplication.translate("PostgreSqlConfigDialog", u"verify-ca", None))
|
self.sslModeComboBox.setItemText(4, QCoreApplication.translate("PostgreSqlConfigDialog", u"verify-ca", None))
|
||||||
self.sslModeComboBox.setItemText(5, QCoreApplication.translate("PostgreSqlConfigDialog", u"verify-full", None))
|
self.sslModeComboBox.setItemText(5, QCoreApplication.translate("PostgreSqlConfigDialog", u"verify-full", None))
|
||||||
|
|
||||||
self.timeoutLabel.setText(QCoreApplication.translate("PostgreSqlConfigDialog", u"Timeout (s):", None))
|
|
||||||
self.testConnectionButton.setText(QCoreApplication.translate("PostgreSqlConfigDialog", u"Verbindung testen", None))
|
self.testConnectionButton.setText(QCoreApplication.translate("PostgreSqlConfigDialog", u"Verbindung testen", None))
|
||||||
# retranslateUi
|
# retranslateUi
|
||||||
|
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
from PySide6.QtWidgets import QDialog, QTableWidgetItem
|
|
||||||
from ui.ProjectXsltParamsDialog_ui import Ui_ProjectXsltParamsDialog
|
|
||||||
from icons import icon
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectXsltParamsDialog(QDialog):
|
|
||||||
"""Dialog zur Bearbeitung projektweiter XSLT-Parameter."""
|
|
||||||
|
|
||||||
def __init__(self, parent=None, xslt_params: dict[str, str] | None = None):
|
|
||||||
super().__init__(parent)
|
|
||||||
|
|
||||||
self.ui = Ui_ProjectXsltParamsDialog()
|
|
||||||
self.ui.setupUi(self)
|
|
||||||
|
|
||||||
self.ui.addParamButton.setIcon(icon("plus-circle"))
|
|
||||||
self.ui.removeParamButton.setIcon(icon("minus-circle"))
|
|
||||||
|
|
||||||
self.ui.addParamButton.clicked.connect(self._add_parameter)
|
|
||||||
self.ui.removeParamButton.clicked.connect(self._remove_parameter)
|
|
||||||
|
|
||||||
self._setup_table()
|
|
||||||
|
|
||||||
if xslt_params:
|
|
||||||
self._load_params(xslt_params)
|
|
||||||
|
|
||||||
def _setup_table(self):
|
|
||||||
"""Konfiguriert die Tabelle."""
|
|
||||||
self.ui.xsltParamsTable.setColumnWidth(0, 200)
|
|
||||||
self.ui.xsltParamsTable.setColumnWidth(1, 300)
|
|
||||||
self.ui.xsltParamsTable.horizontalHeader().setStretchLastSection(True)
|
|
||||||
|
|
||||||
def _load_params(self, params: dict[str, str]):
|
|
||||||
"""Lädt die XSLT-Parameter in die Tabelle."""
|
|
||||||
self.ui.xsltParamsTable.setRowCount(len(params))
|
|
||||||
for row, (key, value) in enumerate(params.items()):
|
|
||||||
self.ui.xsltParamsTable.setItem(row, 0, QTableWidgetItem(str(key)))
|
|
||||||
self.ui.xsltParamsTable.setItem(row, 1, QTableWidgetItem(str(value)))
|
|
||||||
|
|
||||||
def _add_parameter(self):
|
|
||||||
"""Fügt einen neuen Parameter hinzu."""
|
|
||||||
row_count = self.ui.xsltParamsTable.rowCount()
|
|
||||||
self.ui.xsltParamsTable.insertRow(row_count)
|
|
||||||
self.ui.xsltParamsTable.setItem(row_count, 0, QTableWidgetItem(""))
|
|
||||||
self.ui.xsltParamsTable.setItem(row_count, 1, QTableWidgetItem(""))
|
|
||||||
self.ui.xsltParamsTable.setCurrentCell(row_count, 0)
|
|
||||||
|
|
||||||
def _remove_parameter(self):
|
|
||||||
"""Entfernt den ausgewählten Parameter."""
|
|
||||||
current_row = self.ui.xsltParamsTable.currentRow()
|
|
||||||
if current_row >= 0:
|
|
||||||
self.ui.xsltParamsTable.removeRow(current_row)
|
|
||||||
|
|
||||||
def get_params(self) -> dict[str, str]:
|
|
||||||
"""
|
|
||||||
Gibt die bearbeiteten XSLT-Parameter zurück.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict[str, str]: Dictionary mit allen XSLT-Parametern
|
|
||||||
"""
|
|
||||||
params = {}
|
|
||||||
for row in range(self.ui.xsltParamsTable.rowCount()):
|
|
||||||
key_item = self.ui.xsltParamsTable.item(row, 0)
|
|
||||||
value_item = self.ui.xsltParamsTable.item(row, 1)
|
|
||||||
if key_item and value_item:
|
|
||||||
key = key_item.text().strip()
|
|
||||||
if key:
|
|
||||||
params[key] = value_item.text().strip()
|
|
||||||
return params
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ProjectXsltParamsDialog</class>
|
|
||||||
<widget class="QDialog" name="ProjectXsltParamsDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>600</width>
|
|
||||||
<height>400</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Projektweite XSLT-Parameter</string>
|
|
||||||
</property>
|
|
||||||
<property name="modal">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="xsltParamsGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>XSLT-Parameter</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="xsltParamsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QTableWidget" name="xsltParamsTable">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::Shape::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="columnCount">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<attribute name="horizontalHeaderVisible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</attribute>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Parameter</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Wert</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="xsltParamsButtonLayout">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_left">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addParamButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Parameter hinzufügen</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="QIcon::ThemeIcon::ListAdd"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="removeParamButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Parameter entfernen</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="QIcon::ThemeIcon::ListRemove"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_right">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
|
||||||
</property>
|
|
||||||
<property name="centerButtons">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>ProjectXsltParamsDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>ProjectXsltParamsDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
## Form generated from reading UI file 'ProjectXsltParamsDialog.ui'
|
|
||||||
##
|
|
||||||
## Created by: Qt User Interface Compiler version 6.10.1
|
|
||||||
##
|
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
|
||||||
QMetaObject, QObject, QPoint, QRect,
|
|
||||||
QSize, QTime, QUrl, Qt)
|
|
||||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
|
||||||
QFont, QFontDatabase, QGradient, QIcon,
|
|
||||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
|
||||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
|
||||||
from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox,
|
|
||||||
QFrame, QGroupBox, QHBoxLayout, QHeaderView,
|
|
||||||
QPushButton, QSizePolicy, QSpacerItem, QTableWidget,
|
|
||||||
QTableWidgetItem, QVBoxLayout, QWidget)
|
|
||||||
|
|
||||||
class Ui_ProjectXsltParamsDialog(object):
|
|
||||||
def setupUi(self, ProjectXsltParamsDialog):
|
|
||||||
if not ProjectXsltParamsDialog.objectName():
|
|
||||||
ProjectXsltParamsDialog.setObjectName(u"ProjectXsltParamsDialog")
|
|
||||||
ProjectXsltParamsDialog.resize(600, 400)
|
|
||||||
ProjectXsltParamsDialog.setModal(True)
|
|
||||||
self.verticalLayout = QVBoxLayout(ProjectXsltParamsDialog)
|
|
||||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
|
||||||
self.xsltParamsGroupBox = QGroupBox(ProjectXsltParamsDialog)
|
|
||||||
self.xsltParamsGroupBox.setObjectName(u"xsltParamsGroupBox")
|
|
||||||
self.xsltParamsLayout = QVBoxLayout(self.xsltParamsGroupBox)
|
|
||||||
self.xsltParamsLayout.setObjectName(u"xsltParamsLayout")
|
|
||||||
self.xsltParamsLayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.xsltParamsTable = QTableWidget(self.xsltParamsGroupBox)
|
|
||||||
if (self.xsltParamsTable.columnCount() < 2):
|
|
||||||
self.xsltParamsTable.setColumnCount(2)
|
|
||||||
__qtablewidgetitem = QTableWidgetItem()
|
|
||||||
self.xsltParamsTable.setHorizontalHeaderItem(0, __qtablewidgetitem)
|
|
||||||
__qtablewidgetitem1 = QTableWidgetItem()
|
|
||||||
self.xsltParamsTable.setHorizontalHeaderItem(1, __qtablewidgetitem1)
|
|
||||||
self.xsltParamsTable.setObjectName(u"xsltParamsTable")
|
|
||||||
self.xsltParamsTable.setFrameShape(QFrame.Shape.NoFrame)
|
|
||||||
self.xsltParamsTable.setColumnCount(2)
|
|
||||||
self.xsltParamsTable.horizontalHeader().setVisible(True)
|
|
||||||
|
|
||||||
self.xsltParamsLayout.addWidget(self.xsltParamsTable)
|
|
||||||
|
|
||||||
self.xsltParamsButtonLayout = QHBoxLayout()
|
|
||||||
self.xsltParamsButtonLayout.setObjectName(u"xsltParamsButtonLayout")
|
|
||||||
self.horizontalSpacer_left = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
|
||||||
|
|
||||||
self.xsltParamsButtonLayout.addItem(self.horizontalSpacer_left)
|
|
||||||
|
|
||||||
self.addParamButton = QPushButton(self.xsltParamsGroupBox)
|
|
||||||
self.addParamButton.setObjectName(u"addParamButton")
|
|
||||||
icon = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.ListAdd))
|
|
||||||
self.addParamButton.setIcon(icon)
|
|
||||||
|
|
||||||
self.xsltParamsButtonLayout.addWidget(self.addParamButton)
|
|
||||||
|
|
||||||
self.removeParamButton = QPushButton(self.xsltParamsGroupBox)
|
|
||||||
self.removeParamButton.setObjectName(u"removeParamButton")
|
|
||||||
icon1 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.ListRemove))
|
|
||||||
self.removeParamButton.setIcon(icon1)
|
|
||||||
|
|
||||||
self.xsltParamsButtonLayout.addWidget(self.removeParamButton)
|
|
||||||
|
|
||||||
self.horizontalSpacer_right = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
|
||||||
|
|
||||||
self.xsltParamsButtonLayout.addItem(self.horizontalSpacer_right)
|
|
||||||
|
|
||||||
|
|
||||||
self.xsltParamsLayout.addLayout(self.xsltParamsButtonLayout)
|
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.xsltParamsGroupBox)
|
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(ProjectXsltParamsDialog)
|
|
||||||
self.buttonBox.setObjectName(u"buttonBox")
|
|
||||||
self.buttonBox.setOrientation(Qt.Orientation.Horizontal)
|
|
||||||
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Ok)
|
|
||||||
self.buttonBox.setCenterButtons(True)
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
|
||||||
|
|
||||||
|
|
||||||
self.retranslateUi(ProjectXsltParamsDialog)
|
|
||||||
self.buttonBox.accepted.connect(ProjectXsltParamsDialog.accept)
|
|
||||||
self.buttonBox.rejected.connect(ProjectXsltParamsDialog.reject)
|
|
||||||
|
|
||||||
QMetaObject.connectSlotsByName(ProjectXsltParamsDialog)
|
|
||||||
# setupUi
|
|
||||||
|
|
||||||
def retranslateUi(self, ProjectXsltParamsDialog):
|
|
||||||
ProjectXsltParamsDialog.setWindowTitle(QCoreApplication.translate("ProjectXsltParamsDialog", u"Projektweite XSLT-Parameter", None))
|
|
||||||
self.xsltParamsGroupBox.setTitle(QCoreApplication.translate("ProjectXsltParamsDialog", u"XSLT-Parameter", None))
|
|
||||||
___qtablewidgetitem = self.xsltParamsTable.horizontalHeaderItem(0)
|
|
||||||
___qtablewidgetitem.setText(QCoreApplication.translate("ProjectXsltParamsDialog", u"Parameter", None));
|
|
||||||
___qtablewidgetitem1 = self.xsltParamsTable.horizontalHeaderItem(1)
|
|
||||||
___qtablewidgetitem1.setText(QCoreApplication.translate("ProjectXsltParamsDialog", u"Wert", None));
|
|
||||||
self.addParamButton.setText(QCoreApplication.translate("ProjectXsltParamsDialog", u"Parameter hinzuf\u00fcgen", None))
|
|
||||||
self.removeParamButton.setText(QCoreApplication.translate("ProjectXsltParamsDialog", u"Parameter entfernen", None))
|
|
||||||
# retranslateUi
|
|
||||||
|
|
||||||
@@ -1,9 +1,161 @@
|
|||||||
|
from PySide6.QtWidgets import QDialog, QTableWidgetItem, QMessageBox
|
||||||
|
from PySide6.QtCore import Qt
|
||||||
|
|
||||||
from ui.TreeNodeEditDialog_ui import Ui_TreeNodeEditDialog
|
from ui.TreeNodeEditDialog_ui import Ui_TreeNodeEditDialog
|
||||||
from ui.XsltParamsEditDialog import XsltParamsEditDialog
|
|
||||||
|
|
||||||
|
|
||||||
class TreeNodeEditDialog(XsltParamsEditDialog):
|
class TreeNodeEditDialog(QDialog):
|
||||||
"""Dialog zur Bearbeitung von TreeNode-Objekten."""
|
"""Dialog zur Bearbeitung von TreeNode-Objekten."""
|
||||||
|
|
||||||
def _create_ui(self):
|
def __init__(self, parent=None, node=None, parent_params=None):
|
||||||
return Ui_TreeNodeEditDialog()
|
"""
|
||||||
|
Initialisiert den Dialog.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent: Übergeordnetes Widget
|
||||||
|
node: TreeNode-Objekt zum Bearbeiten
|
||||||
|
parent_params: Dictionary mit Eltern-Parametern (nur anzeigen)
|
||||||
|
"""
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
# UI einrichten
|
||||||
|
self.ui = Ui_TreeNodeEditDialog()
|
||||||
|
self.ui.setupUi(self)
|
||||||
|
|
||||||
|
# Node-Objekt speichern
|
||||||
|
self.node = node
|
||||||
|
self.parent_params = parent_params or {}
|
||||||
|
|
||||||
|
# Signale verbinden
|
||||||
|
self.ui.addParamButton.clicked.connect(self.add_parameter)
|
||||||
|
self.ui.removeParamButton.clicked.connect(self.remove_parameter)
|
||||||
|
|
||||||
|
# Tabellen konfigurieren
|
||||||
|
self._setup_tables()
|
||||||
|
|
||||||
|
# Daten laden
|
||||||
|
if self.node:
|
||||||
|
self._load_data()
|
||||||
|
|
||||||
|
def _setup_tables(self):
|
||||||
|
"""Konfiguriert die Tabellen."""
|
||||||
|
# XSLT Parameter Tabelle
|
||||||
|
self.ui.xsltParamsTable.setColumnWidth(0, 200)
|
||||||
|
self.ui.xsltParamsTable.setColumnWidth(1, 300)
|
||||||
|
self.ui.xsltParamsTable.horizontalHeader().setStretchLastSection(True)
|
||||||
|
|
||||||
|
# Eltern-Parameter Tabelle
|
||||||
|
self.ui.parentParamsTable.setColumnWidth(0, 200)
|
||||||
|
self.ui.parentParamsTable.setColumnWidth(1, 300)
|
||||||
|
self.ui.parentParamsTable.horizontalHeader().setStretchLastSection(True)
|
||||||
|
|
||||||
|
def _load_data(self):
|
||||||
|
"""Lädt die Daten des TreeNode in den Dialog."""
|
||||||
|
if not self.node:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Bezeichnung setzen
|
||||||
|
self.ui.bezEdit.setText(str(self.node.bez) if self.node.bez else "")
|
||||||
|
|
||||||
|
# XSLT Parameter laden
|
||||||
|
self._load_xslt_params()
|
||||||
|
|
||||||
|
# Eltern-Parameter laden
|
||||||
|
self._load_parent_params()
|
||||||
|
|
||||||
|
def _load_xslt_params(self):
|
||||||
|
"""Lädt die XSLT Parameter in die Tabelle."""
|
||||||
|
if not self.node or not self.node.xslt_params:
|
||||||
|
return
|
||||||
|
|
||||||
|
params = self.node.xslt_params
|
||||||
|
self.ui.xsltParamsTable.setRowCount(len(params))
|
||||||
|
|
||||||
|
for row, (key, value) in enumerate(params.items()):
|
||||||
|
# Parameter-Name
|
||||||
|
key_item = QTableWidgetItem(str(key))
|
||||||
|
self.ui.xsltParamsTable.setItem(row, 0, key_item)
|
||||||
|
|
||||||
|
# Parameter-Wert
|
||||||
|
value_item = QTableWidgetItem(str(value))
|
||||||
|
self.ui.xsltParamsTable.setItem(row, 1, value_item)
|
||||||
|
|
||||||
|
def _load_parent_params(self):
|
||||||
|
"""Lädt die Eltern-Parameter in die Tabelle (nur anzeigen)."""
|
||||||
|
if not self.parent_params:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.ui.parentParamsTable.setRowCount(len(self.parent_params))
|
||||||
|
|
||||||
|
for row, (key, value) in enumerate(self.parent_params.items()):
|
||||||
|
# Parameter-Name
|
||||||
|
key_item = QTableWidgetItem(str(key))
|
||||||
|
key_item.setFlags(key_item.flags() & ~Qt.ItemFlag.ItemIsEditable)
|
||||||
|
self.ui.parentParamsTable.setItem(row, 0, key_item)
|
||||||
|
|
||||||
|
# Parameter-Wert
|
||||||
|
value_item = QTableWidgetItem(str(value))
|
||||||
|
value_item.setFlags(value_item.flags() & ~Qt.ItemFlag.ItemIsEditable)
|
||||||
|
self.ui.parentParamsTable.setItem(row, 1, value_item)
|
||||||
|
|
||||||
|
def add_parameter(self):
|
||||||
|
"""Fügt einen neuen Parameter hinzu."""
|
||||||
|
row_count = self.ui.xsltParamsTable.rowCount()
|
||||||
|
self.ui.xsltParamsTable.insertRow(row_count)
|
||||||
|
|
||||||
|
# Leere Items hinzufügen
|
||||||
|
key_item = QTableWidgetItem("")
|
||||||
|
value_item = QTableWidgetItem("")
|
||||||
|
|
||||||
|
self.ui.xsltParamsTable.setItem(row_count, 0, key_item)
|
||||||
|
self.ui.xsltParamsTable.setItem(row_count, 1, value_item)
|
||||||
|
|
||||||
|
# Fokus auf den neuen Parameter setzen
|
||||||
|
self.ui.xsltParamsTable.setCurrentCell(row_count, 0)
|
||||||
|
|
||||||
|
def remove_parameter(self):
|
||||||
|
"""Entfernt den ausgewählten Parameter."""
|
||||||
|
current_row = self.ui.xsltParamsTable.currentRow()
|
||||||
|
if current_row >= 0:
|
||||||
|
self.ui.xsltParamsTable.removeRow(current_row)
|
||||||
|
|
||||||
|
def get_data(self):
|
||||||
|
"""
|
||||||
|
Gibt die bearbeiteten Daten zurück.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: Dictionary mit den bearbeiteten Daten oder None bei Fehler
|
||||||
|
"""
|
||||||
|
# Bezeichnung prüfen
|
||||||
|
bez = self.ui.bezEdit.text().strip()
|
||||||
|
if not bez:
|
||||||
|
QMessageBox.warning(self, "Warnung", "Bitte geben Sie eine Bezeichnung ein.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
# XSLT Parameter sammeln
|
||||||
|
xslt_params = {}
|
||||||
|
for row in range(self.ui.xsltParamsTable.rowCount()):
|
||||||
|
key_item = self.ui.xsltParamsTable.item(row, 0)
|
||||||
|
value_item = self.ui.xsltParamsTable.item(row, 1)
|
||||||
|
|
||||||
|
if key_item and value_item:
|
||||||
|
key = key_item.text().strip()
|
||||||
|
value = value_item.text().strip()
|
||||||
|
|
||||||
|
if key: # Nur Parameter mit nicht-leerem Schlüssel hinzufügen
|
||||||
|
xslt_params[key] = value
|
||||||
|
|
||||||
|
# CheckBox für Force-Transformation prüfen
|
||||||
|
force_transform = self.ui.alle_xml_transformieren.isChecked()
|
||||||
|
|
||||||
|
return {
|
||||||
|
"bez": bez,
|
||||||
|
"xslt_params": xslt_params,
|
||||||
|
"force_transform": force_transform
|
||||||
|
}
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
"""Überschreibt accept() um Datenvalidierung durchzuführen."""
|
||||||
|
data = self.get_data()
|
||||||
|
if data is not None:
|
||||||
|
super().accept()
|
||||||
|
|||||||
@@ -1,253 +0,0 @@
|
|||||||
"""
|
|
||||||
Worker Pool Metriken-Dialog.
|
|
||||||
|
|
||||||
Zeigt Performance- und Ressourcenverbrauch-Metriken für Saxon- und FOP-Worker-Pools an.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from PySide6.QtWidgets import (
|
|
||||||
QDialog,
|
|
||||||
QVBoxLayout,
|
|
||||||
QHBoxLayout,
|
|
||||||
QGroupBox,
|
|
||||||
QLabel,
|
|
||||||
QPushButton,
|
|
||||||
QTabWidget,
|
|
||||||
QWidget,
|
|
||||||
)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class WorkerPoolMetricsDialog(QDialog):
|
|
||||||
"""
|
|
||||||
Dialog zur Anzeige von Worker-Pool-Metriken.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
"""
|
|
||||||
Initialisiert den Metriken-Dialog.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
parent: Eltern-Widget
|
|
||||||
"""
|
|
||||||
super().__init__(parent)
|
|
||||||
self.setWindowTitle("Worker Pool Performance-Metriken")
|
|
||||||
self.resize(800, 600)
|
|
||||||
self._setup_ui()
|
|
||||||
self._load_metrics()
|
|
||||||
|
|
||||||
def _setup_ui(self):
|
|
||||||
"""Erstellt die UI-Elemente."""
|
|
||||||
layout = QVBoxLayout(self)
|
|
||||||
|
|
||||||
# Tab-Widget für Saxon und FOP
|
|
||||||
self.tab_widget = QTabWidget()
|
|
||||||
layout.addWidget(self.tab_widget)
|
|
||||||
|
|
||||||
# Saxon-Tab
|
|
||||||
self.saxon_tab = self._create_metrics_tab("Saxon Worker Pool")
|
|
||||||
self.tab_widget.addTab(self.saxon_tab, "Saxon (XSLT)")
|
|
||||||
|
|
||||||
# FOP-Tab
|
|
||||||
self.fop_tab = self._create_metrics_tab("FOP Worker Pool")
|
|
||||||
self.tab_widget.addTab(self.fop_tab, "FOP (PDF)")
|
|
||||||
|
|
||||||
# Schließen-Button
|
|
||||||
button_layout = QHBoxLayout()
|
|
||||||
button_layout.addStretch()
|
|
||||||
close_button = QPushButton("Schließen")
|
|
||||||
close_button.clicked.connect(self.accept)
|
|
||||||
button_layout.addWidget(close_button)
|
|
||||||
layout.addLayout(button_layout)
|
|
||||||
|
|
||||||
def _create_metrics_tab(self, title: str) -> QWidget:
|
|
||||||
"""
|
|
||||||
Erstellt ein Tab-Widget für Metriken.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
title: Titel der Metrik-Gruppe
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
QWidget mit Metriken
|
|
||||||
"""
|
|
||||||
tab = QWidget()
|
|
||||||
layout = QVBoxLayout(tab)
|
|
||||||
|
|
||||||
# Status-Label
|
|
||||||
status_label = QLabel("Status: <i>Nicht initialisiert</i>")
|
|
||||||
status_label.setObjectName("status_label")
|
|
||||||
layout.addWidget(status_label)
|
|
||||||
|
|
||||||
# Kompilierungs-Metriken
|
|
||||||
compile_group = QGroupBox("Kompilierung")
|
|
||||||
compile_layout = QVBoxLayout(compile_group)
|
|
||||||
|
|
||||||
compile_time_label = QLabel("Kompilierungszeit: -")
|
|
||||||
compile_time_label.setObjectName("compile_time_label")
|
|
||||||
compile_layout.addWidget(compile_time_label)
|
|
||||||
|
|
||||||
layout.addWidget(compile_group)
|
|
||||||
|
|
||||||
# Worker-Start-Metriken
|
|
||||||
worker_start_group = QGroupBox("Worker-Start")
|
|
||||||
worker_start_layout = QVBoxLayout(worker_start_group)
|
|
||||||
|
|
||||||
worker_count_label = QLabel("Anzahl Worker: -")
|
|
||||||
worker_count_label.setObjectName("worker_count_label")
|
|
||||||
worker_start_layout.addWidget(worker_count_label)
|
|
||||||
|
|
||||||
total_start_time_label = QLabel("Summe Startzeit: -")
|
|
||||||
total_start_time_label.setObjectName("total_start_time_label")
|
|
||||||
worker_start_layout.addWidget(total_start_time_label)
|
|
||||||
|
|
||||||
avg_start_time_label = QLabel("Durchschnitt Startzeit: -")
|
|
||||||
avg_start_time_label.setObjectName("avg_start_time_label")
|
|
||||||
worker_start_layout.addWidget(avg_start_time_label)
|
|
||||||
|
|
||||||
layout.addWidget(worker_start_group)
|
|
||||||
|
|
||||||
# RAM-Metriken
|
|
||||||
ram_group = QGroupBox("Arbeitsspeicher (RAM)")
|
|
||||||
ram_layout = QVBoxLayout(ram_group)
|
|
||||||
|
|
||||||
ram_before_label = QLabel("RAM vor Transformation: -")
|
|
||||||
ram_before_label.setObjectName("ram_before_label")
|
|
||||||
ram_layout.addWidget(ram_before_label)
|
|
||||||
|
|
||||||
ram_before_avg_label = QLabel("RAM vor Transformation (Durchschnitt/Worker): -")
|
|
||||||
ram_before_avg_label.setObjectName("ram_before_avg_label")
|
|
||||||
ram_layout.addWidget(ram_before_avg_label)
|
|
||||||
|
|
||||||
ram_after_label = QLabel("RAM nach Transformation: -")
|
|
||||||
ram_after_label.setObjectName("ram_after_label")
|
|
||||||
ram_layout.addWidget(ram_after_label)
|
|
||||||
|
|
||||||
ram_after_avg_label = QLabel("RAM nach Transformation (Durchschnitt/Worker): -")
|
|
||||||
ram_after_avg_label.setObjectName("ram_after_avg_label")
|
|
||||||
ram_layout.addWidget(ram_after_avg_label)
|
|
||||||
|
|
||||||
ram_delta_label = QLabel("RAM-Zunahme: -")
|
|
||||||
ram_delta_label.setObjectName("ram_delta_label")
|
|
||||||
ram_layout.addWidget(ram_delta_label)
|
|
||||||
|
|
||||||
layout.addWidget(ram_group)
|
|
||||||
|
|
||||||
layout.addStretch()
|
|
||||||
|
|
||||||
return tab
|
|
||||||
|
|
||||||
def _load_metrics(self):
|
|
||||||
"""Lädt und zeigt die Metriken an."""
|
|
||||||
# Hole MainWindow-Instanz (parent)
|
|
||||||
main_window = self.parent()
|
|
||||||
|
|
||||||
# Saxon Worker Pool - verwende gespeicherte Metriken
|
|
||||||
if hasattr(main_window, "last_saxon_metrics") and main_window.last_saxon_metrics:
|
|
||||||
self._update_metrics_tab_from_metrics(
|
|
||||||
self.saxon_tab, main_window.last_saxon_metrics, "Saxon Worker Pool"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self._set_tab_status(
|
|
||||||
self.saxon_tab, "<i>Keine Metriken verfügbar - bitte erst eine Transformation durchführen</i>"
|
|
||||||
)
|
|
||||||
|
|
||||||
# FOP Worker Pool - verwende gespeicherte Metriken
|
|
||||||
if hasattr(main_window, "last_fop_metrics") and main_window.last_fop_metrics:
|
|
||||||
self._update_metrics_tab_from_metrics(self.fop_tab, main_window.last_fop_metrics, "FOP Worker Pool")
|
|
||||||
else:
|
|
||||||
self._set_tab_status(
|
|
||||||
self.fop_tab, "<i>Keine Metriken verfügbar - bitte erst eine Transformation durchführen</i>"
|
|
||||||
)
|
|
||||||
|
|
||||||
def _set_tab_status(self, tab: QWidget, status: str):
|
|
||||||
"""
|
|
||||||
Setzt den Status-Text eines Tabs.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
tab: Das Tab-Widget
|
|
||||||
status: Der Status-Text
|
|
||||||
"""
|
|
||||||
status_label = tab.findChild(QLabel, "status_label")
|
|
||||||
if status_label:
|
|
||||||
status_label.setText(f"Status: {status}")
|
|
||||||
|
|
||||||
def _update_metrics_tab_from_metrics(self, tab: QWidget, metrics, pool_name: str):
|
|
||||||
"""
|
|
||||||
Aktualisiert die Metriken in einem Tab (direkt aus Metriken-Objekt).
|
|
||||||
|
|
||||||
Args:
|
|
||||||
tab: Das Tab-Widget
|
|
||||||
metrics: Das WorkerPoolMetrics-Objekt
|
|
||||||
pool_name: Name des Pools
|
|
||||||
"""
|
|
||||||
# Status - berechne Worker-Anzahl aus Metriken
|
|
||||||
num_workers = len(metrics.worker_start_times) if metrics.worker_start_times else 0
|
|
||||||
self._set_tab_status(tab, f"<b>Letzte Transformation</b> ({num_workers} Worker)")
|
|
||||||
|
|
||||||
# Kompilierung
|
|
||||||
compile_time_label = tab.findChild(QLabel, "compile_time_label")
|
|
||||||
if compile_time_label:
|
|
||||||
compile_time_label.setText(f"Kompilierungszeit: <b>{metrics.compilation_time_seconds:.3f} s</b>")
|
|
||||||
|
|
||||||
# Worker-Start
|
|
||||||
worker_count_label = tab.findChild(QLabel, "worker_count_label")
|
|
||||||
if worker_count_label:
|
|
||||||
worker_count_label.setText(f"Anzahl Worker: <b>{len(metrics.worker_start_times)}</b>")
|
|
||||||
|
|
||||||
total_start_time_label = tab.findChild(QLabel, "total_start_time_label")
|
|
||||||
if total_start_time_label:
|
|
||||||
total_start_time_label.setText(
|
|
||||||
f"Summe Startzeit: <b>{metrics.total_worker_start_time_seconds:.3f} s</b>"
|
|
||||||
)
|
|
||||||
|
|
||||||
avg_start_time_label = tab.findChild(QLabel, "avg_start_time_label")
|
|
||||||
if avg_start_time_label:
|
|
||||||
avg_start_time_label.setText(
|
|
||||||
f"Durchschnitt Startzeit: <b>{metrics.average_worker_start_time_seconds:.3f} s/Worker</b>"
|
|
||||||
)
|
|
||||||
|
|
||||||
# RAM
|
|
||||||
ram_before_label = tab.findChild(QLabel, "ram_before_label")
|
|
||||||
if ram_before_label:
|
|
||||||
if metrics.total_ram_before_mb > 0:
|
|
||||||
ram_before_label.setText(f"RAM vor Transformation: <b>{metrics.total_ram_before_mb:.1f} MB</b>")
|
|
||||||
else:
|
|
||||||
ram_before_label.setText("RAM vor Transformation: <i>Noch nicht gemessen</i>")
|
|
||||||
|
|
||||||
ram_before_avg_label = tab.findChild(QLabel, "ram_before_avg_label")
|
|
||||||
if ram_before_avg_label:
|
|
||||||
if metrics.average_ram_before_mb > 0:
|
|
||||||
ram_before_avg_label.setText(
|
|
||||||
f"RAM vor Transformation (Durchschnitt/Worker): <b>{metrics.average_ram_before_mb:.1f} MB</b>"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
ram_before_avg_label.setText(
|
|
||||||
"RAM vor Transformation (Durchschnitt/Worker): <i>Noch nicht gemessen</i>"
|
|
||||||
)
|
|
||||||
|
|
||||||
ram_after_label = tab.findChild(QLabel, "ram_after_label")
|
|
||||||
if ram_after_label:
|
|
||||||
if metrics.total_ram_after_mb > 0:
|
|
||||||
ram_after_label.setText(f"RAM nach Transformation: <b>{metrics.total_ram_after_mb:.1f} MB</b>")
|
|
||||||
else:
|
|
||||||
ram_after_label.setText("RAM nach Transformation: <i>Noch nicht gemessen</i>")
|
|
||||||
|
|
||||||
ram_after_avg_label = tab.findChild(QLabel, "ram_after_avg_label")
|
|
||||||
if ram_after_avg_label:
|
|
||||||
if metrics.average_ram_after_mb > 0:
|
|
||||||
ram_after_avg_label.setText(
|
|
||||||
f"RAM nach Transformation (Durchschnitt/Worker): <b>{metrics.average_ram_after_mb:.1f} MB</b>"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
ram_after_avg_label.setText(
|
|
||||||
"RAM nach Transformation (Durchschnitt/Worker): <i>Noch nicht gemessen</i>"
|
|
||||||
)
|
|
||||||
|
|
||||||
ram_delta_label = tab.findChild(QLabel, "ram_delta_label")
|
|
||||||
if ram_delta_label:
|
|
||||||
if metrics.total_ram_before_mb > 0 and metrics.total_ram_after_mb > 0:
|
|
||||||
delta = metrics.total_ram_after_mb - metrics.total_ram_before_mb
|
|
||||||
delta_percent = (delta / metrics.total_ram_before_mb * 100) if metrics.total_ram_before_mb > 0 else 0
|
|
||||||
ram_delta_label.setText(f"RAM-Zunahme: <b>{delta:.1f} MB ({delta_percent:+.1f}%)</b>")
|
|
||||||
else:
|
|
||||||
ram_delta_label.setText("RAM-Zunahme: <i>Noch nicht gemessen</i>")
|
|
||||||
@@ -13,14 +13,7 @@ logger = logging.getLogger(__name__)
|
|||||||
class XmlToXslAssignDialog(QDialog):
|
class XmlToXslAssignDialog(QDialog):
|
||||||
"""Dialog zur Zuordnung einer XML-Datei zu XSL-Knoten."""
|
"""Dialog zur Zuordnung einer XML-Datei zu XSL-Knoten."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, parent=None, xml_file_path=None, project_nodes=None):
|
||||||
self,
|
|
||||||
parent=None,
|
|
||||||
xml_file_path=None,
|
|
||||||
project_nodes=None,
|
|
||||||
preselected_xsl_ids: set | None = None,
|
|
||||||
edit_mode: bool = False,
|
|
||||||
):
|
|
||||||
"""
|
"""
|
||||||
Initialisiert den Dialog.
|
Initialisiert den Dialog.
|
||||||
|
|
||||||
@@ -28,8 +21,6 @@ class XmlToXslAssignDialog(QDialog):
|
|||||||
parent: Übergeordnetes Widget
|
parent: Übergeordnetes Widget
|
||||||
xml_file_path: Pfad zur XML-Datei
|
xml_file_path: Pfad zur XML-Datei
|
||||||
project_nodes: Liste der Projekt-Knoten
|
project_nodes: Liste der Projekt-Knoten
|
||||||
preselected_xsl_ids: Set von XslFile-IDs (tuple), deren Checkbox initial angehakt sein soll
|
|
||||||
edit_mode: True = Bearbeiten-Modus (Zuordnungen ändern), False = Neu-Zuordnen
|
|
||||||
"""
|
"""
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
@@ -40,23 +31,9 @@ class XmlToXslAssignDialog(QDialog):
|
|||||||
# Parameter speichern
|
# Parameter speichern
|
||||||
self.xml_file_path = Path(xml_file_path) if xml_file_path else None
|
self.xml_file_path = Path(xml_file_path) if xml_file_path else None
|
||||||
self.project_nodes = project_nodes or []
|
self.project_nodes = project_nodes or []
|
||||||
self.preselected_xsl_ids: set = set(preselected_xsl_ids) if preselected_xsl_ids else set()
|
|
||||||
self.edit_mode = edit_mode
|
|
||||||
|
|
||||||
# Dictionary zum Speichern der Checkbox-Referenzen
|
# Dictionary zum Speichern der Checkbox-Referenzen
|
||||||
self.xsl_checkboxes = {} # {python_id(node): checkbox}
|
self.xsl_checkboxes = {} # {xsl_node_id: checkbox}
|
||||||
self.xsl_nodes = {} # {python_id(node): XslFile}
|
|
||||||
# Initial ausgewählte XslFile-IDs (tuple), um Diff beim Accept zu berechnen
|
|
||||||
self._initial_selected_ids: set = set()
|
|
||||||
|
|
||||||
# Edit-Modus: UI anpassen
|
|
||||||
if self.edit_mode:
|
|
||||||
self.setWindowTitle("XML-Zuordnungen bearbeiten")
|
|
||||||
self.ui.infoLabel.setText(
|
|
||||||
"Passen Sie die Zuordnungen der XML-Datei an. Hinzufügen per Haken, "
|
|
||||||
"Entfernen durch Abhaken (zugehörige PDFs werden gelöscht):"
|
|
||||||
)
|
|
||||||
self.ui.alle_xml.setVisible(False)
|
|
||||||
|
|
||||||
# Signale verbinden
|
# Signale verbinden
|
||||||
self.ui.selectAllButton.clicked.connect(self.select_all)
|
self.ui.selectAllButton.clicked.connect(self.select_all)
|
||||||
@@ -68,10 +45,6 @@ class XmlToXslAssignDialog(QDialog):
|
|||||||
# Daten laden
|
# Daten laden
|
||||||
self._load_data()
|
self._load_data()
|
||||||
|
|
||||||
# Duplikat-Warnung nur im Edit-Modus (um bestehende Aufrufer nicht bei jeder XML zu stören)
|
|
||||||
if self.edit_mode:
|
|
||||||
self._warn_on_duplicate_xsl_ids()
|
|
||||||
|
|
||||||
def _setup_tree(self):
|
def _setup_tree(self):
|
||||||
"""Konfiguriert das TreeWidget."""
|
"""Konfiguriert das TreeWidget."""
|
||||||
# Spaltenbreiten setzen
|
# Spaltenbreiten setzen
|
||||||
@@ -138,17 +111,11 @@ class XmlToXslAssignDialog(QDialog):
|
|||||||
# Erstelle zentrierte Checkbox für XSL-Knoten
|
# Erstelle zentrierte Checkbox für XSL-Knoten
|
||||||
checkbox_widget, checkbox = self._create_centered_checkbox()
|
checkbox_widget, checkbox = self._create_centered_checkbox()
|
||||||
|
|
||||||
# Vorauswahl setzen, wenn ID in preselected_xsl_ids
|
|
||||||
if node.id in self.preselected_xsl_ids:
|
|
||||||
checkbox.setChecked(True)
|
|
||||||
self._initial_selected_ids.add(node.id)
|
|
||||||
|
|
||||||
# Setze das Widget in Spalte 2
|
# Setze das Widget in Spalte 2
|
||||||
self.ui.xslNodesTree.setItemWidget(item, 2, checkbox_widget)
|
self.ui.xslNodesTree.setItemWidget(item, 2, checkbox_widget)
|
||||||
|
|
||||||
# Speichere Checkbox- und Node-Referenzen (id() als Key, da XSL-IDs theoretisch doppelt sein können)
|
# Speichere Checkbox-Referenz
|
||||||
self.xsl_checkboxes[id(node)] = checkbox
|
self.xsl_checkboxes[id(node)] = checkbox
|
||||||
self.xsl_nodes[id(node)] = node
|
|
||||||
|
|
||||||
logger.debug(f"Checkbox für XSL-Knoten '{node.bez}' hinzugefügt")
|
logger.debug(f"Checkbox für XSL-Knoten '{node.bez}' hinzugefügt")
|
||||||
|
|
||||||
@@ -174,8 +141,6 @@ class XmlToXslAssignDialog(QDialog):
|
|||||||
# TreeWidget leeren
|
# TreeWidget leeren
|
||||||
self.ui.xslNodesTree.clear()
|
self.ui.xslNodesTree.clear()
|
||||||
self.xsl_checkboxes.clear()
|
self.xsl_checkboxes.clear()
|
||||||
self.xsl_nodes.clear()
|
|
||||||
self._initial_selected_ids.clear()
|
|
||||||
|
|
||||||
# Sortiere Root-Nodes alphabetisch nach ID
|
# Sortiere Root-Nodes alphabetisch nach ID
|
||||||
sorted_nodes = sorted(self.project_nodes, key=lambda node: node.id)
|
sorted_nodes = sorted(self.project_nodes, key=lambda node: node.id)
|
||||||
@@ -330,66 +295,16 @@ class XmlToXslAssignDialog(QDialog):
|
|||||||
"""
|
"""
|
||||||
return self.ui.alle_xml.isChecked()
|
return self.ui.alle_xml.isChecked()
|
||||||
|
|
||||||
def get_selection_diff(self) -> tuple[list, list]:
|
|
||||||
"""
|
|
||||||
Gibt die Änderungen der Auswahl gegenüber der Vorauswahl zurück.
|
|
||||||
Nützlich im Edit-Modus, um nur die tatsächlich geänderten Zuordnungen zu verarbeiten.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple[list[XslFile], list[XslFile]]: (added_nodes, removed_nodes)
|
|
||||||
- added_nodes: XslFile-Objekte, die neu angehakt wurden
|
|
||||||
- removed_nodes: XslFile-Objekte, deren Haken entfernt wurde
|
|
||||||
"""
|
|
||||||
added_nodes = []
|
|
||||||
removed_nodes = []
|
|
||||||
|
|
||||||
for py_id, checkbox in self.xsl_checkboxes.items():
|
|
||||||
node = self.xsl_nodes.get(py_id)
|
|
||||||
if node is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
was_selected = node.id in self._initial_selected_ids
|
|
||||||
is_selected = checkbox.isChecked()
|
|
||||||
|
|
||||||
if is_selected and not was_selected:
|
|
||||||
added_nodes.append(node)
|
|
||||||
elif not is_selected and was_selected:
|
|
||||||
removed_nodes.append(node)
|
|
||||||
|
|
||||||
return added_nodes, removed_nodes
|
|
||||||
|
|
||||||
def _warn_on_duplicate_xsl_ids(self):
|
|
||||||
"""
|
|
||||||
Zeigt eine Warnung, wenn im Projekt mehrere XslFile-Instanzen mit identischer ID existieren.
|
|
||||||
Die ID soll eindeutig sein - Duplikate weisen auf einen Datenfehler hin.
|
|
||||||
"""
|
|
||||||
id_to_nodes: dict = {}
|
|
||||||
for py_id, node in self.xsl_nodes.items():
|
|
||||||
id_to_nodes.setdefault(node.id, []).append(node)
|
|
||||||
|
|
||||||
duplicates = {xsl_id: nodes for xsl_id, nodes in id_to_nodes.items() if len(nodes) > 1}
|
|
||||||
if not duplicates:
|
|
||||||
return
|
|
||||||
|
|
||||||
dup_lines = [f" - ID {xsl_id}: {len(nodes)}× ({', '.join(n.bez for n in nodes)})" for xsl_id, nodes in duplicates.items()]
|
|
||||||
logger.warning(f"Doppelte XSL-IDs im Projekt gefunden:\n{chr(10).join(dup_lines)}")
|
|
||||||
QMessageBox.warning(
|
|
||||||
self,
|
|
||||||
"Doppelte XSL-IDs",
|
|
||||||
"Im Projekt existieren XSL-Knoten mit identischer ID. "
|
|
||||||
"Die IDs sollten eindeutig sein:\n\n" + "\n".join(dup_lines),
|
|
||||||
)
|
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
"""Überschreibt accept() um Validierung durchzuführen."""
|
"""Überschreibt accept() um Validierung durchzuführen."""
|
||||||
# Im Edit-Modus: 0 Auswahlen erlauben (bedeutet: XML überall entfernen)
|
|
||||||
if self.edit_mode:
|
|
||||||
super().accept()
|
|
||||||
return
|
|
||||||
|
|
||||||
selected_nodes = self.get_selected_xsl_nodes()
|
selected_nodes = self.get_selected_xsl_nodes()
|
||||||
|
|
||||||
if not selected_nodes:
|
if not selected_nodes:
|
||||||
QMessageBox.warning(self, "Warnung", "Bitte wählen Sie mindestens einen XSL-Knoten aus.")
|
QMessageBox.warning(
|
||||||
|
self,
|
||||||
|
"Warnung",
|
||||||
|
"Bitte wählen Sie mindestens einen XSL-Knoten aus."
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
super().accept()
|
super().accept()
|
||||||
|
|||||||
@@ -42,16 +42,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="xslNodesTree">
|
<widget class="QTreeWidget" name="xslNodesTree">
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"> QTreeWidget::item {
|
|
||||||
padding: 4px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTreeWidget::item:selected {
|
|
||||||
background-color: palette(highlight);
|
|
||||||
color: palette(highlighted-text);
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="headerHidden">
|
<property name="headerHidden">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
## Form generated from reading UI file 'XmlToXslAssignDialog.ui'
|
## Form generated from reading UI file 'XmlToXslAssignDialog.ui'
|
||||||
##
|
##
|
||||||
## Created by: Qt User Interface Compiler version 6.10.1
|
## Created by: Qt User Interface Compiler version 6.9.2
|
||||||
##
|
##
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -42,14 +42,6 @@ class Ui_XmlToXslAssignDialog(object):
|
|||||||
|
|
||||||
self.xslNodesTree = QTreeWidget(XmlToXslAssignDialog)
|
self.xslNodesTree = QTreeWidget(XmlToXslAssignDialog)
|
||||||
self.xslNodesTree.setObjectName(u"xslNodesTree")
|
self.xslNodesTree.setObjectName(u"xslNodesTree")
|
||||||
self.xslNodesTree.setStyleSheet(u" QTreeWidget::item {\n"
|
|
||||||
" padding: 4px 4px;\n"
|
|
||||||
" }\n"
|
|
||||||
"\n"
|
|
||||||
"QTreeWidget::item:selected {\n"
|
|
||||||
" background-color: palette(highlight);\n"
|
|
||||||
" color: palette(highlighted-text);\n"
|
|
||||||
"}")
|
|
||||||
self.xslNodesTree.setHeaderHidden(False)
|
self.xslNodesTree.setHeaderHidden(False)
|
||||||
self.xslNodesTree.setColumnCount(3)
|
self.xslNodesTree.setColumnCount(3)
|
||||||
self.xslNodesTree.header().setVisible(True)
|
self.xslNodesTree.header().setVisible(True)
|
||||||
|
|||||||
@@ -1,349 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>XslDependencyDialog</class>
|
|
||||||
<widget class="QDialog" name="XslDependencyDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1000</width>
|
|
||||||
<height>700</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>XSL-Abhängigkeitsgraph</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="toolbarLayout">
|
|
||||||
<item>
|
|
||||||
<spacer name="toolbarSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="settingsButton">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>28</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Einstellungen ein-/ausblenden</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="applications-system"/>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSplitter" name="mainSplitter">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="childrenCollapsible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="treeTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Baumansicht</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="treeTabLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QSplitter" name="splitter">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="leftWidget" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="leftLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="leftLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>XSL-Dateien</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeWidget" name="fileTree">
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="rootIsDecorated">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">1</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="rightWidget" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="rightLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="rightLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Abhängigkeiten</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeWidget" name="depTree">
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="rootIsDecorated">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">1</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="graphTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Netzwerkgraph</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="graphTabLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="graphContainer" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="graphContainerLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="sidebarWidget" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="sidebarLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="sidebarLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Einstellungen</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="searchLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Suche:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="searchEdit">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>XSL-Datei filtern...</string>
|
|
||||||
</property>
|
|
||||||
<property name="clearButtonEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QStackedWidget" name="settingsStack">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="treeSettingsPage">
|
|
||||||
<layout class="QVBoxLayout" name="treeSettingsLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="treeSettingsLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Baumansicht-Einstellungen</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="treeSettingsSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="graphSettingsPage">
|
|
||||||
<layout class="QVBoxLayout" name="graphSettingsLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="graphSettingsLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Graph-Einstellungen</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="graphFilterConnectedCheck">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Entfernt alle XSL-Dateien aus dem Graph, die nicht zum Suchbegriff passen und nicht direkt oder indirekt mit passenden Dateien verbunden sind</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Nur von der Suche betroffene Dateien anzeigen</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="graphSettingsSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="statusLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::StandardButton::Close</set>
|
|
||||||
</property>
|
|
||||||
<property name="centerButtons">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>XslDependencyDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>500</x>
|
|
||||||
<y>678</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>500</x>
|
|
||||||
<y>350</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
## Form generated from reading UI file 'XslDependencyDialog.ui'
|
|
||||||
##
|
|
||||||
## Created by: Qt User Interface Compiler version 6.10.1
|
|
||||||
##
|
|
||||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
|
||||||
QMetaObject, QObject, QPoint, QRect,
|
|
||||||
QSize, QTime, QUrl, Qt)
|
|
||||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
|
||||||
QFont, QFontDatabase, QGradient, QIcon,
|
|
||||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
|
||||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
|
||||||
from PySide6.QtWidgets import (QAbstractButton, QAbstractItemView, QApplication, QCheckBox,
|
|
||||||
QDialog, QDialogButtonBox, QHBoxLayout, QHeaderView,
|
|
||||||
QLabel, QLineEdit, QPushButton, QSizePolicy,
|
|
||||||
QSpacerItem, QSplitter, QStackedWidget, QTabWidget,
|
|
||||||
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget)
|
|
||||||
|
|
||||||
class Ui_XslDependencyDialog(object):
|
|
||||||
def setupUi(self, XslDependencyDialog):
|
|
||||||
if not XslDependencyDialog.objectName():
|
|
||||||
XslDependencyDialog.setObjectName(u"XslDependencyDialog")
|
|
||||||
XslDependencyDialog.resize(1000, 700)
|
|
||||||
self.verticalLayout = QVBoxLayout(XslDependencyDialog)
|
|
||||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
|
||||||
self.toolbarLayout = QHBoxLayout()
|
|
||||||
self.toolbarLayout.setObjectName(u"toolbarLayout")
|
|
||||||
self.toolbarSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
|
||||||
|
|
||||||
self.toolbarLayout.addItem(self.toolbarSpacer)
|
|
||||||
|
|
||||||
self.settingsButton = QPushButton(XslDependencyDialog)
|
|
||||||
self.settingsButton.setObjectName(u"settingsButton")
|
|
||||||
self.settingsButton.setMaximumSize(QSize(28, 28))
|
|
||||||
icon = QIcon(QIcon.fromTheme(u"applications-system"))
|
|
||||||
self.settingsButton.setIcon(icon)
|
|
||||||
self.settingsButton.setFlat(True)
|
|
||||||
|
|
||||||
self.toolbarLayout.addWidget(self.settingsButton)
|
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout.addLayout(self.toolbarLayout)
|
|
||||||
|
|
||||||
self.mainSplitter = QSplitter(XslDependencyDialog)
|
|
||||||
self.mainSplitter.setObjectName(u"mainSplitter")
|
|
||||||
self.mainSplitter.setOrientation(Qt.Orientation.Horizontal)
|
|
||||||
self.mainSplitter.setChildrenCollapsible(True)
|
|
||||||
self.tabWidget = QTabWidget(self.mainSplitter)
|
|
||||||
self.tabWidget.setObjectName(u"tabWidget")
|
|
||||||
self.treeTab = QWidget()
|
|
||||||
self.treeTab.setObjectName(u"treeTab")
|
|
||||||
self.treeTabLayout = QVBoxLayout(self.treeTab)
|
|
||||||
self.treeTabLayout.setObjectName(u"treeTabLayout")
|
|
||||||
self.splitter = QSplitter(self.treeTab)
|
|
||||||
self.splitter.setObjectName(u"splitter")
|
|
||||||
self.splitter.setOrientation(Qt.Orientation.Horizontal)
|
|
||||||
self.leftWidget = QWidget(self.splitter)
|
|
||||||
self.leftWidget.setObjectName(u"leftWidget")
|
|
||||||
self.leftLayout = QVBoxLayout(self.leftWidget)
|
|
||||||
self.leftLayout.setObjectName(u"leftLayout")
|
|
||||||
self.leftLayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.leftLabel = QLabel(self.leftWidget)
|
|
||||||
self.leftLabel.setObjectName(u"leftLabel")
|
|
||||||
|
|
||||||
self.leftLayout.addWidget(self.leftLabel)
|
|
||||||
|
|
||||||
self.fileTree = QTreeWidget(self.leftWidget)
|
|
||||||
__qtreewidgetitem = QTreeWidgetItem()
|
|
||||||
__qtreewidgetitem.setText(0, u"1");
|
|
||||||
self.fileTree.setHeaderItem(__qtreewidgetitem)
|
|
||||||
self.fileTree.setObjectName(u"fileTree")
|
|
||||||
self.fileTree.setAlternatingRowColors(True)
|
|
||||||
self.fileTree.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
|
||||||
self.fileTree.setRootIsDecorated(True)
|
|
||||||
|
|
||||||
self.leftLayout.addWidget(self.fileTree)
|
|
||||||
|
|
||||||
self.splitter.addWidget(self.leftWidget)
|
|
||||||
self.rightWidget = QWidget(self.splitter)
|
|
||||||
self.rightWidget.setObjectName(u"rightWidget")
|
|
||||||
self.rightLayout = QVBoxLayout(self.rightWidget)
|
|
||||||
self.rightLayout.setObjectName(u"rightLayout")
|
|
||||||
self.rightLayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.rightLabel = QLabel(self.rightWidget)
|
|
||||||
self.rightLabel.setObjectName(u"rightLabel")
|
|
||||||
|
|
||||||
self.rightLayout.addWidget(self.rightLabel)
|
|
||||||
|
|
||||||
self.depTree = QTreeWidget(self.rightWidget)
|
|
||||||
__qtreewidgetitem1 = QTreeWidgetItem()
|
|
||||||
__qtreewidgetitem1.setText(0, u"1");
|
|
||||||
self.depTree.setHeaderItem(__qtreewidgetitem1)
|
|
||||||
self.depTree.setObjectName(u"depTree")
|
|
||||||
self.depTree.setAlternatingRowColors(True)
|
|
||||||
self.depTree.setRootIsDecorated(True)
|
|
||||||
|
|
||||||
self.rightLayout.addWidget(self.depTree)
|
|
||||||
|
|
||||||
self.splitter.addWidget(self.rightWidget)
|
|
||||||
|
|
||||||
self.treeTabLayout.addWidget(self.splitter)
|
|
||||||
|
|
||||||
self.tabWidget.addTab(self.treeTab, "")
|
|
||||||
self.graphTab = QWidget()
|
|
||||||
self.graphTab.setObjectName(u"graphTab")
|
|
||||||
self.graphTabLayout = QVBoxLayout(self.graphTab)
|
|
||||||
self.graphTabLayout.setObjectName(u"graphTabLayout")
|
|
||||||
self.graphTabLayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.graphContainer = QWidget(self.graphTab)
|
|
||||||
self.graphContainer.setObjectName(u"graphContainer")
|
|
||||||
self.graphContainerLayout = QVBoxLayout(self.graphContainer)
|
|
||||||
self.graphContainerLayout.setObjectName(u"graphContainerLayout")
|
|
||||||
self.graphContainerLayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
|
|
||||||
self.graphTabLayout.addWidget(self.graphContainer)
|
|
||||||
|
|
||||||
self.tabWidget.addTab(self.graphTab, "")
|
|
||||||
self.mainSplitter.addWidget(self.tabWidget)
|
|
||||||
self.sidebarWidget = QWidget(self.mainSplitter)
|
|
||||||
self.sidebarWidget.setObjectName(u"sidebarWidget")
|
|
||||||
self.sidebarLayout = QVBoxLayout(self.sidebarWidget)
|
|
||||||
self.sidebarLayout.setObjectName(u"sidebarLayout")
|
|
||||||
self.sidebarLabel = QLabel(self.sidebarWidget)
|
|
||||||
self.sidebarLabel.setObjectName(u"sidebarLabel")
|
|
||||||
font = QFont()
|
|
||||||
font.setBold(True)
|
|
||||||
self.sidebarLabel.setFont(font)
|
|
||||||
|
|
||||||
self.sidebarLayout.addWidget(self.sidebarLabel)
|
|
||||||
|
|
||||||
self.searchLabel = QLabel(self.sidebarWidget)
|
|
||||||
self.searchLabel.setObjectName(u"searchLabel")
|
|
||||||
|
|
||||||
self.sidebarLayout.addWidget(self.searchLabel)
|
|
||||||
|
|
||||||
self.searchEdit = QLineEdit(self.sidebarWidget)
|
|
||||||
self.searchEdit.setObjectName(u"searchEdit")
|
|
||||||
self.searchEdit.setClearButtonEnabled(True)
|
|
||||||
|
|
||||||
self.sidebarLayout.addWidget(self.searchEdit)
|
|
||||||
|
|
||||||
self.settingsStack = QStackedWidget(self.sidebarWidget)
|
|
||||||
self.settingsStack.setObjectName(u"settingsStack")
|
|
||||||
self.treeSettingsPage = QWidget()
|
|
||||||
self.treeSettingsPage.setObjectName(u"treeSettingsPage")
|
|
||||||
self.treeSettingsLayout = QVBoxLayout(self.treeSettingsPage)
|
|
||||||
self.treeSettingsLayout.setObjectName(u"treeSettingsLayout")
|
|
||||||
self.treeSettingsLabel = QLabel(self.treeSettingsPage)
|
|
||||||
self.treeSettingsLabel.setObjectName(u"treeSettingsLabel")
|
|
||||||
|
|
||||||
self.treeSettingsLayout.addWidget(self.treeSettingsLabel)
|
|
||||||
|
|
||||||
self.treeSettingsSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
|
|
||||||
|
|
||||||
self.treeSettingsLayout.addItem(self.treeSettingsSpacer)
|
|
||||||
|
|
||||||
self.settingsStack.addWidget(self.treeSettingsPage)
|
|
||||||
self.graphSettingsPage = QWidget()
|
|
||||||
self.graphSettingsPage.setObjectName(u"graphSettingsPage")
|
|
||||||
self.graphSettingsLayout = QVBoxLayout(self.graphSettingsPage)
|
|
||||||
self.graphSettingsLayout.setObjectName(u"graphSettingsLayout")
|
|
||||||
self.graphSettingsLabel = QLabel(self.graphSettingsPage)
|
|
||||||
self.graphSettingsLabel.setObjectName(u"graphSettingsLabel")
|
|
||||||
|
|
||||||
self.graphSettingsLayout.addWidget(self.graphSettingsLabel)
|
|
||||||
|
|
||||||
self.graphFilterConnectedCheck = QCheckBox(self.graphSettingsPage)
|
|
||||||
self.graphFilterConnectedCheck.setObjectName(u"graphFilterConnectedCheck")
|
|
||||||
self.graphFilterConnectedCheck.setChecked(True)
|
|
||||||
|
|
||||||
self.graphSettingsLayout.addWidget(self.graphFilterConnectedCheck)
|
|
||||||
|
|
||||||
self.graphSettingsSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
|
|
||||||
|
|
||||||
self.graphSettingsLayout.addItem(self.graphSettingsSpacer)
|
|
||||||
|
|
||||||
self.settingsStack.addWidget(self.graphSettingsPage)
|
|
||||||
|
|
||||||
self.sidebarLayout.addWidget(self.settingsStack)
|
|
||||||
|
|
||||||
self.mainSplitter.addWidget(self.sidebarWidget)
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.mainSplitter)
|
|
||||||
|
|
||||||
self.statusLabel = QLabel(XslDependencyDialog)
|
|
||||||
self.statusLabel.setObjectName(u"statusLabel")
|
|
||||||
sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Maximum)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(self.statusLabel.sizePolicy().hasHeightForWidth())
|
|
||||||
self.statusLabel.setSizePolicy(sizePolicy)
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.statusLabel)
|
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(XslDependencyDialog)
|
|
||||||
self.buttonBox.setObjectName(u"buttonBox")
|
|
||||||
self.buttonBox.setOrientation(Qt.Orientation.Horizontal)
|
|
||||||
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Close)
|
|
||||||
self.buttonBox.setCenterButtons(True)
|
|
||||||
|
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
|
||||||
|
|
||||||
|
|
||||||
self.retranslateUi(XslDependencyDialog)
|
|
||||||
self.buttonBox.rejected.connect(XslDependencyDialog.reject)
|
|
||||||
|
|
||||||
self.tabWidget.setCurrentIndex(0)
|
|
||||||
self.settingsStack.setCurrentIndex(0)
|
|
||||||
|
|
||||||
|
|
||||||
QMetaObject.connectSlotsByName(XslDependencyDialog)
|
|
||||||
# setupUi
|
|
||||||
|
|
||||||
def retranslateUi(self, XslDependencyDialog):
|
|
||||||
XslDependencyDialog.setWindowTitle(QCoreApplication.translate("XslDependencyDialog", u"XSL-Abh\u00e4ngigkeitsgraph", None))
|
|
||||||
#if QT_CONFIG(tooltip)
|
|
||||||
self.settingsButton.setToolTip(QCoreApplication.translate("XslDependencyDialog", u"Einstellungen ein-/ausblenden", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.settingsButton.setText("")
|
|
||||||
self.leftLabel.setText(QCoreApplication.translate("XslDependencyDialog", u"XSL-Dateien", None))
|
|
||||||
self.rightLabel.setText(QCoreApplication.translate("XslDependencyDialog", u"Abh\u00e4ngigkeiten", None))
|
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.treeTab), QCoreApplication.translate("XslDependencyDialog", u"Baumansicht", None))
|
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.graphTab), QCoreApplication.translate("XslDependencyDialog", u"Netzwerkgraph", None))
|
|
||||||
self.sidebarLabel.setText(QCoreApplication.translate("XslDependencyDialog", u"Einstellungen", None))
|
|
||||||
self.searchLabel.setText(QCoreApplication.translate("XslDependencyDialog", u"Suche:", None))
|
|
||||||
self.searchEdit.setPlaceholderText(QCoreApplication.translate("XslDependencyDialog", u"XSL-Datei filtern...", None))
|
|
||||||
self.treeSettingsLabel.setText(QCoreApplication.translate("XslDependencyDialog", u"Baumansicht-Einstellungen", None))
|
|
||||||
self.graphSettingsLabel.setText(QCoreApplication.translate("XslDependencyDialog", u"Graph-Einstellungen", None))
|
|
||||||
#if QT_CONFIG(tooltip)
|
|
||||||
self.graphFilterConnectedCheck.setToolTip(QCoreApplication.translate("XslDependencyDialog", u"Entfernt alle XSL-Dateien aus dem Graph, die nicht zum Suchbegriff passen und nicht direkt oder indirekt mit passenden Dateien verbunden sind", None))
|
|
||||||
#endif // QT_CONFIG(tooltip)
|
|
||||||
self.graphFilterConnectedCheck.setText(QCoreApplication.translate("XslDependencyDialog", u"Nur von der Suche betroffene Dateien anzeigen", None))
|
|
||||||
self.statusLabel.setText("")
|
|
||||||
# retranslateUi
|
|
||||||
|
|
||||||
@@ -1,16 +1,161 @@
|
|||||||
|
from PySide6.QtWidgets import QDialog, QTableWidgetItem, QMessageBox
|
||||||
|
from PySide6.QtCore import Qt
|
||||||
|
|
||||||
from ui.XslFileEditDialog_ui import Ui_XslFileEditDialog
|
from ui.XslFileEditDialog_ui import Ui_XslFileEditDialog
|
||||||
from ui.XsltParamsEditDialog import XsltParamsEditDialog
|
|
||||||
|
|
||||||
|
|
||||||
class XslFileEditDialog(XsltParamsEditDialog):
|
class XslFileEditDialog(QDialog):
|
||||||
"""Dialog zur Bearbeitung von XslFile-Objekten."""
|
"""Dialog zur Bearbeitung von XslFile-Objekten."""
|
||||||
|
|
||||||
def _create_ui(self):
|
def __init__(self, parent=None, node=None, parent_params=None):
|
||||||
return Ui_XslFileEditDialog()
|
"""
|
||||||
|
Initialisiert den Dialog.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent: Übergeordnetes Widget
|
||||||
|
node: XslFile-Objekt zum Bearbeiten
|
||||||
|
parent_params: Dictionary mit Eltern-Parametern (nur anzeigen)
|
||||||
|
"""
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
# UI einrichten
|
||||||
|
self.ui = Ui_XslFileEditDialog()
|
||||||
|
self.ui.setupUi(self)
|
||||||
|
|
||||||
|
# Node-Objekt speichern
|
||||||
|
self.node = node
|
||||||
|
self.parent_params = parent_params or {}
|
||||||
|
|
||||||
|
# Signale verbinden
|
||||||
|
self.ui.addParamButton.clicked.connect(self.add_parameter)
|
||||||
|
self.ui.removeParamButton.clicked.connect(self.remove_parameter)
|
||||||
|
|
||||||
|
# Tabellen konfigurieren
|
||||||
|
self._setup_tables()
|
||||||
|
|
||||||
|
# Daten laden
|
||||||
|
if self.node:
|
||||||
|
self._load_data()
|
||||||
|
|
||||||
|
def _setup_tables(self):
|
||||||
|
"""Konfiguriert die Tabellen."""
|
||||||
|
# XSLT Parameter Tabelle
|
||||||
|
self.ui.xsltParamsTable.setColumnWidth(0, 200)
|
||||||
|
self.ui.xsltParamsTable.setColumnWidth(1, 300)
|
||||||
|
self.ui.xsltParamsTable.horizontalHeader().setStretchLastSection(True)
|
||||||
|
|
||||||
|
# Eltern-Parameter Tabelle
|
||||||
|
self.ui.parentParamsTable.setColumnWidth(0, 200)
|
||||||
|
self.ui.parentParamsTable.setColumnWidth(1, 300)
|
||||||
|
self.ui.parentParamsTable.horizontalHeader().setStretchLastSection(True)
|
||||||
|
|
||||||
def _load_data(self):
|
def _load_data(self):
|
||||||
"""Lädt die Daten des XslFile-Knotens in den Dialog."""
|
"""Lädt die Daten des XslFile in den Dialog."""
|
||||||
if not self.node:
|
if not self.node:
|
||||||
return
|
return
|
||||||
self.ui.xslFileValueLabel.setText(str(self.node.xsl_file) if self.node.xsl_file else "")
|
|
||||||
super()._load_data()
|
# Bezeichnung setzen
|
||||||
|
self.ui.bezEdit.setText(str(self.node.bez) if self.node.bez else "")
|
||||||
|
|
||||||
|
# XSLT Parameter laden
|
||||||
|
self._load_xslt_params()
|
||||||
|
|
||||||
|
# Eltern-Parameter laden
|
||||||
|
self._load_parent_params()
|
||||||
|
|
||||||
|
def _load_xslt_params(self):
|
||||||
|
"""Lädt die XSLT Parameter in die Tabelle."""
|
||||||
|
if not self.node or not self.node.xslt_params:
|
||||||
|
return
|
||||||
|
|
||||||
|
params = self.node.xslt_params
|
||||||
|
self.ui.xsltParamsTable.setRowCount(len(params))
|
||||||
|
|
||||||
|
for row, (key, value) in enumerate(params.items()):
|
||||||
|
# Parameter-Name
|
||||||
|
key_item = QTableWidgetItem(str(key))
|
||||||
|
self.ui.xsltParamsTable.setItem(row, 0, key_item)
|
||||||
|
|
||||||
|
# Parameter-Wert
|
||||||
|
value_item = QTableWidgetItem(str(value))
|
||||||
|
self.ui.xsltParamsTable.setItem(row, 1, value_item)
|
||||||
|
|
||||||
|
def _load_parent_params(self):
|
||||||
|
"""Lädt die Eltern-Parameter in die Tabelle (nur anzeigen)."""
|
||||||
|
if not self.parent_params:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.ui.parentParamsTable.setRowCount(len(self.parent_params))
|
||||||
|
|
||||||
|
for row, (key, value) in enumerate(self.parent_params.items()):
|
||||||
|
# Parameter-Name
|
||||||
|
key_item = QTableWidgetItem(str(key))
|
||||||
|
key_item.setFlags(key_item.flags() & ~Qt.ItemFlag.ItemIsEditable)
|
||||||
|
self.ui.parentParamsTable.setItem(row, 0, key_item)
|
||||||
|
|
||||||
|
# Parameter-Wert
|
||||||
|
value_item = QTableWidgetItem(str(value))
|
||||||
|
value_item.setFlags(value_item.flags() & ~Qt.ItemFlag.ItemIsEditable)
|
||||||
|
self.ui.parentParamsTable.setItem(row, 1, value_item)
|
||||||
|
|
||||||
|
def add_parameter(self):
|
||||||
|
"""Fügt einen neuen Parameter hinzu."""
|
||||||
|
row_count = self.ui.xsltParamsTable.rowCount()
|
||||||
|
self.ui.xsltParamsTable.insertRow(row_count)
|
||||||
|
|
||||||
|
# Leere Items hinzufügen
|
||||||
|
key_item = QTableWidgetItem("")
|
||||||
|
value_item = QTableWidgetItem("")
|
||||||
|
|
||||||
|
self.ui.xsltParamsTable.setItem(row_count, 0, key_item)
|
||||||
|
self.ui.xsltParamsTable.setItem(row_count, 1, value_item)
|
||||||
|
|
||||||
|
# Fokus auf den neuen Parameter setzen
|
||||||
|
self.ui.xsltParamsTable.setCurrentCell(row_count, 0)
|
||||||
|
|
||||||
|
def remove_parameter(self):
|
||||||
|
"""Entfernt den ausgewählten Parameter."""
|
||||||
|
current_row = self.ui.xsltParamsTable.currentRow()
|
||||||
|
if current_row >= 0:
|
||||||
|
self.ui.xsltParamsTable.removeRow(current_row)
|
||||||
|
|
||||||
|
def get_data(self):
|
||||||
|
"""
|
||||||
|
Gibt die bearbeiteten Daten zurück.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: Dictionary mit den bearbeiteten Daten oder None bei Fehler
|
||||||
|
"""
|
||||||
|
# Bezeichnung prüfen
|
||||||
|
bez = self.ui.bezEdit.text().strip()
|
||||||
|
if not bez:
|
||||||
|
QMessageBox.warning(self, "Warnung", "Bitte geben Sie eine Bezeichnung ein.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
# XSLT Parameter sammeln
|
||||||
|
xslt_params = {}
|
||||||
|
for row in range(self.ui.xsltParamsTable.rowCount()):
|
||||||
|
key_item = self.ui.xsltParamsTable.item(row, 0)
|
||||||
|
value_item = self.ui.xsltParamsTable.item(row, 1)
|
||||||
|
|
||||||
|
if key_item and value_item:
|
||||||
|
key = key_item.text().strip()
|
||||||
|
value = value_item.text().strip()
|
||||||
|
|
||||||
|
if key: # Nur Parameter mit nicht-leerem Schlüssel hinzufügen
|
||||||
|
xslt_params[key] = value
|
||||||
|
|
||||||
|
# CheckBox für Force-Transformation prüfen
|
||||||
|
force_transform = self.ui.alle_xml_transformieren.isChecked()
|
||||||
|
|
||||||
|
return {
|
||||||
|
"bez": bez,
|
||||||
|
"xslt_params": xslt_params,
|
||||||
|
"force_transform": force_transform
|
||||||
|
}
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
"""Überschreibt accept() um Datenvalidierung durchzuführen."""
|
||||||
|
data = self.get_data()
|
||||||
|
if data is not None:
|
||||||
|
super().accept()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>865</width>
|
<width>865</width>
|
||||||
<height>403</height>
|
<height>400</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -23,30 +23,13 @@
|
|||||||
<enum>QLayout::SizeConstraint::SetMaximumSize</enum>
|
<enum>QLayout::SizeConstraint::SetMaximumSize</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="xslFileLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>XSL-Datei:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="xslFileValueLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="bezLabel">
|
<widget class="QLabel" name="bezLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bezeichnung:</string>
|
<string>Bezeichnung:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="bezEdit"/>
|
<widget class="QLineEdit" name="bezEdit"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -33,26 +33,15 @@ class Ui_XslFileEditDialog(object):
|
|||||||
self.formLayout = QFormLayout()
|
self.formLayout = QFormLayout()
|
||||||
self.formLayout.setObjectName(u"formLayout")
|
self.formLayout.setObjectName(u"formLayout")
|
||||||
self.formLayout.setSizeConstraint(QLayout.SizeConstraint.SetMaximumSize)
|
self.formLayout.setSizeConstraint(QLayout.SizeConstraint.SetMaximumSize)
|
||||||
self.xslFileLabel = QLabel(XslFileEditDialog)
|
|
||||||
self.xslFileLabel.setObjectName(u"xslFileLabel")
|
|
||||||
|
|
||||||
self.formLayout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.xslFileLabel)
|
|
||||||
|
|
||||||
self.xslFileValueLabel = QLabel(XslFileEditDialog)
|
|
||||||
self.xslFileValueLabel.setObjectName(u"xslFileValueLabel")
|
|
||||||
self.xslFileValueLabel.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
|
|
||||||
|
|
||||||
self.formLayout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.xslFileValueLabel)
|
|
||||||
|
|
||||||
self.bezLabel = QLabel(XslFileEditDialog)
|
self.bezLabel = QLabel(XslFileEditDialog)
|
||||||
self.bezLabel.setObjectName(u"bezLabel")
|
self.bezLabel.setObjectName(u"bezLabel")
|
||||||
|
|
||||||
self.formLayout.setWidget(1, QFormLayout.ItemRole.LabelRole, self.bezLabel)
|
self.formLayout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.bezLabel)
|
||||||
|
|
||||||
self.bezEdit = QLineEdit(XslFileEditDialog)
|
self.bezEdit = QLineEdit(XslFileEditDialog)
|
||||||
self.bezEdit.setObjectName(u"bezEdit")
|
self.bezEdit.setObjectName(u"bezEdit")
|
||||||
|
|
||||||
self.formLayout.setWidget(1, QFormLayout.ItemRole.FieldRole, self.bezEdit)
|
self.formLayout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.bezEdit)
|
||||||
|
|
||||||
|
|
||||||
self.verticalLayout.addLayout(self.formLayout)
|
self.verticalLayout.addLayout(self.formLayout)
|
||||||
@@ -162,8 +151,6 @@ class Ui_XslFileEditDialog(object):
|
|||||||
|
|
||||||
def retranslateUi(self, XslFileEditDialog):
|
def retranslateUi(self, XslFileEditDialog):
|
||||||
XslFileEditDialog.setWindowTitle(QCoreApplication.translate("XslFileEditDialog", u"XSL-Datei bearbeiten", None))
|
XslFileEditDialog.setWindowTitle(QCoreApplication.translate("XslFileEditDialog", u"XSL-Datei bearbeiten", None))
|
||||||
self.xslFileLabel.setText(QCoreApplication.translate("XslFileEditDialog", u"XSL-Datei:", None))
|
|
||||||
self.xslFileValueLabel.setText("")
|
|
||||||
self.bezLabel.setText(QCoreApplication.translate("XslFileEditDialog", u"Bezeichnung:", None))
|
self.bezLabel.setText(QCoreApplication.translate("XslFileEditDialog", u"Bezeichnung:", None))
|
||||||
self.xsltParamsGroupBox.setTitle(QCoreApplication.translate("XslFileEditDialog", u"XSLT-Parameter", None))
|
self.xsltParamsGroupBox.setTitle(QCoreApplication.translate("XslFileEditDialog", u"XSLT-Parameter", None))
|
||||||
___qtablewidgetitem = self.xsltParamsTable.horizontalHeaderItem(0)
|
___qtablewidgetitem = self.xsltParamsTable.horizontalHeaderItem(0)
|
||||||
|
|||||||
@@ -1,124 +0,0 @@
|
|||||||
from PySide6.QtWidgets import QDialog, QTableWidgetItem, QMessageBox
|
|
||||||
from PySide6.QtCore import Qt
|
|
||||||
from icons import icon
|
|
||||||
|
|
||||||
|
|
||||||
class XsltParamsEditDialog(QDialog):
|
|
||||||
"""Gemeinsame Basisklasse für Dialoge zur Bearbeitung von XSLT-Parametern."""
|
|
||||||
|
|
||||||
def __init__(self, parent=None, node=None, parent_params=None):
|
|
||||||
super().__init__(parent)
|
|
||||||
|
|
||||||
self.ui = self._create_ui()
|
|
||||||
self.ui.setupUi(self)
|
|
||||||
|
|
||||||
self.node = node
|
|
||||||
self.parent_params = parent_params or {}
|
|
||||||
|
|
||||||
self.ui.addParamButton.setIcon(icon("plus-circle"))
|
|
||||||
self.ui.removeParamButton.setIcon(icon("minus-circle"))
|
|
||||||
|
|
||||||
self.ui.addParamButton.clicked.connect(self.add_parameter)
|
|
||||||
self.ui.removeParamButton.clicked.connect(self.remove_parameter)
|
|
||||||
|
|
||||||
self._setup_tables()
|
|
||||||
|
|
||||||
if self.node:
|
|
||||||
self._load_data()
|
|
||||||
|
|
||||||
def _create_ui(self):
|
|
||||||
"""Gibt eine Instanz der konkreten UI-Klasse zurück. Muss überschrieben werden."""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def _setup_tables(self):
|
|
||||||
"""Konfiguriert die Tabellen."""
|
|
||||||
self.ui.xsltParamsTable.setColumnWidth(0, 200)
|
|
||||||
self.ui.xsltParamsTable.setColumnWidth(1, 300)
|
|
||||||
self.ui.xsltParamsTable.horizontalHeader().setStretchLastSection(True)
|
|
||||||
|
|
||||||
self.ui.parentParamsTable.setColumnWidth(0, 200)
|
|
||||||
self.ui.parentParamsTable.setColumnWidth(1, 300)
|
|
||||||
self.ui.parentParamsTable.horizontalHeader().setStretchLastSection(True)
|
|
||||||
|
|
||||||
def _load_data(self):
|
|
||||||
"""Lädt die Daten des Knotens in den Dialog."""
|
|
||||||
if not self.node:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.ui.bezEdit.setText(str(self.node.bez) if self.node.bez else "")
|
|
||||||
self._load_xslt_params()
|
|
||||||
self._load_parent_params()
|
|
||||||
|
|
||||||
def _load_xslt_params(self):
|
|
||||||
"""Lädt die XSLT-Parameter in die Tabelle."""
|
|
||||||
if not self.node or not self.node.xslt_params:
|
|
||||||
return
|
|
||||||
|
|
||||||
params = self.node.xslt_params
|
|
||||||
self.ui.xsltParamsTable.setRowCount(len(params))
|
|
||||||
|
|
||||||
for row, (key, value) in enumerate(params.items()):
|
|
||||||
self.ui.xsltParamsTable.setItem(row, 0, QTableWidgetItem(str(key)))
|
|
||||||
self.ui.xsltParamsTable.setItem(row, 1, QTableWidgetItem(str(value)))
|
|
||||||
|
|
||||||
def _load_parent_params(self):
|
|
||||||
"""Lädt die Eltern-Parameter in die Tabelle (nur anzeigen)."""
|
|
||||||
if not self.parent_params:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.ui.parentParamsTable.setRowCount(len(self.parent_params))
|
|
||||||
|
|
||||||
for row, (key, value) in enumerate(self.parent_params.items()):
|
|
||||||
key_item = QTableWidgetItem(str(key))
|
|
||||||
key_item.setFlags(key_item.flags() & ~Qt.ItemFlag.ItemIsEditable)
|
|
||||||
self.ui.parentParamsTable.setItem(row, 0, key_item)
|
|
||||||
|
|
||||||
value_item = QTableWidgetItem(str(value))
|
|
||||||
value_item.setFlags(value_item.flags() & ~Qt.ItemFlag.ItemIsEditable)
|
|
||||||
self.ui.parentParamsTable.setItem(row, 1, value_item)
|
|
||||||
|
|
||||||
def add_parameter(self):
|
|
||||||
"""Fügt einen neuen Parameter hinzu."""
|
|
||||||
row_count = self.ui.xsltParamsTable.rowCount()
|
|
||||||
self.ui.xsltParamsTable.insertRow(row_count)
|
|
||||||
self.ui.xsltParamsTable.setItem(row_count, 0, QTableWidgetItem(""))
|
|
||||||
self.ui.xsltParamsTable.setItem(row_count, 1, QTableWidgetItem(""))
|
|
||||||
self.ui.xsltParamsTable.setCurrentCell(row_count, 0)
|
|
||||||
|
|
||||||
def remove_parameter(self):
|
|
||||||
"""Entfernt den ausgewählten Parameter."""
|
|
||||||
current_row = self.ui.xsltParamsTable.currentRow()
|
|
||||||
if current_row >= 0:
|
|
||||||
self.ui.xsltParamsTable.removeRow(current_row)
|
|
||||||
|
|
||||||
def get_data(self):
|
|
||||||
"""
|
|
||||||
Gibt die bearbeiteten Daten zurück.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict mit 'bez', 'xslt_params', 'force_transform', oder None bei Validierungsfehler
|
|
||||||
"""
|
|
||||||
bez = self.ui.bezEdit.text().strip()
|
|
||||||
if not bez:
|
|
||||||
QMessageBox.warning(self, "Warnung", "Bitte geben Sie eine Bezeichnung ein.")
|
|
||||||
return None
|
|
||||||
|
|
||||||
xslt_params = {}
|
|
||||||
for row in range(self.ui.xsltParamsTable.rowCount()):
|
|
||||||
key_item = self.ui.xsltParamsTable.item(row, 0)
|
|
||||||
value_item = self.ui.xsltParamsTable.item(row, 1)
|
|
||||||
if key_item and value_item:
|
|
||||||
key = key_item.text().strip()
|
|
||||||
if key:
|
|
||||||
xslt_params[key] = value_item.text().strip()
|
|
||||||
|
|
||||||
return {
|
|
||||||
"bez": bez,
|
|
||||||
"xslt_params": xslt_params,
|
|
||||||
"force_transform": self.ui.alle_xml_transformieren.isChecked(),
|
|
||||||
}
|
|
||||||
|
|
||||||
def accept(self):
|
|
||||||
"""Überschreibt accept() um Datenvalidierung durchzuführen."""
|
|
||||||
if self.get_data() is not None:
|
|
||||||
super().accept()
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
"""
|
|
||||||
Mixins für das MainWindow.
|
|
||||||
|
|
||||||
Dieses Paket enthält Mixins, die Funktionalität in separate Module auslagern,
|
|
||||||
um die MainWindow-Klasse übersichtlicher zu gestalten.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from ui.mixins.tree_manager import TreeManagerMixin
|
|
||||||
from ui.mixins.pdf_viewer import PdfViewerMixin
|
|
||||||
from ui.mixins.worker_pool import WorkerPoolMixin
|
|
||||||
from ui.mixins.database import DatabaseMixin
|
|
||||||
from ui.mixins.drag_drop import DragDropMixin
|
|
||||||
from ui.mixins.hash_calculation import HashCalculationMixin
|
|
||||||
from ui.mixins.transformation import TransformationMixin
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"TreeManagerMixin",
|
|
||||||
"PdfViewerMixin",
|
|
||||||
"WorkerPoolMixin",
|
|
||||||
"DatabaseMixin",
|
|
||||||
"DragDropMixin",
|
|
||||||
"HashCalculationMixin",
|
|
||||||
"TransformationMixin",
|
|
||||||
]
|
|
||||||
@@ -1,436 +0,0 @@
|
|||||||
"""
|
|
||||||
DatabaseMixin - Mixin für Datenbank-Operationen.
|
|
||||||
|
|
||||||
Dieses Mixin enthält alle Methoden zur PostgreSQL-Datenbankanbindung
|
|
||||||
und Datenverarbeitung für das MainWindow.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import logging
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from PySide6.QtCore import QThread, Signal, Qt
|
|
||||||
from PySide6.QtWidgets import QMessageBox, QProgressDialog
|
|
||||||
|
|
||||||
from conf import app_settings, TreeNode, XslFile
|
|
||||||
from obsolete_detector import (
|
|
||||||
collect_unused_xml_files,
|
|
||||||
extract_db_xsl_ids,
|
|
||||||
find_obsolete_xsl_entries,
|
|
||||||
remove_empty_tree_nodes,
|
|
||||||
)
|
|
||||||
from ui.ObsoleteEntriesDialog import ObsoleteEntriesDialog
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class DatabaseQueryThread(QThread):
|
|
||||||
"""Thread für asynchrone Datenbankabfragen."""
|
|
||||||
|
|
||||||
query_completed = Signal(object) # pl.DataFrame
|
|
||||||
query_failed = Signal(str) # Fehlermeldung
|
|
||||||
|
|
||||||
def __init__(self, sql_query, connection_string):
|
|
||||||
super().__init__()
|
|
||||||
self.sql_query = sql_query
|
|
||||||
self.connection_string = connection_string
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
import polars as pl
|
|
||||||
|
|
||||||
try:
|
|
||||||
df = pl.read_database_uri(self.sql_query, self.connection_string, engine="connectorx").sort(
|
|
||||||
["reporttyp_bez", "report_bez", "repfile_bez"]
|
|
||||||
)
|
|
||||||
self.query_completed.emit(df)
|
|
||||||
except Exception as e:
|
|
||||||
self.query_failed.emit(str(e))
|
|
||||||
|
|
||||||
|
|
||||||
class DatabaseMixin:
|
|
||||||
"""
|
|
||||||
Mixin für Datenbank-Operationen.
|
|
||||||
|
|
||||||
Dieses Mixin wird von MainWindow verwendet und erwartet folgende Attribute:
|
|
||||||
- self.project: Das aktuelle Projekt
|
|
||||||
- self.pdf_project: Die Projekt-Daten (ProjectData)
|
|
||||||
- self._load_nodes_to_tree(): Methode zum Laden der Nodes in den Tree
|
|
||||||
- self._save_project_settings(): Methode zum Speichern der Projekt-Einstellungen
|
|
||||||
"""
|
|
||||||
|
|
||||||
def on_load_from_fn2_clicked(self):
|
|
||||||
"""
|
|
||||||
Wird ausgeführt, wenn der Button "lade aus FN2" geklickt wird.
|
|
||||||
Startet SQL-Abfrage asynchron mit Fortschrittsdialog.
|
|
||||||
"""
|
|
||||||
logger.debug("Button 'lade aus FN2' wurde geklickt!")
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Prüfe ob ein Projekt geladen ist
|
|
||||||
if not hasattr(self, "project") or not self.project:
|
|
||||||
QMessageBox.warning(self, "Warnung", "Kein Projekt geladen. Bitte öffnen Sie zuerst ein Projekt.")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Hole die PostgreSQL-Datenbank-Konfiguration
|
|
||||||
db_config = self._get_database_config(self.project.postgre_sql_db_id)
|
|
||||||
if not db_config:
|
|
||||||
QMessageBox.warning(self, "Warnung", "PostgreSQL-Datenbank-Konfiguration nicht gefunden.")
|
|
||||||
return
|
|
||||||
|
|
||||||
# SQL-Abfrage und Connection-String vorbereiten
|
|
||||||
sql_query, connection_string = self._prepare_sql_query(db_config)
|
|
||||||
if sql_query is None:
|
|
||||||
return # Fehler bereits angezeigt
|
|
||||||
|
|
||||||
# Fortschrittsdialog erstellen
|
|
||||||
self._db_progress = QProgressDialog("Verbinde mit Datenbank...", "Abbrechen", 0, 0, self)
|
|
||||||
self._db_progress.setWindowTitle("Datenbank-Abfrage")
|
|
||||||
self._db_progress.setWindowModality(Qt.WindowModal)
|
|
||||||
self._db_progress.setMinimumDuration(0)
|
|
||||||
|
|
||||||
# Query-Thread erstellen und starten
|
|
||||||
self._db_query_thread = DatabaseQueryThread(sql_query, connection_string)
|
|
||||||
self._db_query_thread.query_completed.connect(self._on_db_query_completed)
|
|
||||||
self._db_query_thread.query_failed.connect(self._on_db_query_failed)
|
|
||||||
self._db_query_thread.finished.connect(self._cleanup_db_query)
|
|
||||||
self._db_progress.canceled.connect(self._on_db_query_canceled)
|
|
||||||
self._db_query_thread.start()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler beim Laden aus FN2: {e}")
|
|
||||||
QMessageBox.critical(self, "Fehler", f"Fehler beim Laden aus FN2:\n{str(e)}")
|
|
||||||
|
|
||||||
def _on_db_query_completed(self, df):
|
|
||||||
"""Wird aufgerufen, wenn die Datenbankabfrage erfolgreich war."""
|
|
||||||
# Ignoriere Ergebnis, falls der Benutzer abgebrochen hat
|
|
||||||
if hasattr(self, "_db_progress") and self._db_progress.wasCanceled():
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
new_nodes = self._process_sql_data(df)
|
|
||||||
self._merge_nodes_with_existing(new_nodes)
|
|
||||||
self._check_and_remove_obsolete_entries(new_nodes)
|
|
||||||
self._save_project_settings()
|
|
||||||
self._load_nodes_to_tree()
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler beim Verarbeiten der DB-Daten: {e}")
|
|
||||||
QMessageBox.critical(self, "Fehler", f"Fehler beim Verarbeiten der Daten:\n{str(e)}")
|
|
||||||
|
|
||||||
def _on_db_query_failed(self, error_msg):
|
|
||||||
"""Wird aufgerufen, wenn die Datenbankabfrage fehlgeschlagen ist."""
|
|
||||||
if hasattr(self, "_db_progress") and self._db_progress.wasCanceled():
|
|
||||||
return
|
|
||||||
|
|
||||||
error = f"Fehler beim Ausführen der SQL-Abfrage: {error_msg}"
|
|
||||||
logger.error(error)
|
|
||||||
QMessageBox.critical(self, "Fehler", error)
|
|
||||||
|
|
||||||
def _on_db_query_canceled(self):
|
|
||||||
"""Wird aufgerufen, wenn der Benutzer die Abfrage abbricht."""
|
|
||||||
logger.info("Datenbankabfrage vom Benutzer abgebrochen")
|
|
||||||
|
|
||||||
def _cleanup_db_query(self):
|
|
||||||
"""Räumt nach der Datenbankabfrage auf."""
|
|
||||||
if hasattr(self, "_db_progress"):
|
|
||||||
self._db_progress.canceled.disconnect(self._on_db_query_canceled)
|
|
||||||
self._db_progress.close()
|
|
||||||
self._db_progress.deleteLater()
|
|
||||||
del self._db_progress
|
|
||||||
if hasattr(self, "_db_query_thread"):
|
|
||||||
self._db_query_thread.deleteLater()
|
|
||||||
del self._db_query_thread
|
|
||||||
|
|
||||||
def _get_database_config(self, db_id):
|
|
||||||
"""
|
|
||||||
Holt die Datenbank-Konfiguration anhand der ID.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
db_id: ID der PostgreSQL-Datenbank
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
PostgreSqlDb|None: Die Datenbank-Konfiguration oder None
|
|
||||||
"""
|
|
||||||
for db in app_settings.postgresql_dbs:
|
|
||||||
if db.id == db_id:
|
|
||||||
return db
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _prepare_sql_query(self, db_config):
|
|
||||||
"""
|
|
||||||
Bereitet SQL-Abfrage und Connection-String vor.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
db_config: PostgreSQL-Datenbank-Konfiguration
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple[str, str]|tuple[None, None]: (sql_query, connection_string) oder (None, None) bei Fehler
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
# PyInstaller entpackt Ressourcen nach sys._MEIPASS;
|
|
||||||
# im Entwicklungsmodus liegt die Datei relativ zum Repo-Root
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
|
||||||
sql_file_path = Path(sys._MEIPASS) / "res" / "data.sql" # type: ignore[attr-defined]
|
|
||||||
else:
|
|
||||||
sql_file_path = Path(__file__).parents[3] / "src" / "res" / "data.sql"
|
|
||||||
if not sql_file_path.exists():
|
|
||||||
QMessageBox.critical(self, "Fehler", f"SQL-Datei nicht gefunden: {sql_file_path}")
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
with open(sql_file_path, "r", encoding="utf-8") as f:
|
|
||||||
sql_query = f.read()
|
|
||||||
|
|
||||||
logger.debug(f"SQL-Abfrage geladen: {len(sql_query)} Zeichen")
|
|
||||||
|
|
||||||
connection_string = (
|
|
||||||
"postgresql://"
|
|
||||||
f"{db_config.username}:"
|
|
||||||
f"{db_config.password}@"
|
|
||||||
f"{db_config.host}:"
|
|
||||||
f"{db_config.port}/"
|
|
||||||
f"{db_config.database}?"
|
|
||||||
f"sslmode={db_config.ssl_mode.value}"
|
|
||||||
f"&connect_timeout={db_config.timeout}"
|
|
||||||
)
|
|
||||||
|
|
||||||
logger.info(f"Verbinde zu PostgreSQL: {db_config.host}:{db_config.port}/{db_config.database}")
|
|
||||||
|
|
||||||
return sql_query, connection_string
|
|
||||||
except Exception as e:
|
|
||||||
error_msg = f"Fehler beim Vorbereiten der SQL-Abfrage: {str(e)}"
|
|
||||||
logger.error(error_msg)
|
|
||||||
QMessageBox.critical(self, "Fehler", error_msg)
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
def _process_sql_data(self, df):
|
|
||||||
"""
|
|
||||||
Verarbeitet die SQL-Daten wie in readCsv.py und erstellt Node-Struktur.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
df: Polars DataFrame mit den SQL-Ergebnissen
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
list[TreeNode]: Liste der erstellten Root-Nodes
|
|
||||||
"""
|
|
||||||
import polars as pl
|
|
||||||
|
|
||||||
try:
|
|
||||||
start_time = time.time()
|
|
||||||
|
|
||||||
# Gruppiere die Daten wie in readCsv.py
|
|
||||||
ebene_1 = df.group_by(["reporttyp", "reporttyp_bez"]).len()
|
|
||||||
ebene_2 = df.group_by(["reporttyp", "report", "report_bez"]).len()
|
|
||||||
ebene_3 = df.group_by(["reporttyp", "report", "repfile", "repfile_bez", "xsl_datei"]).len()
|
|
||||||
|
|
||||||
group_time = time.time() - start_time
|
|
||||||
logger.debug(f"Performance: Gruppierung in {group_time:.3f}s")
|
|
||||||
|
|
||||||
new_nodes = []
|
|
||||||
|
|
||||||
start_time = time.time()
|
|
||||||
|
|
||||||
# Erstelle Node-Struktur wie in readCsv.py
|
|
||||||
for r1 in ebene_1.rows(named=True):
|
|
||||||
tn_1 = TreeNode(id=(r1["reporttyp"],), bez=r1["reporttyp_bez"], children=[])
|
|
||||||
r1_children = ebene_2.filter(pl.col("reporttyp") == r1["reporttyp"])
|
|
||||||
|
|
||||||
for r2 in r1_children.rows(named=True):
|
|
||||||
tn_2 = TreeNode(id=(r2["reporttyp"], r2["report"]), bez=r2["report_bez"], children=[])
|
|
||||||
r2_children = ebene_3.filter(
|
|
||||||
(pl.col("reporttyp") == r1["reporttyp"]) & (pl.col("report") == r2["report"])
|
|
||||||
)
|
|
||||||
|
|
||||||
for r3 in r2_children.rows(named=True):
|
|
||||||
x = XslFile(
|
|
||||||
id=(r3["reporttyp"], r3["report"], r3["repfile"]),
|
|
||||||
bez=r3["repfile_bez"],
|
|
||||||
xsl_file=Path(r3["xsl_datei"]),
|
|
||||||
xmls=[],
|
|
||||||
)
|
|
||||||
|
|
||||||
tn_2.children.append(x)
|
|
||||||
tn_1.children.append(tn_2)
|
|
||||||
new_nodes.append(tn_1)
|
|
||||||
|
|
||||||
nodes_time = time.time() - start_time
|
|
||||||
logger.debug(f"Performance: Node-Erstellung in {nodes_time:.3f}s")
|
|
||||||
logger.info(f"Erstellt: {len(new_nodes)} Root-Nodes")
|
|
||||||
|
|
||||||
return new_nodes
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler beim Verarbeiten der SQL-Daten: {e}")
|
|
||||||
raise
|
|
||||||
|
|
||||||
def _merge_nodes_with_existing(self, new_nodes):
|
|
||||||
"""
|
|
||||||
Merged neue Nodes mit vorhandenen Nodes basierend auf IDs.
|
|
||||||
Überschreibt nur einzelne Eigenschaften, nicht ganze Nodes.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
new_nodes: Liste der neuen Nodes
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Merge neue Nodes mit vorhandenen...")
|
|
||||||
|
|
||||||
# Erstelle ein Dictionary der neuen Nodes für schnellen Zugriff
|
|
||||||
new_nodes_dict = {}
|
|
||||||
self._build_nodes_dict(new_nodes, new_nodes_dict)
|
|
||||||
|
|
||||||
logger.debug(f"Neue Nodes Dictionary erstellt: {len(new_nodes_dict)} Einträge")
|
|
||||||
|
|
||||||
# Merge mit vorhandenen Nodes
|
|
||||||
if self.pdf_project and self.pdf_project.nodes:
|
|
||||||
self._merge_nodes_recursive(self.pdf_project.nodes, new_nodes_dict)
|
|
||||||
|
|
||||||
# Füge komplett neue Root-Nodes hinzu
|
|
||||||
if self.pdf_project and self.pdf_project.nodes:
|
|
||||||
existing_root_ids = {node.id for node in self.pdf_project.nodes}
|
|
||||||
for new_node in new_nodes:
|
|
||||||
if new_node.id not in existing_root_ids:
|
|
||||||
self.pdf_project.nodes.append(new_node)
|
|
||||||
logger.info(f"Neue Root-Node hinzugefügt: {new_node.bez}")
|
|
||||||
elif self.pdf_project:
|
|
||||||
# Wenn keine Nodes vorhanden sind, füge alle neuen Nodes hinzu
|
|
||||||
self.pdf_project.nodes = new_nodes
|
|
||||||
logger.info(f"Alle {len(new_nodes)} Root-Nodes hinzugefügt (keine vorhandenen Nodes)")
|
|
||||||
|
|
||||||
logger.info("Merge abgeschlossen")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Fehler beim Mergen der Nodes: {e}")
|
|
||||||
raise
|
|
||||||
|
|
||||||
def _build_nodes_dict(self, nodes, nodes_dict):
|
|
||||||
"""
|
|
||||||
Erstellt rekursiv ein Dictionary aller Nodes für schnellen ID-basierten Zugriff.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
nodes: Liste der Nodes
|
|
||||||
nodes_dict: Dictionary zum Füllen
|
|
||||||
"""
|
|
||||||
for node in nodes:
|
|
||||||
nodes_dict[node.id] = node
|
|
||||||
|
|
||||||
if isinstance(node, TreeNode) and node.children:
|
|
||||||
self._build_nodes_dict(node.children, nodes_dict)
|
|
||||||
|
|
||||||
def _merge_nodes_recursive(self, existing_nodes, new_nodes_dict):
|
|
||||||
"""
|
|
||||||
Merged rekursiv vorhandene Nodes mit neuen Nodes.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
existing_nodes: Liste der vorhandenen Nodes
|
|
||||||
new_nodes_dict: Dictionary der neuen Nodes
|
|
||||||
"""
|
|
||||||
for existing_node in existing_nodes:
|
|
||||||
if existing_node.id in new_nodes_dict:
|
|
||||||
new_node = new_nodes_dict[existing_node.id]
|
|
||||||
|
|
||||||
# Aktualisiere nur die Bezeichnung, falls sie sich geändert hat
|
|
||||||
if existing_node.bez != new_node.bez:
|
|
||||||
logger.info(
|
|
||||||
f"Aktualisiere Bezeichnung für Node {existing_node.id}: '{existing_node.bez}' -> '{new_node.bez}'"
|
|
||||||
)
|
|
||||||
existing_node.bez = new_node.bez
|
|
||||||
|
|
||||||
# Für XslFile: Aktualisiere xsl_file Pfad
|
|
||||||
if isinstance(existing_node, XslFile) and isinstance(new_node, XslFile):
|
|
||||||
if existing_node.xsl_file != new_node.xsl_file:
|
|
||||||
logger.info(
|
|
||||||
f"Aktualisiere XSL-Datei für Node {existing_node.id}: '{existing_node.xsl_file}' -> '{new_node.xsl_file}'"
|
|
||||||
)
|
|
||||||
existing_node.xsl_file = new_node.xsl_file
|
|
||||||
|
|
||||||
# Rekursiv für Knoten (nur bei TreeNode)
|
|
||||||
if isinstance(existing_node, TreeNode) and existing_node.children:
|
|
||||||
self._merge_nodes_recursive(existing_node.children, new_nodes_dict)
|
|
||||||
|
|
||||||
# Füge neue Knoten hinzu, die noch nicht existieren
|
|
||||||
if existing_node.id in new_nodes_dict:
|
|
||||||
new_node = new_nodes_dict[existing_node.id]
|
|
||||||
if isinstance(new_node, TreeNode) and new_node.children:
|
|
||||||
existing_child_ids = {child.id for child in existing_node.children}
|
|
||||||
for new_child in new_node.children:
|
|
||||||
if new_child.id not in existing_child_ids:
|
|
||||||
existing_node.children.append(new_child)
|
|
||||||
logger.info(f"Neues Kind hinzugefügt zu Node {existing_node.id}: {new_child.bez}")
|
|
||||||
|
|
||||||
def _check_and_remove_obsolete_entries(self, new_nodes: list[TreeNode]) -> None:
|
|
||||||
"""
|
|
||||||
Prüft nach dem Merge ob XslFile-Einträge nicht mehr in der DB vorhanden sind.
|
|
||||||
Zeigt einen Bestätigungsdialog und entfernt veraltete Einträge inklusive
|
|
||||||
PDF- und optionaler XML-Bereinigung.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
new_nodes: Frisch aus der DB geladene Nodes (Ergebnis von _process_sql_data)
|
|
||||||
"""
|
|
||||||
if not self.pdf_project or not self.pdf_project.nodes:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
db_xsl_ids = extract_db_xsl_ids(new_nodes)
|
|
||||||
obsolete_groups = find_obsolete_xsl_entries(self.pdf_project.nodes, db_xsl_ids)
|
|
||||||
|
|
||||||
if not obsolete_groups:
|
|
||||||
logger.debug("Keine veralteten Einträge gefunden")
|
|
||||||
return
|
|
||||||
|
|
||||||
total_count = sum(len(g.xsl_entries) for g in obsolete_groups)
|
|
||||||
logger.info(f"{total_count} veraltete XSL-Einträge gefunden")
|
|
||||||
|
|
||||||
dialog = ObsoleteEntriesDialog(self, obsolete_groups)
|
|
||||||
if dialog.exec() != ObsoleteEntriesDialog.DialogCode.Accepted:
|
|
||||||
logger.info("Entfernung veralteter Einträge vom Benutzer abgebrochen")
|
|
||||||
return
|
|
||||||
|
|
||||||
delete_xml = dialog.delete_xml_files()
|
|
||||||
|
|
||||||
# Phase 1: XslFiles aus dem Datenmodell entfernen
|
|
||||||
# WICHTIG: Zuerst entfernen, damit _is_xml_xsl_combination_used_elsewhere
|
|
||||||
# und _is_xml_file_used_elsewhere die gelöschten Einträge nicht mehr sehen
|
|
||||||
# (gleiche Reihenfolge wie in _delete_tree_node)
|
|
||||||
for group in obsolete_groups:
|
|
||||||
parent = group.parent_node
|
|
||||||
obsolete_xsl_ids = {id(entry.xsl_file) for entry in group.xsl_entries}
|
|
||||||
parent.children = [c for c in parent.children if id(c) not in obsolete_xsl_ids]
|
|
||||||
logger.info(f"{len(group.xsl_entries)} XSL-Einträge aus '{' > '.join(group.node_path)}' entfernt")
|
|
||||||
|
|
||||||
# Phase 2: PDF-Bereinigung für alle entfernten XslFiles
|
|
||||||
total_deleted_pdfs = 0
|
|
||||||
for group in obsolete_groups:
|
|
||||||
for entry in group.xsl_entries:
|
|
||||||
xsl_id = entry.xsl_file.id
|
|
||||||
for xml_file_obj in entry.xsl_file.xmls:
|
|
||||||
is_used = self._is_xml_xsl_combination_used_elsewhere(xml_file_obj.xml, xsl_id, entry.xsl_file)
|
|
||||||
if not is_used:
|
|
||||||
total_deleted_pdfs += self._delete_pdf_files_for_xml_xsl_combination(
|
|
||||||
xml_file_obj.xml, xsl_id
|
|
||||||
)
|
|
||||||
|
|
||||||
if total_deleted_pdfs > 0:
|
|
||||||
logger.info(f"{total_deleted_pdfs} PDF-Datei(en) bereinigt")
|
|
||||||
|
|
||||||
# Phase 3: Leere TreeNodes bereinigen (bottom-up durch rekursiven Aufruf)
|
|
||||||
self.pdf_project.nodes = remove_empty_tree_nodes(self.pdf_project.nodes)
|
|
||||||
|
|
||||||
# Phase 4: Optionale physische XML-Löschung
|
|
||||||
if delete_xml:
|
|
||||||
unused_xml = collect_unused_xml_files(
|
|
||||||
obsolete_groups,
|
|
||||||
Path(self.project.project_dir),
|
|
||||||
self._is_xml_file_used_elsewhere,
|
|
||||||
)
|
|
||||||
for _rel, xml_abs in unused_xml:
|
|
||||||
try:
|
|
||||||
xml_abs.unlink()
|
|
||||||
logger.info(f"Physische XML-Datei gelöscht: {xml_abs}")
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f"Konnte XML-Datei nicht löschen: {xml_abs} - {e}")
|
|
||||||
|
|
||||||
logger.info(f"Bereinigung abgeschlossen: {total_count} veraltete Einträge entfernt")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
error_msg = f"Fehler beim Entfernen veralteter Einträge: {str(e)}"
|
|
||||||
logger.exception(error_msg)
|
|
||||||
QMessageBox.critical(self, "Fehler", error_msg)
|
|
||||||