summaryrefslogtreecommitdiff
path: root/calendar_gui.py
diff options
context:
space:
mode:
Diffstat (limited to 'calendar_gui.py')
-rw-r--r--calendar_gui.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/calendar_gui.py b/calendar_gui.py
index f0edb52..ab0cf65 100644
--- a/calendar_gui.py
+++ b/calendar_gui.py
@@ -16,6 +16,7 @@ from prediction_controller import PredictionController
from event_type_handler import EventTypeHandler
from date_service import DateService
from config import EventConfig
+from prediction_report_service import PredictionReportService
class EventDialog(QDialog):
def __init__(self, entry=None, parent=None):
@@ -230,6 +231,14 @@ class CalendarManagerGUI(QMainWindow):
load_action.setIcon(self.style().standardIcon(QStyle.SP_DialogOpenButton))
load_action.triggered.connect(self.load_file)
file_menu.addAction(load_action)
+
+ # Export PDF action
+ export_pdf_action = QAction('Als PDF exportieren', self)
+ export_pdf_action.setShortcut('Ctrl+P')
+ # Fallback icon; SP_DialogPrintButton may not exist in some Qt styles
+ export_pdf_action.setIcon(self.style().standardIcon(QStyle.SP_DialogOpenButton))
+ export_pdf_action.triggered.connect(self.export_pdf)
+ file_menu.addAction(export_pdf_action)
# Note: Saving/Loading now operate on complete prediction state
@@ -643,6 +652,28 @@ class CalendarManagerGUI(QMainWindow):
except Exception as e:
QMessageBox.critical(self, "Error", f"Fehler beim Laden des Komplettzustands: {str(e)}")
+ def export_pdf(self):
+ """Export a formatted report to PDF including metadata and full table."""
+ out_path, _ = QFileDialog.getSaveFileName(
+ self,
+ "PDF exportieren",
+ "",
+ "PDF (*.pdf)"
+ )
+ if not out_path:
+ return
+ success = PredictionReportService.export_pdf(
+ self.calendar_manager,
+ self.prediction_controller,
+ out_path,
+ self.dateformat,
+ )
+ if success:
+ if not out_path.lower().endswith('.pdf'):
+ out_path = out_path + '.pdf'
+ QMessageBox.information(self, "Export erfolgreich", f"PDF exportiert nach {out_path}")
+ else:
+ QMessageBox.critical(self, "Fehler", "PDF-Export fehlgeschlagen.")
def clear_entries(self):
"""Clear all calendar entries"""