ciberlabreport.pdf.proctree module

class ciberlabreport.pdf.proctree.ProcessTreeFlowable(roots: List[Dict[str, Any]] | None = None, rows: List[Dict[str, Any]] | None = None, row_height: float = 24.0, indent: float = 28.0, box_height: float = 18.0, h_padding: float = 8.0, v_padding: float = 6.0, font_name: str = 'CiberlabMono', font_size: float = 7.5)

Bases: Flowable

A custom ReportLab Flowable that renders a process tree inside a PDF document.

roots

A list of root nodes representing the top-level processes.

Type:

list[ProcessNode]

_rows

A flattened linear representation of every node in the process tree.

Type:

list[dict]

row_height

Vertical spacing allocated for each row.

Type:

float

indent

Horizontal indentation applied per tree depth level.

Type:

float

box_height

Pixel height of the rounded rectangle used for a process node.

Type:

float

h_padding

Horizontal padding relative to the flowable width.

Type:

float

v_padding

Vertical padding above and below the rendered tree.

Type:

float

font_name

Font to use for node labels.

Type:

str

font_size

Primary font size for the PID + name line.

Type:

float

_positions

Runtime lookup table mapping PID → rendered coordinates.

Type:

dict[int, dict[str, float]]

draw() None

Render the process tree onto the PDF canvas.

split(availWidth: float, availHeight: float) list[Flowable]

ReportLab hook: splits the flowable into multiple parts if it does not fit in the available height.

Parameters:
  • availWidth (float) – Width allocated for rendering.

  • availHeight (float) – Height available before a page break.

Returns:

Either:
  • [self] if everything fits, or

  • [first_part, remaining_part] if a split is needed.

Return type:

list[Flowable]

wrap(availWidth: float, availHeight: float) tuple[float, float]

ReportLab hook: computes the required width and height of the flowable.

Parameters:
  • availWidth (float) – Maximum width allocated by the layout engine.

  • availHeight (float) – Maximum height allocated for this flowable.

Returns:

The dimensions that the flowable will occupy.

Return type:

(width, height)