Dialoge in eigene Dateien ausgelagert
- `JavaVmConfigDialog` - `DiffPdfConfigDialog` - `SaxonJarConfigDialog` - `ApacheFopConfigDialog` - `XslDirConfigDialog`
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
from PySide6.QtWidgets import QDialog, QFileDialog
|
||||
from pathlib import Path
|
||||
|
||||
from ui.ApacheFopConfigDialog_ui import Ui_ApacheFopConfigDialog
|
||||
|
||||
|
||||
class ApacheFopConfigDialog(QDialog):
|
||||
"""Dialog zur Konfiguration von Apache FOP ohne ID."""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
# UI einrichten
|
||||
self.ui = Ui_ApacheFopConfigDialog()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
# Signale verbinden
|
||||
self.ui.browseButton.clicked.connect(self.browse_directory)
|
||||
|
||||
def browse_directory(self):
|
||||
"""Öffnet einen Verzeichnisdialog."""
|
||||
dir_path = QFileDialog.getExistingDirectory(self, "Apache FOP Verzeichnis auswählen")
|
||||
if dir_path:
|
||||
self.ui.pathEdit.setText(dir_path)
|
||||
|
||||
def set_data(self, data):
|
||||
"""Setzt die Daten in den Dialog."""
|
||||
if data:
|
||||
self.ui.versionEdit.setText(data.get("version", ""))
|
||||
self.ui.pathEdit.setText(str(data.get("path_to_dir", "")))
|
||||
self.ui.extensionEdit.setText(data.get("output_file_extension", "pdf"))
|
||||
|
||||
def get_data(self):
|
||||
"""Gibt die eingegebenen Daten zurück."""
|
||||
if not self.ui.versionEdit.text().strip() or not self.ui.pathEdit.text().strip():
|
||||
return None
|
||||
|
||||
return {
|
||||
"version": self.ui.versionEdit.text().strip(),
|
||||
"path_to_dir": Path(self.ui.pathEdit.text().strip()),
|
||||
"output_file_extension": self.ui.extensionEdit.text().strip() or "pdf",
|
||||
}
|
||||
Reference in New Issue
Block a user