92 lines
4.5 KiB
Markdown
92 lines
4.5 KiB
Markdown
# Pipeline Network Diagram Editor — Implementation Plan
|
|
|
|
A desktop diagram editor for drawing **pipeline networks** (water lines, power lines,
|
|
gas, etc.), built with **PyQt6** on the **QGraphicsView / QGraphicsScene** framework.
|
|
|
|
## Tool selection (research outcome)
|
|
|
|
| Candidate | Verdict |
|
|
|-----------|---------|
|
|
| **QGraphicsView framework (chosen)** | Maximum control over custom SVG nodes, typed ports, orthogonal grid routing, arc crossings, flow animation. Mature, high item-count performance. |
|
|
| QtNodes (paceholder/nodeeditor) | Dataflow-centric, fixed node visuals, v3 breaking API — poor fit for grid-routed pipeline networks. |
|
|
| QuickQanava (QML) | Modern but connection routing in QML is the hard part; less control over orthogonal/arc routing. |
|
|
|
|
Bindings: **PyQt6 6.10** (apt, works with Python 3.14). Tests: **pytest + pytest-qt**,
|
|
headless via `QT_QPA_PLATFORM=offscreen`.
|
|
|
|
Sources:
|
|
- <https://github.com/paceholder/nodeeditor>
|
|
- <https://github.com/cneben/QuickQanava>
|
|
- <https://doc.qt.io/qt-6/qtwidgets-graphicsview-elasticnodes-example.html>
|
|
- <https://www.qt.io/blog/2017/01/19/should-you-be-using-qgraphicsview>
|
|
|
|
---
|
|
|
|
## Phase 0 — Project scaffolding
|
|
- [x] Repo layout, `requirements.txt`, `README.md`, `.gitignore`
|
|
- [x] `pipeline_editor` package skeleton + `__main__` entry point
|
|
- [x] pytest config + headless conftest (QApplication fixture)
|
|
|
|
## Phase 1 — Domain model (no UI)
|
|
- [x] `PropertyType` enum: string, int, float, bool, enum, color, catalogue_item, catalogue_items, value_list
|
|
- [x] `Property` + `PropertyGroup` (grouped, editable/readonly, validation)
|
|
- [x] `Catalogue` / `CatalogueItem` registry
|
|
- [x] `PortRelation` registry (water/power/gas...) with color schemes + compatibility rules
|
|
- [x] `Port` (id, name, relation, side/offset, direction)
|
|
- [x] `NodeModel`, `EdgeModel` (ids, geometry, style, property groups)
|
|
- [x] `DiagramDocument` — holds nodes/edges, emits change signals
|
|
- [x] JSON serialization / deserialization (round-trip)
|
|
|
|
## Phase 2 — Node library (feature #1)
|
|
- [x] Bundled SVG node graphics (pump, tank, valve, junction, source, sink, transformer…)
|
|
- [x] `NodeTemplate` = SVG + port configuration, organized into groups
|
|
- [x] Left dock `NodePanel`: grouped tree with vector previews
|
|
- [x] Drag-and-drop node template → canvas creates a node
|
|
|
|
## Phase 3 — Canvas, scene & nodes
|
|
- [x] `CanvasView`: zoom (wheel), pan, fit-to-view, rubber-band select
|
|
- [x] Grid background (dots/lines), configurable size, snap-to-grid
|
|
- [x] `NodeItem`: renders SVG, movable, selectable, edges follow on move
|
|
- [x] Multi-select move, delete
|
|
|
|
## Phase 4 — Ports & edges (features #2, #3, #5)
|
|
- [x] Focused node reveals `PortItem` handles
|
|
- [x] Port relation coloring + connection-compatibility feedback
|
|
- [x] Drag from port → other node's port (or self) creates an edge
|
|
- [x] Orthogonal routing along rectangular grid
|
|
- [x] Config option: draw **arc** at line intersections/crossings
|
|
- [x] `EdgeItem` styles: line style, head/tail decorations (arrow, circle, diamond, none)
|
|
|
|
## Phase 5 — Property panel (feature #4)
|
|
- [x] Right dock `PropertyPanel`: grouped property editors
|
|
- [x] Editor widgets per type (string/int/float/bool/enum/color/catalogue/list)
|
|
- [x] Two-way binding: edit → model → view refresh
|
|
- [x] Geometry/title (presentation) group + physics group (length, diameter, flow rate, flow type)
|
|
|
|
## Phase 6 — Mock calculation & flow animation
|
|
- [x] `FlowSolver`: mock flow distribution across edges (conservation-ish heuristic)
|
|
- [x] Per-edge flow value + direction
|
|
- [x] `FlowAnimator`: animate direction (marching dashes) and volume (speed/width)
|
|
- [x] Play/pause/stop controls
|
|
|
|
## Phase 7 — Editing UX & configuration (added features)
|
|
- [x] Undo/redo via `QUndoStack` (add/move/delete/connect/edit)
|
|
- [x] Copy / paste / duplicate / delete
|
|
- [x] Save / Open / New document (JSON)
|
|
- [x] Export canvas to PNG / SVG
|
|
- [x] Config dialog: grid size, snap, arc-on-crossing, color scheme, animation speed
|
|
- [x] Multiple color schemes (light/dark + relation palettes)
|
|
- [x] Toolbar + menus + status bar + keyboard shortcuts
|
|
|
|
## Phase 8 — Tests (typical scenarios)
|
|
- [x] Model: properties, catalogue, relations, serialization round-trip
|
|
- [x] Routing: orthogonal path + arc-crossing generation
|
|
- [x] Flow solver: conservation & direction on a small network
|
|
- [x] Scene: create node via drop, connect ports, move node moves edge, delete cascades
|
|
- [x] Property panel: edit propagates to model
|
|
- [x] Undo/redo of add/move/connect/delete
|
|
|
|
## Phase 9 — Polish
|
|
- [x] README with run/test instructions and screenshots
|
|
- [x] Final pass: lint, docstrings, sample document
|