Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ __pycache__/
.eggs/
/doc/_generated
.svg

# Pixi
pixi.toml
pixi.lock
Comment thread
LudoBroche marked this conversation as resolved.
# pixi environments
.pixi/*
17 changes: 1 addition & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- CLI entry point `ewoksdraw` that generates an SVG file from a single output path argument.
- Automatic mock workflow generation with a background and randomly positioned task blocks.
- SVG task rendering with:
- task title text
- task box and title separator line
- input/output labels
- circular anchor links for IO ports
- Adaptive task layout logic that scales/truncates text and adjusts font sizes to keep content within box width constraints.
- SVG canvas export helpers:
- pretty-printed SVG file output
- in-memory XML representation
- dictionary representation via `xmltodict`
- Basic CLI smoke test ensuring `ewoksdraw` writes an SVG output file.
- Rounded cubic Bezier path geometry (`CubicBezierPath`/`CubicBezierSegment`) for connecting horizontal/vertical polyline points.
- `SvgLinkCubicBezier` SVG `path` component for rendering workflow links, with configurable color, stroke width, and dash array.
- `path` support in `SvgElement`'s supported SVG tags; `set_position()` now warns and no-ops for `path` elements since their position is defined by path data.
- `graph_to_svg`: Generates SVG mock-ups from Ewoks workflows.
15 changes: 14 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
<a href="https://github.com/ewoks-kit/.github/blob/main/shared/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>
<a href="https://github.com/ewoks-kit/.github/blob/main/shared/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>

### Pixi

```bash
pixi install
pixi update
pixi run test
pixi run test-lowest
pixi run lint
pixi run typecheck
pixi run full-ci
pixi run graph-to-svg acyclic1
```
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ A library to generate SVG mock-ups out of Ewoks workflows.

## Quick start

Using pip:
```bash
pip install "git+https://github.com/ewoks-kit/ewoksdraw.git"
```
Using pixi:
```bash
pixi add --pypi "ewoksdraw @ git+https://github.com/ewoks-kit/ewoksdraw.git"
```
### Python

```python
from ewoks import load_graph
Expand All @@ -22,4 +28,4 @@ graph = load_graph(...)

# Generate the SVG
graph_to_svg(graph, output_path="my_workflow.svg")
```
```
22 changes: 22 additions & 0 deletions examples/convert_ewoks_to_elk_graph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pprint import pprint

from ewokscore import load_graph
from ewokscore.tests.examples.graphs import get_graph

from ewoksdraw import build_svg_task_group
from ewoksdraw.layout.elk_converter import ElkGraph
from ewoksdraw.layout.elk_converter import convert_ewoks_to_elk_graph
from ewoksdraw.svg.svg_task_group import SvgTaskGroup
from ewoksdraw.svg.svg_task_group import TaskSizes

graph_description, _ = get_graph("acyclic1")
ewoks_graph = load_graph(graph_description)

svg_task_group: SvgTaskGroup = build_svg_task_group(ewoks_graph)
task_sizes: TaskSizes = svg_task_group.extract_task_sizes()
elk_graph: ElkGraph = convert_ewoks_to_elk_graph(ewoks_graph, task_sizes)

pprint(dict(ewoks_graph.graph.nodes(data=True)))
pprint(list(ewoks_graph.graph.edges(data=True)))
pprint(task_sizes)
pprint(elk_graph)
8 changes: 4 additions & 4 deletions examples/cubic_bezier_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,29 @@
],
radius=30,
)
links_group = SvgGroup()
links_group: SvgGroup[SvgLinkCubicBezier] = SvgGroup()
links_group.add_elements(
[
SvgLinkCubicBezier(letter_e),
SvgLinkCubicBezier(
letter_w,
color="#00c2a8",
stroke_width=4,
stroke_dash="5 10",
stroke_dasharray="5 10",
),
SvgLinkCubicBezier(
letter_o,
color="#ffcc00",
stroke_width=6,
stroke_dash="1 5",
stroke_dasharray="1 5",
),
SvgLinkCubicBezier(letter_k, color="#7c5cff", stroke_width=4),
SvgLinkCubicBezier(letter_s, color="#54a068", stroke_width=10),
SvgLinkCubicBezier(
underline,
color="#ff00aa",
stroke_width=3,
stroke_dash="12 6",
stroke_dasharray="12 6",
),
]
)
Expand Down
17 changes: 17 additions & 0 deletions examples/graph_to_svg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import argparse
from pathlib import Path

from ewokscore import load_graph
from ewokscore.tests.examples.graphs import get_graph

from ewoksdraw import graph_to_svg

parser = argparse.ArgumentParser()
parser.add_argument("workflow", nargs="?", default="acyclic1")
args = parser.parse_args()

graph_description, _ = get_graph(args.workflow)
graph = load_graph(graph_description)
output_path = Path("examples") / f"{args.workflow}.svg"
graph_to_svg(graph, output_path)
print(f"Wrote {output_path}")
Loading
Loading