aboutsummaryrefslogtreecommitdiffstats
path: root/modules/base.py
blob: 7d04644f722ee109dfbfa085fb7075bb6dcde3a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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:
        ...