frameplot 0.5.5__tar.gz → 0.5.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frameplot-0.5.5/src/frameplot.egg-info → frameplot-0.5.6}/PKG-INFO +8 -1
- {frameplot-0.5.5 → frameplot-0.5.6}/README.md +7 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/pyproject.toml +1 -1
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/api.py +6 -2
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/text.py +14 -8
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/model.py +8 -5
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/render/svg.py +93 -23
- {frameplot-0.5.5 → frameplot-0.5.6/src/frameplot.egg-info}/PKG-INFO +8 -1
- {frameplot-0.5.5 → frameplot-0.5.6}/tests/test_rendering.py +68 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/LICENSE +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/setup.cfg +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/__init__.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/__init__.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/order.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/place.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/rank.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/route.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/scc.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/types.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/layout/validate.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/render/__init__.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/render/png.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot/theme.py +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot.egg-info/SOURCES.txt +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot.egg-info/dependency_links.txt +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot.egg-info/requires.txt +0 -0
- {frameplot-0.5.5 → frameplot-0.5.6}/src/frameplot.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frameplot
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Summary: Turn Python-defined pipeline graphs into presentation-ready SVG and PNG diagrams.
|
|
5
5
|
Author: Small Turtle 2
|
|
6
6
|
License-Expression: MIT
|
|
@@ -147,6 +147,12 @@ Top-level imports are the supported public API:
|
|
|
147
147
|
- `to_png_bytes(scale=4.0) -> bytes`
|
|
148
148
|
- `save_png(path, scale=4.0) -> None`
|
|
149
149
|
|
|
150
|
+
## Modeling Guidance
|
|
151
|
+
|
|
152
|
+
- Keep the main graph at one abstraction level. Frameplot lays the pipeline out as a dependency-driven left-to-right graph, not as a freeform block diagram.
|
|
153
|
+
- Use `DetailPanel` for repeated block internals or per-stage mechanics that would otherwise create long-range edges in the main graph.
|
|
154
|
+
- Use `Group` to highlight nearby related nodes, not to force distant nodes to stay together. Groups are visual overlays and routing obstacles, so very wide groups can increase route detours.
|
|
155
|
+
|
|
150
156
|
## Advanced Example: Multi-cloud Data Pipeline
|
|
151
157
|
|
|
152
158
|
The hero image at the top and the theme gallery above are generated from [`examples/theme_heroes.py`](https://github.com/smturtle2/frameplot/blob/main/examples/theme_heroes.py), using the shared pipeline definition in [`examples/hero_pipeline.py`](https://github.com/smturtle2/frameplot/blob/main/examples/hero_pipeline.py). Together they showcase:
|
|
@@ -161,6 +167,7 @@ The hero image at the top and the theme gallery above are generated from [`examp
|
|
|
161
167
|
- Edge labels are not supported yet, but edge-to-edge joins can render optional `+` / `x` badges.
|
|
162
168
|
- Groups stay visual overlays, and routes leaving or re-entering grouped nodes bend outside grouped areas.
|
|
163
169
|
- Detail panels render as separate lower insets attached to a focus node in the main flow.
|
|
170
|
+
- If a sample looks stretched or routes far outside the intended block, the graph usually mixes stage-level flow with internal logic in one plane; move the internals into a `DetailPanel`.
|
|
164
171
|
|
|
165
172
|
## Development
|
|
166
173
|
|
|
@@ -118,6 +118,12 @@ Top-level imports are the supported public API:
|
|
|
118
118
|
- `to_png_bytes(scale=4.0) -> bytes`
|
|
119
119
|
- `save_png(path, scale=4.0) -> None`
|
|
120
120
|
|
|
121
|
+
## Modeling Guidance
|
|
122
|
+
|
|
123
|
+
- Keep the main graph at one abstraction level. Frameplot lays the pipeline out as a dependency-driven left-to-right graph, not as a freeform block diagram.
|
|
124
|
+
- Use `DetailPanel` for repeated block internals or per-stage mechanics that would otherwise create long-range edges in the main graph.
|
|
125
|
+
- Use `Group` to highlight nearby related nodes, not to force distant nodes to stay together. Groups are visual overlays and routing obstacles, so very wide groups can increase route detours.
|
|
126
|
+
|
|
121
127
|
## Advanced Example: Multi-cloud Data Pipeline
|
|
122
128
|
|
|
123
129
|
The hero image at the top and the theme gallery above are generated from [`examples/theme_heroes.py`](https://github.com/smturtle2/frameplot/blob/main/examples/theme_heroes.py), using the shared pipeline definition in [`examples/hero_pipeline.py`](https://github.com/smturtle2/frameplot/blob/main/examples/hero_pipeline.py). Together they showcase:
|
|
@@ -132,6 +138,7 @@ The hero image at the top and the theme gallery above are generated from [`examp
|
|
|
132
138
|
- Edge labels are not supported yet, but edge-to-edge joins can render optional `+` / `x` badges.
|
|
133
139
|
- Groups stay visual overlays, and routes leaving or re-entering grouped nodes bend outside grouped areas.
|
|
134
140
|
- Detail panels render as separate lower insets attached to a focus node in the main flow.
|
|
141
|
+
- If a sample looks stretched or routes far outside the intended block, the graph usually mixes stage-level flow with internal logic in one plane; move the internals into a `DetailPanel`.
|
|
135
142
|
|
|
136
143
|
## Development
|
|
137
144
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "frameplot"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.6"
|
|
8
8
|
description = "Turn Python-defined pipeline graphs into presentation-ready SVG and PNG diagrams."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -19,8 +19,12 @@ class Pipeline:
|
|
|
19
19
|
"""Describe and render a pipeline diagram.
|
|
20
20
|
|
|
21
21
|
The constructor accepts any iterable of nodes, edges, and groups, then
|
|
22
|
-
normalizes them to tuples for deterministic rendering.
|
|
23
|
-
|
|
22
|
+
normalizes them to tuples for deterministic rendering. The main graph uses
|
|
23
|
+
dependency-driven left-to-right auto-layout, so it works best when kept to
|
|
24
|
+
one abstraction level. If stage flow and internal mechanics are mixed into
|
|
25
|
+
the same graph, ranks can stretch and routes can become unexpectedly long;
|
|
26
|
+
move those internals into a :class:`DetailPanel` instead. Passing
|
|
27
|
+
`theme=None` uses the default :class:`Theme`.
|
|
24
28
|
"""
|
|
25
29
|
|
|
26
30
|
nodes: tuple[Node, ...]
|
|
@@ -64,14 +64,20 @@ def measure_text(validated: ValidatedPipeline) -> dict[str, MeasuredText]:
|
|
|
64
64
|
def _wrap(value: str | None, width: int) -> list[str]:
|
|
65
65
|
if not value:
|
|
66
66
|
return []
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
lines: list[str] = []
|
|
68
|
+
for explicit_line in value.splitlines() or [value]:
|
|
69
|
+
if explicit_line == "":
|
|
70
|
+
lines.append("")
|
|
71
|
+
continue
|
|
72
|
+
wrapped = textwrap.wrap(
|
|
73
|
+
explicit_line,
|
|
74
|
+
width=width,
|
|
75
|
+
break_long_words=True,
|
|
76
|
+
break_on_hyphens=False,
|
|
77
|
+
drop_whitespace=True,
|
|
78
|
+
)
|
|
79
|
+
lines.extend(wrapped or [explicit_line])
|
|
80
|
+
return lines
|
|
75
81
|
|
|
76
82
|
|
|
77
83
|
def _max_line_width(lines: tuple[str, ...], font_size: float, ratio: float) -> float:
|
|
@@ -76,9 +76,10 @@ class Edge:
|
|
|
76
76
|
class Group:
|
|
77
77
|
"""Highlight related nodes or edges with a labeled overlay.
|
|
78
78
|
|
|
79
|
-
Groups stay visual first
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
Groups stay visual first: they do not pin members together or force a
|
|
80
|
+
compact cluster. Layout still follows dependency ranks, and routes leaving
|
|
81
|
+
or re-entering grouped nodes bend outside the grouped area. At least one
|
|
82
|
+
node or edge reference is required.
|
|
82
83
|
"""
|
|
83
84
|
|
|
84
85
|
id: str
|
|
@@ -106,8 +107,10 @@ class Group:
|
|
|
106
107
|
class DetailPanel:
|
|
107
108
|
"""Expand a focus node into a lower inset with its own mini-graph.
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
Use a detail panel when a node's internal mechanics would otherwise add
|
|
111
|
+
long-range or cross-level edges to the main graph. The focus node must
|
|
112
|
+
exist in the main pipeline graph, and the panel must contain at least one
|
|
113
|
+
node.
|
|
111
114
|
"""
|
|
112
115
|
|
|
113
116
|
id: str
|
|
@@ -51,7 +51,7 @@ def render_svg(layout: LayoutResult, theme: Theme) -> str:
|
|
|
51
51
|
)
|
|
52
52
|
|
|
53
53
|
group_layer = ET.SubElement(root, ET.QName(SVG_NS, "g"), attrib={"id": "groups"})
|
|
54
|
-
|
|
54
|
+
_render_group_shapes(group_layer, layout.main, theme, metrics)
|
|
55
55
|
|
|
56
56
|
if layout.detail_panel is not None:
|
|
57
57
|
guide_layer = ET.SubElement(root, ET.QName(SVG_NS, "g"), attrib={"id": "detail-panel-guides"})
|
|
@@ -62,8 +62,8 @@ def render_svg(layout: LayoutResult, theme: Theme) -> str:
|
|
|
62
62
|
ET.QName(SVG_NS, "g"),
|
|
63
63
|
attrib={"id": f"detail-panel-{layout.detail_panel.panel.id}"},
|
|
64
64
|
)
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
_render_detail_panel_container_shape(panel_layer, layout.detail_panel, theme, metrics)
|
|
66
|
+
_render_group_shapes(panel_layer, layout.detail_panel.graph, theme, metrics)
|
|
67
67
|
|
|
68
68
|
edge_layer = ET.SubElement(root, ET.QName(SVG_NS, "g"), attrib={"id": "edges"})
|
|
69
69
|
_render_edges(edge_layer, layout.main.edges, marker_ids, theme, metrics)
|
|
@@ -86,6 +86,12 @@ def render_svg(layout: LayoutResult, theme: Theme) -> str:
|
|
|
86
86
|
id_prefix=f"detail-panel-{layout.detail_panel.panel.id}-",
|
|
87
87
|
)
|
|
88
88
|
|
|
89
|
+
label_layer = ET.SubElement(root, ET.QName(SVG_NS, "g"), attrib={"id": "labels"})
|
|
90
|
+
_render_group_labels(label_layer, layout.main, theme, metrics)
|
|
91
|
+
if layout.detail_panel is not None:
|
|
92
|
+
_render_detail_panel_title(label_layer, layout.detail_panel, theme, metrics)
|
|
93
|
+
_render_group_labels(label_layer, layout.detail_panel.graph, theme, metrics)
|
|
94
|
+
|
|
89
95
|
return ET.tostring(root, encoding="unicode")
|
|
90
96
|
|
|
91
97
|
|
|
@@ -142,7 +148,7 @@ def _build_shadow_filter(defs: ET.Element, metrics: ResolvedThemeMetrics) -> Non
|
|
|
142
148
|
ET.SubElement(merge, ET.QName(SVG_NS, "feMergeNode"), attrib={"in": "SourceGraphic"})
|
|
143
149
|
|
|
144
150
|
|
|
145
|
-
def
|
|
151
|
+
def _render_group_shapes(
|
|
146
152
|
parent: ET.Element,
|
|
147
153
|
graph: GraphLayout,
|
|
148
154
|
theme: Theme,
|
|
@@ -180,18 +186,28 @@ def _render_groups(
|
|
|
180
186
|
"stroke-linecap": "round",
|
|
181
187
|
},
|
|
182
188
|
)
|
|
183
|
-
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def _render_group_labels(
|
|
192
|
+
parent: ET.Element,
|
|
193
|
+
graph: GraphLayout,
|
|
194
|
+
theme: Theme,
|
|
195
|
+
metrics: ResolvedThemeMetrics,
|
|
196
|
+
) -> None:
|
|
197
|
+
for overlay in graph.groups:
|
|
198
|
+
_render_label_text(
|
|
184
199
|
parent,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
200
|
+
text=overlay.group.label,
|
|
201
|
+
x=overlay.bounds.x + theme.group_padding,
|
|
202
|
+
baseline_y=overlay.bounds.y + metrics.group_label_baseline_offset,
|
|
203
|
+
font_family=theme.title_font_family,
|
|
204
|
+
font_size=theme.subtitle_font_size,
|
|
205
|
+
font_weight=theme.title_font_weight,
|
|
206
|
+
text_color=theme.group_label_color,
|
|
207
|
+
underpaint_color=theme.background_color,
|
|
208
|
+
underpaint_opacity=1.0,
|
|
209
|
+
underpaint_width=max(theme.stroke_width * 3.0, theme.subtitle_font_size * 0.24),
|
|
210
|
+
)
|
|
195
211
|
|
|
196
212
|
|
|
197
213
|
def _render_guide_lines(parent: ET.Element, guide_lines: tuple[GuideLine, ...], theme: Theme) -> None:
|
|
@@ -209,7 +225,7 @@ def _render_guide_lines(parent: ET.Element, guide_lines: tuple[GuideLine, ...],
|
|
|
209
225
|
)
|
|
210
226
|
|
|
211
227
|
|
|
212
|
-
def
|
|
228
|
+
def _render_detail_panel_container_shape(
|
|
213
229
|
parent: ET.Element,
|
|
214
230
|
detail_panel: DetailPanelLayout,
|
|
215
231
|
theme: Theme,
|
|
@@ -243,18 +259,72 @@ def _render_detail_panel_container(
|
|
|
243
259
|
},
|
|
244
260
|
)
|
|
245
261
|
|
|
262
|
+
|
|
263
|
+
def _render_detail_panel_title(
|
|
264
|
+
parent: ET.Element,
|
|
265
|
+
detail_panel: DetailPanelLayout,
|
|
266
|
+
theme: Theme,
|
|
267
|
+
metrics: ResolvedThemeMetrics,
|
|
268
|
+
) -> None:
|
|
269
|
+
_render_label_text(
|
|
270
|
+
parent,
|
|
271
|
+
text=detail_panel.panel.label,
|
|
272
|
+
x=detail_panel.bounds.x + theme.detail_panel_padding,
|
|
273
|
+
baseline_y=detail_panel.bounds.y + metrics.detail_panel_title_baseline_offset,
|
|
274
|
+
font_family=theme.title_font_family,
|
|
275
|
+
font_size=theme.subtitle_font_size,
|
|
276
|
+
font_weight=theme.title_font_weight,
|
|
277
|
+
text_color=theme.detail_panel_title_color,
|
|
278
|
+
underpaint_color=detail_panel.fill,
|
|
279
|
+
underpaint_opacity=1.0,
|
|
280
|
+
underpaint_width=max(theme.stroke_width * 3.0, theme.subtitle_font_size * 0.26),
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _render_label_text(
|
|
285
|
+
parent: ET.Element,
|
|
286
|
+
*,
|
|
287
|
+
text: str,
|
|
288
|
+
x: float,
|
|
289
|
+
baseline_y: float,
|
|
290
|
+
font_family: str,
|
|
291
|
+
font_size: float,
|
|
292
|
+
font_weight: int,
|
|
293
|
+
text_color: str,
|
|
294
|
+
underpaint_color: str,
|
|
295
|
+
underpaint_opacity: float,
|
|
296
|
+
underpaint_width: float,
|
|
297
|
+
) -> None:
|
|
298
|
+
ET.SubElement(
|
|
299
|
+
parent,
|
|
300
|
+
ET.QName(SVG_NS, "text"),
|
|
301
|
+
attrib={
|
|
302
|
+
"x": _fmt(x),
|
|
303
|
+
"y": _fmt(baseline_y),
|
|
304
|
+
"fill": underpaint_color,
|
|
305
|
+
"fill-opacity": _fmt(underpaint_opacity),
|
|
306
|
+
"stroke": underpaint_color,
|
|
307
|
+
"stroke-opacity": _fmt(underpaint_opacity),
|
|
308
|
+
"stroke-width": _fmt(underpaint_width),
|
|
309
|
+
"stroke-linejoin": "round",
|
|
310
|
+
"font-family": font_family,
|
|
311
|
+
"font-size": _fmt(font_size),
|
|
312
|
+
"font-weight": str(font_weight),
|
|
313
|
+
},
|
|
314
|
+
).text = text
|
|
315
|
+
|
|
246
316
|
ET.SubElement(
|
|
247
317
|
parent,
|
|
248
318
|
ET.QName(SVG_NS, "text"),
|
|
249
319
|
attrib={
|
|
250
|
-
"x": _fmt(
|
|
251
|
-
"y": _fmt(
|
|
252
|
-
"fill":
|
|
253
|
-
"font-family":
|
|
254
|
-
"font-size": _fmt(
|
|
255
|
-
"font-weight": str(
|
|
320
|
+
"x": _fmt(x),
|
|
321
|
+
"y": _fmt(baseline_y),
|
|
322
|
+
"fill": text_color,
|
|
323
|
+
"font-family": font_family,
|
|
324
|
+
"font-size": _fmt(font_size),
|
|
325
|
+
"font-weight": str(font_weight),
|
|
256
326
|
},
|
|
257
|
-
).text =
|
|
327
|
+
).text = text
|
|
258
328
|
|
|
259
329
|
|
|
260
330
|
def _render_edges(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frameplot
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Summary: Turn Python-defined pipeline graphs into presentation-ready SVG and PNG diagrams.
|
|
5
5
|
Author: Small Turtle 2
|
|
6
6
|
License-Expression: MIT
|
|
@@ -147,6 +147,12 @@ Top-level imports are the supported public API:
|
|
|
147
147
|
- `to_png_bytes(scale=4.0) -> bytes`
|
|
148
148
|
- `save_png(path, scale=4.0) -> None`
|
|
149
149
|
|
|
150
|
+
## Modeling Guidance
|
|
151
|
+
|
|
152
|
+
- Keep the main graph at one abstraction level. Frameplot lays the pipeline out as a dependency-driven left-to-right graph, not as a freeform block diagram.
|
|
153
|
+
- Use `DetailPanel` for repeated block internals or per-stage mechanics that would otherwise create long-range edges in the main graph.
|
|
154
|
+
- Use `Group` to highlight nearby related nodes, not to force distant nodes to stay together. Groups are visual overlays and routing obstacles, so very wide groups can increase route detours.
|
|
155
|
+
|
|
150
156
|
## Advanced Example: Multi-cloud Data Pipeline
|
|
151
157
|
|
|
152
158
|
The hero image at the top and the theme gallery above are generated from [`examples/theme_heroes.py`](https://github.com/smturtle2/frameplot/blob/main/examples/theme_heroes.py), using the shared pipeline definition in [`examples/hero_pipeline.py`](https://github.com/smturtle2/frameplot/blob/main/examples/hero_pipeline.py). Together they showcase:
|
|
@@ -161,6 +167,7 @@ The hero image at the top and the theme gallery above are generated from [`examp
|
|
|
161
167
|
- Edge labels are not supported yet, but edge-to-edge joins can render optional `+` / `x` badges.
|
|
162
168
|
- Groups stay visual overlays, and routes leaving or re-entering grouped nodes bend outside grouped areas.
|
|
163
169
|
- Detail panels render as separate lower insets attached to a focus node in the main flow.
|
|
170
|
+
- If a sample looks stretched or routes far outside the intended block, the graph usually mixes stage-level flow with internal logic in one plane; move the internals into a `DetailPanel`.
|
|
164
171
|
|
|
165
172
|
## Development
|
|
166
173
|
|
|
@@ -1384,6 +1384,30 @@ def test_text_measurement_and_render_share_resolved_baselines() -> None:
|
|
|
1384
1384
|
assert float(texts[1].attrib["y"]) == pytest.approx(expected_subtitle_y)
|
|
1385
1385
|
|
|
1386
1386
|
|
|
1387
|
+
def test_text_measurement_preserves_explicit_newlines() -> None:
|
|
1388
|
+
pipeline = Pipeline(
|
|
1389
|
+
nodes=[Node("focus", "Primary Title", "First subtitle line\nSecond subtitle line")],
|
|
1390
|
+
edges=[],
|
|
1391
|
+
)
|
|
1392
|
+
|
|
1393
|
+
layout = build_layout(pipeline)
|
|
1394
|
+
layout_node = layout.main.nodes["focus"]
|
|
1395
|
+
node_group = ET.fromstring(pipeline.to_svg()).find(".//svg:g[@id='focus']", SVG_NS)
|
|
1396
|
+
|
|
1397
|
+
assert node_group is not None
|
|
1398
|
+
texts = node_group.findall("svg:text", SVG_NS)
|
|
1399
|
+
|
|
1400
|
+
assert layout_node.subtitle_lines == ("First subtitle line", "Second subtitle line")
|
|
1401
|
+
assert [text.text for text in texts] == [
|
|
1402
|
+
"Primary Title",
|
|
1403
|
+
"First subtitle line",
|
|
1404
|
+
"Second subtitle line",
|
|
1405
|
+
]
|
|
1406
|
+
assert float(texts[2].attrib["y"]) - float(texts[1].attrib["y"]) == pytest.approx(
|
|
1407
|
+
layout_node.subtitle_line_height
|
|
1408
|
+
)
|
|
1409
|
+
|
|
1410
|
+
|
|
1387
1411
|
def test_detail_panel_renders_as_separate_block_with_guides() -> None:
|
|
1388
1412
|
pipeline = Pipeline(
|
|
1389
1413
|
nodes=[
|
|
@@ -1417,6 +1441,50 @@ def test_detail_panel_renders_as_separate_block_with_guides() -> None:
|
|
|
1417
1441
|
assert svg.count('marker-end="url(#arrow-') == 4
|
|
1418
1442
|
|
|
1419
1443
|
|
|
1444
|
+
def test_group_and_detail_panel_labels_render_after_nodes() -> None:
|
|
1445
|
+
theme = Theme.dark()
|
|
1446
|
+
pipeline = Pipeline(
|
|
1447
|
+
nodes=[
|
|
1448
|
+
Node("source", "Source"),
|
|
1449
|
+
Node("focus", "Focus"),
|
|
1450
|
+
],
|
|
1451
|
+
edges=[Edge("e1", "source", "focus")],
|
|
1452
|
+
groups=[Group("g1", "Shared Stage", ("source", "focus"))],
|
|
1453
|
+
detail_panel=DetailPanel(
|
|
1454
|
+
"detail",
|
|
1455
|
+
"focus",
|
|
1456
|
+
"Expanded Focus",
|
|
1457
|
+
nodes=(Node("inner", "Inner"),),
|
|
1458
|
+
edges=(),
|
|
1459
|
+
),
|
|
1460
|
+
theme=theme,
|
|
1461
|
+
)
|
|
1462
|
+
|
|
1463
|
+
root = ET.fromstring(pipeline.to_svg())
|
|
1464
|
+
layer_ids = [child.attrib.get("id") for child in root if child.tag == f"{{{SVG_NS['svg']}}}g"]
|
|
1465
|
+
labels = root.find(".//svg:g[@id='labels']", SVG_NS)
|
|
1466
|
+
|
|
1467
|
+
assert labels is not None
|
|
1468
|
+
label_rects = labels.findall("svg:rect", SVG_NS)
|
|
1469
|
+
label_texts = labels.findall("svg:text", SVG_NS)
|
|
1470
|
+
shared_stage = [text for text in label_texts if text.text == "Shared Stage"]
|
|
1471
|
+
expanded_focus = [text for text in label_texts if text.text == "Expanded Focus"]
|
|
1472
|
+
|
|
1473
|
+
assert not label_rects
|
|
1474
|
+
assert len(shared_stage) == 2
|
|
1475
|
+
assert len(expanded_focus) == 2
|
|
1476
|
+
assert shared_stage[0].attrib["stroke"] == theme.background_color
|
|
1477
|
+
assert shared_stage[0].attrib["fill"] == theme.background_color
|
|
1478
|
+
assert shared_stage[1].attrib["fill"] == theme.group_label_color
|
|
1479
|
+
assert "stroke" not in shared_stage[1].attrib
|
|
1480
|
+
assert expanded_focus[0].attrib["stroke"] == theme.detail_panel_fill
|
|
1481
|
+
assert expanded_focus[0].attrib["fill"] == theme.detail_panel_fill
|
|
1482
|
+
assert expanded_focus[1].attrib["fill"] == theme.detail_panel_title_color
|
|
1483
|
+
assert "stroke" not in expanded_focus[1].attrib
|
|
1484
|
+
assert layer_ids.index("nodes") < layer_ids.index("labels")
|
|
1485
|
+
assert layer_ids.index("edge-joins") < layer_ids.index("labels")
|
|
1486
|
+
|
|
1487
|
+
|
|
1420
1488
|
def test_detail_panel_biases_focus_flow_to_lower_rows() -> None:
|
|
1421
1489
|
pipeline = Pipeline(
|
|
1422
1490
|
nodes=[
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|