aboutsummaryrefslogtreecommitdiffstats
path: root/modules/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/base.py')
-rw-r--r--modules/base.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/modules/base.py b/modules/base.py
new file mode 100644
index 0000000..7d04644
--- /dev/null
+++ b/modules/base.py
@@ -0,0 +1,39 @@
+from dataclasses import dataclass
+from typing import Any, Dict, List, Protocol
+
+import matplotlib.pyplot as plt
+from matplotlib.axes import Axes
+from matplotlib.font_manager import FontProperties
+
+
+@dataclass
+class Frame:
+ title: str
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ raise NotImplementedError
+
+@dataclass
+class BigFrame:
+ """
+ Nimmt eine halbe PDF-Seite ein (Renderer packt 2 BigFrames pro Seite).
+ """
+ title: str
+
+ def render(self, ax: Axes, mono_font: FontProperties) -> None:
+ raise NotImplementedError
+
+@dataclass
+class ModuleResult:
+ summary_text: str # NEU: wird im Hauptprogramm in die Konsole gedruckt
+ frames: List[Frame] # Kacheln (optional)
+ bigframes: List[BigFrame]
+ pages: List[plt.Figure] # Vollseiten (optional)
+
+
+class Module(Protocol):
+ name: str
+
+ def process(self, df, context: Dict[str, Any]) -> ModuleResult:
+ ...
+