summaryrefslogtreecommitdiff
path: root/ui/strip_chart.py
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2026-06-03 15:05:36 -0600
committerChristian Kolset <christian.kolset@gmail.com>2026-06-03 15:05:36 -0600
commit7b926faab3dcd52e45fc1b4b24f955a4dcf66959 (patch)
treeede3018b2557d9d06d50f8439f91767c8795776f /ui/strip_chart.py
parent93e7d0ecdc090fd4f0231b13933fc0fa095a1f22 (diff)
Add drag-and-snap tiling layout canvas to Plot Builder
Replace layout radio buttons (Stacked/Side-by-Side/Grid) with a visual LayoutCanvas widget. Pane tiles snap to grid cells on drag-drop; dropping on an occupied cell swaps positions. Ghost highlight shows snap target during drag. - PaneSpec gains row/col fields (None = unassigned; backward compat preserved) - LayoutConfig gains "free" mode; strip_chart reads explicit positions - PaneBlock loses ▲▼ move buttons; reordering is canvas-only - QSS entries added for layoutTile, layoutTileDragging, layoutCanvasBar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'ui/strip_chart.py')
-rw-r--r--ui/strip_chart.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/strip_chart.py b/ui/strip_chart.py
index 523102d..d855038 100644
--- a/ui/strip_chart.py
+++ b/ui/strip_chart.py
@@ -95,12 +95,14 @@ class StripChartWidget(QWidget):
n = len(cfg.panes)
# Determine row/col for each pane
- if cfg.layout_mode == "sidebyside":
+ if cfg.layout_mode == "free":
+ positions = [(spec.row or 0, spec.col or 0) for spec in cfg.panes]
+ elif cfg.layout_mode == "sidebyside":
positions = [(0, c) for c in range(n)]
elif cfg.layout_mode == "grid":
cols = max(1, cfg.grid_cols)
positions = [(i // cols, i % cols) for i in range(n)]
- else: # stacked
+ else: # stacked (legacy default)
positions = [(r, 0) for r in range(n)]
ref_plot = None
@@ -112,7 +114,7 @@ class StripChartWidget(QWidget):
plot.getAxis("left").setStyle(tickFont=mf)
plot.getAxis("bottom").setStyle(tickFont=mf)
- # Hide bottom axis labels for all but bottom row in stacked
+ # Hide bottom axis labels for non-bottom panes in stacked legacy mode
if cfg.layout_mode == "stacked" and idx < n - 1:
plot.getAxis("bottom").setStyle(showValues=False)
plot.getAxis("bottom").setHeight(0)
@@ -133,10 +135,9 @@ class StripChartWidget(QWidget):
else:
plot.enableAutoRange(axis="y")
- # Set column stretch (relative weight)
+ # Apply weight to row and column stretch
self._gw.ci.layout.setColumnStretchFactor(col, spec.weight)
- if cfg.layout_mode == "stacked":
- self._gw.ci.layout.setRowStretchFactor(row, spec.weight)
+ self._gw.ci.layout.setRowStretchFactor(row, spec.weight)
for tr in spec.traces:
if not tr.visible: continue